How to add "portable" to the electron builder .exe file name? - electron-builder

This is my package.json build data:
"build": {
"appId": "name.desktop",
"productName": "name",
"beforePack": "electron/beforePack.js",
"extraResources": [
{
"from": "bin/${os}",
"to": "bin",
"filter": [
"**/*"
]
}
],
"files": [
"build/**/*",
"electron/**/*",
"package.json"
],
"extends": null,
"mac": {
"target": "dmg",
"type": "distribution"
},
"win": {
"target": [
"portable",
"nsis"
]
},
"linux": {
"target": "AppImage"
}
}
I'm looking to add "portable" to the windows portable file name, so that the .exe is "name 1.0.0 portable.exe" instead of "name 1.0.0.exe"

It is possible to explicitely define the generated file names at each relevant level in the package.json file by making use of an "artifactName" property.
This is documented in the Overridable per Platform Options section of the Common Configuration - electron-builder page:
Following options can be set also per platform (top-level keys mac, linux and win) if need.
artifactName String | “undefined” - The artifact file name template. Defaults to ${productName}-${version}.${ext} (some target can have other defaults, see corresponding options).
which indirectly refers to the File Macros section of the File Patterns - electron-builder page.
In your specific case, you'll have to add the following "artifactName" property to your package.json file at the Windows version level:
"artifactName": "${name} ${version} portable.${ext}",
i.e.:
"build": {
"appId": "name.desktop",
"productName": "name",
"beforePack": "electron/beforePack.js",
"extraResources": [
{
"from": "bin/${os}",
"to": "bin",
"filter": [
"**/*"
]
}
],
"files": [
"build/**/*",
"electron/**/*",
"package.json"
],
"extends": null,
"mac": {
"target": "dmg",
"type": "distribution"
},
"win": {
"artifactName": "${name} ${version} portable.${ext}",
"target": [
"portable",
"nsis"
]
},
"linux": {
"target": "AppImage"
}
}

Related

What is "Exported Binaries" in yarn info

I am trying to understand the output of
yarn info ts-node --json
{
"value": "ts-node#npm:8.5.4",
"children": {
"Instances": 1,
"Version": "8.5.4",
"Exported Binaries": [
"ts-node",
"ts-script"
],
"Dependencies": [
{
"descriptor": "arg#npm:^4.1.0",
"locator": "arg#npm:4.1.3"
},
{
"descriptor": "diff#npm:^4.0.1",
"locator": "diff#npm:4.0.2"
},
{
"descriptor": "make-error#npm:^1.1.1",
"locator": "make-error#npm:1.3.6"
},
{
"descriptor": "source-map-support#npm:^0.5.6",
"locator": "source-map-support#npm:0.5.21"
},
{
"descriptor": "yn#npm:^3.0.0",
"locator": "yn#npm:3.1.1"
}
]
}
}
So far I understand ts-node version 8.5.4 is installed
But what does "Exported Binaries" signify? I thought it would mean direct dependency but I don't have ts-script in my package.json.

Could not find package drush/drush

