smartclient-eval
Advanced tools
Comparing version 0.9.20 to 0.9.21
@@ -259,4 +259,8 @@ /* | ||
*/ | ||
static get DEFAULT_SKIN() { | ||
return "Tahoe"; | ||
static get DEFAULT_SKINS() { | ||
return { | ||
"Shiva": 13.1, | ||
"Tahoe": 11.1, | ||
"Enterprise": 10.1 | ||
}; | ||
} | ||
@@ -263,0 +267,0 @@ |
19
Lib.js
@@ -35,2 +35,3 @@ #!/usr/bin/env node | ||
const fs = require("fs-extra"); | ||
const Const = require("./Const"); | ||
const readline = require("readline"); | ||
@@ -120,2 +121,20 @@ const { spawnSync } = require("child_process"); | ||
/** | ||
* Return the name of the default skin for the specified branch. | ||
* | ||
* @param (number) branch - specifies branch | ||
* @return (string) name of the default skin | ||
*/ | ||
static getDefaultSkin(branch) { | ||
const map = Const.DEFAULT_SKINS; | ||
let skinName; | ||
for (let skinIter in map) { | ||
if (branch >= map[skinIter] && (!skinName || map[skinName] < map[skinIter])) { | ||
skinName = skinIter; | ||
} | ||
} | ||
return skinName; | ||
} | ||
/** | ||
* (Internal) Returns whether interactive prompting is allowed. It is not allowed in newer | ||
@@ -122,0 +141,0 @@ * versions of npm when commands are run via lifecycle hooks - install, uninstall, update. |
@@ -37,3 +37,3 @@ { | ||
}, | ||
"version": "0.9.20" | ||
"version": "0.9.21" | ||
} |
@@ -44,4 +44,6 @@ Provides access to | ||
--skins=Tahoe|all|none which skins (if any) to install; | ||
default is to only install Tahoe | ||
--skins=<skinName>|all|none | ||
which skins (if any) to install; only the default | ||
skin for the branch can be specified as <skinName>, | ||
which is also the default if option isn't passed | ||
@@ -48,0 +50,0 @@ --prompt[=<boolean>] wait for input instead of assuming the default |
@@ -146,4 +146,4 @@ #!/usr/bin/env node | ||
// skins | ||
let skins = env.npm_config_skins || config.skins || Const.DEFAULT_SKIN; | ||
if (skins != Const.DEFAULT_SKIN && skins != "all" && skins != "none") { | ||
let skins = env.npm_config_skins || config.skins || CommonLib.getDefaultSkin(branch); | ||
if (!(Const.DEFAULT_SKINS[skins] <= branch) && skins != "all" && skins != "none") { | ||
console.log("*** Invalid skins: " + skins + "!\n"); | ||
@@ -358,4 +358,3 @@ this.usage(); process.exitCode = 6; | ||
if (skins != "all" && dest.match(/skins\/[a-z]+$/i) && | ||
(skins == "none" || | ||
!dest.endsWith("skins/" + Const.DEFAULT_SKIN))) | ||
(skins == "none" || !dest.endsWith("skins/" + skins))) | ||
{ | ||
@@ -384,7 +383,7 @@ return false; | ||
if (skins == Const.DEFAULT_SKIN) { | ||
console.log("Installed " + Const.DEFAULT_SKIN + " skin."); | ||
} else { | ||
if (skins == "none" || skins == "all") { | ||
let whichSkins = skins == "none" ? "no" : skins; | ||
console.log("Installed " + whichSkins + " skins."); | ||
} else { | ||
console.log("Installed " + skins + " skin."); | ||
} | ||
@@ -1186,10 +1185,9 @@ | ||
let package_name = process.env.npm_package_name, | ||
default_branch = Const.DEFAULT_BRANCH, | ||
default_skin = Const.DEFAULT_SKIN | ||
default_branch = Const.DEFAULT_BRANCH | ||
; | ||
let usage = | ||
"Install package and SmartClient runtime(s):\n\n" + | ||
"Install module and SmartClient runtime(s):\n\n" + | ||
" npm install " + package_name + " [flags]\n\n" + | ||
"Update/reconfigure SmartClient runtime(s) (must be run from package directory):\n\n" + | ||
" npm run update [flags]\n\n" + | ||
"Update/reconfigure SmartClient runtime(s) (must be run from module directory):\n\n" + | ||
" npm run reconfig [flags]\n\n" + | ||
"where the supported flags are:\n\n" + | ||
@@ -1206,7 +1204,10 @@ " --location=<directory> where to install the SmartClient runtime(s);\n" + | ||
" default is to not install it to save disk space\n\n" + | ||
" --skins=" + default_skin + "|all|none which skins (if any) to install;\n" + | ||
" default is to only install " + default_skin + "\n\n" + | ||
" --skins=<skinName>|all|none\n" + | ||
" which skins (if any) to install; only the default\n" + | ||
" skin for the branch can be specified as <skinName>,\n" + | ||
" which is also the default if option isn't passwd\n\n" + | ||
" --prompt[=<boolean>] wait for input instead of assuming the default\n" + | ||
" response to all queries during install; default\n" + | ||
" is to not prompt to support newer npm releases\n\n" + | ||
" is to not prompt during install or update in\n" + | ||
" npm versions 7 and above as it's not supported\n\n" + | ||
@@ -1221,20 +1222,24 @@ (Const.REQUIRES_ACCOUNT ? ( | ||
"After installation, command-line configuration is persisted, so command-line arguments only\n" + | ||
"need to be supplied when updating if the desired configuration has changed. " + | ||
(Const.REQUIRES_ACCOUNT ? ("If a username\n" + | ||
"and password aren't supplied via the above options, you will be prompted to enter them by\n" + | ||
"the update script. A password typed in response to the script won't be persisted to your\n" + | ||
"configuration, so you may choose to always enter it interactively for security.") : "") + | ||
"\n\n" + | ||
"After installation, command-line configuration is persisted, so command-line\n" + | ||
"arguments only need to be supplied when updating if the desired configuration\n" + | ||
"has changed. " + | ||
"Note that since 'npm update' no longer runs a package's update script, you must use the\n" + | ||
"syntax above to update the runtime(s) if the package has already been installed.\n\n" + | ||
"Examples:\n\n" + | ||
(Const.REQUIRES_ACCOUNT ? ( | ||
"If a username and password aren't supplied via the above options,\n" + | ||
"you will be prompted to enter them by the update script. A password typed in\n" + | ||
"response to the script won't be persisted to your configuration, so you may\n" + | ||
"choose to always enter it interactively for security.") : "") + "\n\n" + | ||
"Note that since 'npm update' no longer runs a module's update script if the\n" + | ||
"version hasn't changed, you must use the command above, run from the module\n" + | ||
"directory, to update the runtime(s) if the module has already been installed.\n" + | ||
"(The smartclient-eval module is versioned separately from nightly SDK builds.)\n\n" + | ||
"Command-line Examples:\n\n" + | ||
"New install, selecting a specific branch and date:\n\n" + | ||
" npm install " + package_name + " --branch=11.1 --date=2018-12-30\n\n" + | ||
"Update to latest nighlty build (run from package directory):\n\n" + | ||
" npm run update --date=latest\n\n" + | ||
"Update to SmartClient 12.0 branch, installing all skins:\n\n" + | ||
" npm run update --branch=12.0 --skins=all\n"; | ||
"Update to latest nighlty build (run from module directory):\n\n" + | ||
" npm run reconfig --date=latest\n\n" + | ||
"Update to SmartClient 13.0 branch, installing all skins:\n\n" + | ||
" npm run reconfig --branch=13.0 --skins=all\n"; | ||
@@ -1241,0 +1246,0 @@ console.log(usage); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
82015
1642
164