I'm facing a problem while I'm running this commmand composer require drush/drush but it didn't work for me and I got this error message:
[InvalidArgumentException] Could not find package drush/drush. It
was however found via repository search, which indicates a consistency
issue with the repository.
I'm using Drupal 8.9.18, Drush version : 10.6.1 and my PHP version is: php7.1.33
my composer.json file :
{
"name": "drupal/legacy-project",
"description": "Project template for Drupal 8 projects with composer following drupal/drupal layout",
"type": "project",
"license": "GPL-2.0-or-later",
"homepage": "https://www.drupal.org/project/drupal",
"support": {
"docs": "https://www.drupal.org/docs/user_guide/en/index.html",
"chat": "https://www.drupal.org/node/314178"
},
"repositories": {
"drupal": {
"type": "composer",
"url": "https://packages.drupal.org/8"
},
"0": {
"type": "composer",
"url": "https://packages.drupal.org/8"
},
"gigyadrupal": {
"type": "git",
"url": "https://github.com/gigya/drupal8.git"
}
},
"require": {
"composer/installers": "^1.2",
"drupal/core-composer-scaffold": "^8.8",
"drupal/core-project-message": "^8.8",
"drupal/core-recommended": "^8.8",
"drupal/core-vendor-hardening": "^8.8",
"drupal/gigya": "^1.7"
},
"conflict": {
"drupal/drupal": "*"
},
"minimum-stability": "dev",
"prefer-stable": true,
"config": {
"sort-packages": true
},
"extra": {
"drupal-scaffold": {
"locations": {
"web-root": "./"
}
},
"installer-paths": {
"core": [
"type:drupal-core"
],
"libraries/{$name}": [
"type:drupal-library"
],
"modules/contrib/{$name}": [
"type:drupal-module"
],
"profiles/contrib/{$name}": [
"type:drupal-profile"
],
"themes/contrib/{$name}": [
"type:drupal-theme"
],
"drush/Commands/contrib/{$name}": [
"type:drupal-drush"
],
"modules/custom/{$name}": [
"type:drupal-custom-module"
],
"themes/custom/{$name}": [
"type:drupal-custom-theme"
]
},
"drupal-core-project-message": {
"include-keys": [
"homepage",
"support"
],
"post-create-project-cmd-message": [
"<bg=blue;fg=white> </>",
"<bg=blue;fg=white> Congratulations, you’ve installed the Drupal codebase </>",
"<bg=blue;fg=white> from the drupal/legacy-project template! </>",
"<bg=blue;fg=white> </>",
"",
"<bg=yellow;fg=black>Next steps</>:",
" * Install the site: https://www.drupal.org/docs/8/install",
" * Read the user guide: https://www.drupal.org/docs/user_guide/en/index.html",
" * Get support: https://www.drupal.org/support",
" * Get involved with the Drupal community:",
" https://www.drupal.org/getting-involved",
" * Remove the plugin that prints this message:",
" composer remove drupal/core-project-message"
]
}
}
}
You need to have an installable set of packages. drupal/gigya doesn't really exist (anymore). You also should not be using the drupal/legacy-project at all.
This is the best I came up with, although that's maybe not giving you the version of Gigya you want. Not sure, try it out. Check the updated respositories section and the updated "gigya/gigya-drupal": "*" package name which will always get you the latest master from GitHub.
{
"name": "drupal/legacy-project",
"description": "Project template for Drupal 8 projects with composer following drupal/drupal layout",
"type": "project",
"license": "GPL-2.0-or-later",
"homepage": "https://www.drupal.org/project/drupal",
"support": {
"docs": "https://www.drupal.org/docs/user_guide/en/index.html",
"chat": "https://www.drupal.org/node/314178"
},
"repositories": [
{
"type": "composer",
"url": "https://packages.drupal.org/8"
},
{
"type": "vcs",
"url": "https://github.com/gigya/drupal8"
}
],
"require": {
"composer/installers": "^1.2",
"drupal/core-composer-scaffold": "^8.8",
"drupal/core-project-message": "^8.8",
"drupal/core-recommended": "^8.8",
"drupal/core-vendor-hardening": "^8.8",
"gigya/gigya-drupal": "*"
},
"conflict": {
"drupal/drupal": "*"
},
"minimum-stability": "dev",
"prefer-stable": true,
"config": {
"sort-packages": true
},
"extra": {
"drupal-scaffold": {
"locations": {
"web-root": "./"
}
},
"installer-paths": {
"core": [
"type:drupal-core"
],
"libraries/{$name}": [
"type:drupal-library"
],
"modules/contrib/{$name}": [
"type:drupal-module"
],
"profiles/contrib/{$name}": [
"type:drupal-profile"
],
"themes/contrib/{$name}": [
"type:drupal-theme"
],
"drush/Commands/contrib/{$name}": [
"type:drupal-drush"
],
"modules/custom/{$name}": [
"type:drupal-custom-module"
],
"themes/custom/{$name}": [
"type:drupal-custom-theme"
]
},
"drupal-core-project-message": {
"include-keys": [
"homepage",
"support"
],
"post-create-project-cmd-message": [
"<bg=blue;fg=white> </>",
"<bg=blue;fg=white> Congratulations, you’ve installed the Drupal codebase </>",
"<bg=blue;fg=white> from the drupal/legacy-project template! </>",
"<bg=blue;fg=white> </>",
"",
"<bg=yellow;fg=black>Next steps</>:",
" * Install the site: https://www.drupal.org/docs/8/install",
" * Read the user guide: https://www.drupal.org/docs/user_guide/en/index.html",
" * Get support: https://www.drupal.org/support",
" * Get involved with the Drupal community:",
" https://www.drupal.org/getting-involved",
" * Remove the plugin that prints this message:",
" composer remove drupal/core-project-message"
]
}
}
}

How have VS Code/Intellisense recognize glib C/C++ on Windows 10

I am wracking my brain trying to figure out how to have VS Code recognize glib.
#include errors detected. Please update your includePath. Squiggles are disabled for this translation unit (Q:\code\srctext\text_lexer.c).C/C++(1696)
cannot open source file "glibconfig.h" (dependency of "glib-2.0/gmodule.h")C/C++(1696)
I have manually built glib and have the following *.dll and *.pdb files:
gio-2.0-0
glib-2.0-0
gmodule-2.0-0
gobject-2.0-0
gthread-2.0-0
but I do not know if this is necessary to include when vcpkg has it installed?
I have installed glib using vcpkg (Package glib:x86-windows is already installed).
Thanks!
I'm not sure what combination of corrections did the trick, but the errors went away when my c_cpp_properties.json file looked like below.
c_cpp_properties.json
{
"configurations": [
{
"name": "Win32Debug",
"includePath": [
"${workspaceFolder}/include/debug/**",
"C:/sync/name/code/projects/frameworks/projectA/projectA/include/**",
"C:/sync/name/code/libraries/c c++/GTK/glib/lib/glib-2.0/include",
"C:/sync/name/code/libraries/c c++/GTK/glib/include/glib-2.0"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"windowsSdkVersion": "10.0.18362.0",
"cStandard": "c17",
"cppStandard": "c++20",
"intelliSenseMode": "windows-gcc-x86",
"browse": {
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": "${default}",
"path": [
"${workspaceFolder}/include/debug/**",
"C:/sync/name/code/projects/frameworks/projectA/projectA/include/debug/**",
"C:/sync/name/code/libraries/c c++/GTK/glib/lib/glib-2.0/include",
"C:/sync/name/code/libraries/c c++/GTK/glib/include/glib-2.0"
]
},
"compilerArgs": [],
"compilerPath": "C:/msys64/mingw64/bin/gcc.exe",
"forcedInclude": [
"${default}"
]
},
{
"name": "Win64Debug",
"includePath": [
"${workspaceFolder}/include/debug/**",
"D:/backup/sync/name/code/projects/frameworks/projectA/projectA/include/debug/**",
"D:/backup/sync/name/code/libraries/c c++/GTK/glib/lib/glib-2.0/include",
"D:/backup/sync/name/code/libraries/c c++/GTK/glib/include/glib-2.0"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"windowsSdkVersion": "10.0.18362.0",
"compilerPath": "C:/msys64/mingw64/bin/gcc.exe",
"cStandard": "c17",
"cppStandard": "c++17",
"intelliSenseMode": "linux-gcc-x64",
"compilerArgs": [],
"browse": {
"path": [
"${workspaceFolder}/include/debug/**",
"C:/sync/name/code/projects/frameworks/projectA/projectA/include/debug/**",
"C:/sync/name/code/libraries/c c++/GTK/glib/lib/glib-2.0/include",
"C:/sync/name/code/libraries/c c++/GTK/glib/include/glib-2.0"
],
"limitSymbolsToIncludedHeaders": true
}
}
],
"version": 4
}
Not sure if tasks.json had any influence (frankly Visual Code's inner workings are an opaque impenetrable blob to my attempts at understanding), but just in case:
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"type": "shell",
"label": "C/C++ g++.exe build",
"command": "C:\\msys64\\mingw64\\bin\\g++.exe",
"args": [
"/property:GenerateFullPaths=true",
"/t:build",
"/consoleloggerparameters:NoSummary",
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}",
"--include-directory=C:/sync/name/code/libraries/c c++/GTK/glib/lib/**"
],
"group": {
"kind": "build",
"isDefault": true
},
"presentation": {
"reveal": "silent"
},
"problemMatcher": [
"$gcc"
]
}
]
}

NativeScript - Migrating Project Structure

I want to migrate an Angular app to a {N} code-sharing structure. I used this article to get started. Would you help me solve the below issue? It seems like a mis-configuration.
When I execute:
ng add #nativescript/schematics
I get the following error:
success Saved 1 new dependency.
info Direct dependencies
└─ #nativescript/schematics#0.5.0
info All dependencies
└─ #nativescript/schematics#0.5.0
✨ Done in 3.25s.
Installed packages for tooling via yarn.
Two or more projects are using identical roots. Unable to determine project using current working directory. Using default workspace project instead.
Reading Project Settings
Project settings:
{
"root": "",
"sourceRoot": "src",
"mainName": "main",
"mainPath": "src/main.ts",
"tsConfig": "src/tsconfig.json",
"entryModuleClassName": "RootModule",
"entryModuleImportPath": "./root.module",
"entryModuleName": "Root",
"entryModulePath": "/src/root.module.ts",
"entryComponentClassName": "RootComponent",
"entryComponentImportPath": "./root.component",
"entryComponentName": "Root",
"entryComponentPath": "/src/root.component.ts",
"indexAppRootTag": "app-root"
}
Adding #nativescript/schematics to angular.json
Adding {N} files
Adding App_Resources
Adding NativeScript specific exclusions to .gitignore
Adding NativeScript run scripts to package.json
Adding NativeScript Project ID to package.json
Excluding NativeScript files from web tsconfig
Adding Sample Shared Component
Two or more projects are using identical roots. Unable to determine project using current working directory. Using default workspace project instead.
Two or more projects are using identical roots. Unable to determine project using current working directory. Using default workspace project instead.
Specified module does not exist
My #angular packages are 7.1.1
I use yarn as a package manager.
This is my angular.json:
{
"$schema": "./node_modules/#angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"my-ns-project": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"architect": {
"build": {
"builder": "#angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist",
"index": "src/index.html",
"main": "src/main.ts",
"tsConfig": "src/tsconfig.json",
"polyfills": "src/polyfills.ts",
"assets": [
// assets
],
"styles": [
// styles
],
"scripts": [
// scripts
]
},
"configurations": {
"hmr": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.hmr.ts"
}
]
},
"production": {
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
]
}
}
},
"serve": {
"builder": "#angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "my-ns-project:build"
},
"configurations": {
"hmr": {
"browserTarget": "my-ns-project:build:hmr"
},
"production": {
"browserTarget": "my-ns-project:build:production"
}
}
},
"extract-i18n": {
"builder": "#angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "my-ns-project:build"
}
},
"test": {
"builder": "#angular-devkit/build-angular:karma",
"options": {
"tsConfig": "src/tsconfig.json",
"main": "src/test.ts",
"karmaConfig": "./karma.conf.js",
"polyfills": "src/polyfills.ts",
"styles": [
// styles
],
"scripts": [
// scripts
],
"assets": [
// assets
]
}
},
"lint": {
"builder": "#angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"src/tsconfig.json"
],
"exclude": []
}
}
}
},
"my-ns-project-e2e": {
"root": "",
"sourceRoot": "",
"projectType": "application",
"architect": {
"e2e": {
"builder": "#angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "./protractor.conf.js",
"devServerTarget": "my-ns-project:serve"
}
},
"lint": {
"builder": "#angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"e2e/tsconfig.json"
],
"exclude": []
}
}
}
}
},
"defaultProject": "my-ns-project",
"cli": { "defaultCollection": "#nativescript/schematics" },
"schematics": {
"#schematics/angular:component": {
"prefix": "app",
"styleext": "css"
},
"#schematics/angular:directive": {
"prefix": "app"
}
}
}
Any help is highly appreciated!
Need to follow the following steps
Create a new angular app using - ng new my-app
Navigate to my-app folder
Execute command - ng add #nativescript/schematics
Finally execute tns run android --bundle - this will generate an auto generated page in emulator.
I see some differences in the project settings.

Chutzpah running both .ts and .js tests (the tests are effectively the same so the test count is doubled)

In Visual Studio, right-click on a .ts file and "Run JS Tests", only the tests in the .ts file run and are counted in the total.
"Run JS Tests" at the folder level or project level and both the tests in the .ts and .js files are run and counted in the total.
Chutzpah.json settings:
{
"Framework": "jasmine",
"TypeScriptCodeGenTarget": "ES5",
"TestHarnessLocationMode": "SettingsFileAdjacent",
"RootReferencePathMode": "SettingsFileDirectory",
"Compile": {
"Mode": "External",
"Extensions": [ ".ts" ],
"ExtensionsWithNoOutput": [ ".d.ts" ]
},
"Tests": [
{ "Path": "Specs"}
]
}
I had the same issue. All my tests are written in TypeScript, so my *.ts files define what tests exist. I had solved it by including only *.ts files.
{
"Tests": [ { "Path": "Specs", "Includes": [ "*.ts" ] } ],
"Compile": {
"Mode": "External",
"Extensions": [ ".ts" ],
"ExtensionsWithNoOutput": [ ".d.ts" ]
}
}
Works like a charm.
Without seeing your full project it is hard to know for sure but something along the following should help achieve this. If you need to include some .js files you can change the exclude patterns accordingly.
```
{
"Framework": "jasmine",
"TestHarnessLocationMode": "SettingsFileAdjacent",
"RootReferencePathMode": "SettingsFileDirectory",
"Compile": {
"Mode": "External",
"Extensions": [ ".ts" ],
"ExtensionsWithNoOutput": [ ".d.ts" ]
},
"References": [
{ "Excludes": ["*.js"]}
],
"Tests": [
{ "Path": "Specs", "Excludes": ["*.js"]}
]
}
```

Resources