@servicetitan/install 40.0.0 → 40.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/install.d.ts +1 -0
- package/dist/cli/install.d.ts.map +1 -1
- package/dist/cli/install.js +21 -0
- package/dist/cli/install.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/utils/audited-scripts.js +4 -4
- package/dist/utils/audited-scripts.js.map +1 -1
- package/dist/utils/npm.d.ts +1 -0
- package/dist/utils/npm.d.ts.map +1 -1
- package/dist/utils/npm.js +45 -5
- package/dist/utils/npm.js.map +1 -1
- package/package.json +2 -2
- package/src/cli/install.ts +29 -1
- package/src/index.ts +9 -1
- package/src/utils/audited-scripts.ts +4 -4
- package/src/utils/npm.ts +26 -0
package/dist/cli/install.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../src/cli/install.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../src/cli/install.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAkBvD,MAAM,WAAW,IAAI;IACjB,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,aAAa,CAAC,EAAE,KAAK,CAAC;IACtB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,qBAAa,OAAO;;IAChB,IAAI,EAAE,IAAI,CAAC;gBAGC,IAAI,EAAE,IAAI;IAItB,OAAO;IAQP,OAAO,CAAC,YAAY;IAkBpB,OAAO,CAAC,iBAAiB;IAwCzB,OAAO,CAAC,aAAa;IAmCrB,OAAO,CAAC,eAAe;IAUvB,OAAO,KAAK,cAAc,GAEzB;IAED,OAAO,CAAC,GAAG;CAKd"}
|
package/dist/cli/install.js
CHANGED
|
@@ -72,9 +72,30 @@ var _packageManager = /*#__PURE__*/ new WeakMap();
|
|
|
72
72
|
class Install {
|
|
73
73
|
execute() {
|
|
74
74
|
this.log(`install cli v${(0, _utils.getVersion)()}`);
|
|
75
|
+
this.configureNpx();
|
|
75
76
|
const env = this.configureNpmToken();
|
|
76
77
|
this.installPackages(env);
|
|
77
78
|
}
|
|
79
|
+
configureNpx() {
|
|
80
|
+
if ((0, _utils.isCI)() || this.args.fix) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
try {
|
|
84
|
+
if ((0, _utils.npmGetUserConfig)('yes') !== undefined) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
this.log('Configuring npx to require confirmation ...');
|
|
88
|
+
(0, _utils.runCommand)('npm', [
|
|
89
|
+
'config',
|
|
90
|
+
'set',
|
|
91
|
+
'yes=false',
|
|
92
|
+
'--location=user'
|
|
93
|
+
]);
|
|
94
|
+
} catch (e) {
|
|
95
|
+
console.warn(String(e));
|
|
96
|
+
console.warn('Failed to configure npx to require confirmation');
|
|
97
|
+
}
|
|
98
|
+
}
|
|
78
99
|
configureNpmToken() {
|
|
79
100
|
var _ref, _ref1;
|
|
80
101
|
var _AUTH_TOKEN_REGEX_exec, _ENVIRONMENT_VARIABLE_REGEX_exec;
|
package/dist/cli/install.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/cli/install.ts"],"sourcesContent":["/* eslint-disable no-console */\nimport fs from 'fs';\nimport os from 'os';\nimport path from 'path';\nimport type { AllowScripts } from '../package-manager';\nimport { getPackageManager, PackageManager } from '../package-manager';\nimport {
|
|
1
|
+
{"version":3,"sources":["../../src/cli/install.ts"],"sourcesContent":["/* eslint-disable no-console */\nimport fs from 'fs';\nimport os from 'os';\nimport path from 'path';\nimport type { AllowScripts } from '../package-manager';\nimport { getPackageManager, PackageManager } from '../package-manager';\nimport {\n debug,\n getVersion,\n gitCloneRepo,\n isCI,\n npmGetUserConfig,\n npmWhoAmI,\n readJson,\n runCommand,\n} from '../utils';\n\nconst REPO_NAME = 'frontend-dev-config';\nconst AUTH_TOKEN_KEY = '//registry.npmjs.org/:_authToken';\nconst AUTH_TOKEN_REGEX = /^\\/\\/registry\\.npmjs\\.org\\/:_authToken=\\s*(?<authToken>.+)/m;\nconst ENVIRONMENT_VARIABLE_REGEX = /\\${(?<environmentVariable>[^}]+)}/;\n\nexport interface Args {\n allowScripts?: AllowScripts;\n fix?: boolean;\n minReleaseAge?: false;\n quiet?: boolean;\n token?: boolean;\n}\n\nexport class Install {\n args: Args;\n #packageManager: PackageManager | undefined;\n\n constructor(args: Args) {\n this.args = args;\n }\n\n execute() {\n this.log(`install cli v${getVersion()}`);\n\n this.configureNpx();\n const env = this.configureNpmToken();\n this.installPackages(env);\n }\n\n private configureNpx() {\n if (isCI() || this.args.fix) {\n return;\n }\n\n try {\n if (npmGetUserConfig('yes') !== undefined) {\n return;\n }\n\n this.log('Configuring npx to require confirmation ...');\n runCommand('npm', ['config', 'set', 'yes=false', '--location=user']);\n } catch (e) {\n console.warn(String(e));\n console.warn('Failed to configure npx to require confirmation');\n }\n }\n\n private configureNpmToken() {\n if (isCI() || this.args.fix || this.args.token === false) {\n return;\n }\n\n this.log('Configuring NPM token ...');\n\n if (this.args.token !== true) {\n if (npmWhoAmI() === 'st-team') {\n return;\n }\n }\n\n const token = this.fetchNpmToken();\n if (!token) {\n return;\n }\n\n runCommand('npm', ['config', 'set', `${AUTH_TOKEN_KEY}=${token}`]);\n\n if (!fs.existsSync('.npmrc')) {\n return;\n }\n\n const npmrc = fs.readFileSync('.npmrc', 'utf-8');\n const { authToken } = AUTH_TOKEN_REGEX.exec(npmrc)?.groups ?? {};\n debug({ authToken });\n if (!authToken) {\n return;\n }\n\n const { environmentVariable } = ENVIRONMENT_VARIABLE_REGEX.exec(authToken)?.groups ?? {};\n debug({ environmentVariable });\n if (environmentVariable) {\n return { [environmentVariable]: token };\n }\n\n runCommand('npm', ['config', 'delete', '--location=project', AUTH_TOKEN_KEY]);\n }\n\n private fetchNpmToken() {\n const tempDirPath = fs.mkdtempSync(path.join(os.tmpdir(), 'st-install-'));\n try {\n if (!gitCloneRepo({ destination: tempDirPath, name: REPO_NAME })) {\n throw new Error(`could not clone servicetitan/${REPO_NAME}`);\n }\n\n const npmJson = readJson(path.join(tempDirPath, '.npm.json'));\n debug('install:fetch-npm-token', { npmJson });\n\n if (!((npmJson && typeof npmJson === 'object') || Array.isArray(npmJson))) {\n throw new Error('.npm.json is not an object');\n }\n\n const { readOnlyToken: authToken } = npmJson;\n if (!authToken) {\n throw new Error('.npm.json does not contain auth token');\n }\n\n if (typeof authToken !== 'string') {\n throw new Error('.npm.json auth token is not a string');\n }\n\n return Buffer.from(authToken, 'base64').toString('utf-8');\n } catch (e) {\n console.warn(String(e));\n } finally {\n try {\n fs.rmSync(tempDirPath, { recursive: true, force: true });\n } catch {\n // ignore\n }\n }\n }\n\n private installPackages(env?: Record<string, string>) {\n if (this.args.token) {\n return;\n }\n\n this.log(`Running ${this.packageManager.command} install`);\n\n this.packageManager.installPackages(this.args, { env, stdio: 'inherit' });\n }\n\n private get packageManager() {\n return (this.#packageManager ??= getPackageManager());\n }\n\n private log(message: string) {\n if (!this.args.quiet) {\n console.log(message);\n }\n }\n}\n"],"names":["Install","REPO_NAME","AUTH_TOKEN_KEY","AUTH_TOKEN_REGEX","ENVIRONMENT_VARIABLE_REGEX","execute","log","getVersion","configureNpx","env","configureNpmToken","installPackages","isCI","args","fix","npmGetUserConfig","undefined","runCommand","e","console","warn","String","token","npmWhoAmI","fetchNpmToken","fs","existsSync","npmrc","readFileSync","authToken","exec","groups","debug","environmentVariable","tempDirPath","mkdtempSync","path","join","os","tmpdir","gitCloneRepo","destination","name","Error","npmJson","readJson","Array","isArray","readOnlyToken","Buffer","from","toString","rmSync","recursive","force","packageManager","command","stdio","getPackageManager","message","quiet"],"mappings":"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"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { PackageManager, getPackageManager } from './package-manager';
|
|
2
2
|
export type { DeclaredVersionQuery, ResolvedVersionQuery } from './package-manager';
|
|
3
|
-
export { gitCloneRepo, gitIsReachable, isCI, npmWhoAmI, versionCompare } from './utils';
|
|
3
|
+
export { AUDITED_SCRIPTS, gitCloneRepo, gitIsReachable, isCI, npmWhoAmI, versionCompare, } from './utils';
|
|
4
|
+
export type { AuditedScript } from './utils';
|
|
4
5
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtE,YAAY,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACpF,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtE,YAAY,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACpF,OAAO,EACH,eAAe,EACf,YAAY,EACZ,cAAc,EACd,IAAI,EACJ,SAAS,EACT,cAAc,GACjB,MAAM,SAAS,CAAC;AACjB,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC"}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export { PackageManager, getPackageManager } from './package-manager';\nexport type { DeclaredVersionQuery, ResolvedVersionQuery } from './package-manager';\nexport {
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export { PackageManager, getPackageManager } from './package-manager';\nexport type { DeclaredVersionQuery, ResolvedVersionQuery } from './package-manager';\nexport {\n AUDITED_SCRIPTS,\n gitCloneRepo,\n gitIsReachable,\n isCI,\n npmWhoAmI,\n versionCompare,\n} from './utils';\nexport type { AuditedScript } from './utils';\n"],"names":["AUDITED_SCRIPTS","PackageManager","getPackageManager","gitCloneRepo","gitIsReachable","isCI","npmWhoAmI","versionCompare"],"mappings":";;;;;;;;;;;QAGIA;eAAAA,sBAAe;;QAHVC;eAAAA,8BAAc;;QAAEC;eAAAA,iCAAiB;;QAItCC;eAAAA,mBAAY;;QACZC;eAAAA,qBAAc;;QACdC;eAAAA,WAAI;;QACJC;eAAAA,gBAAS;;QACTC;eAAAA,qBAAc;;;gCARgC;uBAS3C"}
|
|
@@ -17,17 +17,17 @@ const AUDITED_SCRIPTS = [
|
|
|
17
17
|
},
|
|
18
18
|
{
|
|
19
19
|
name: 'cypress',
|
|
20
|
-
maximumVersion: '16.
|
|
20
|
+
maximumVersion: '16.2.0',
|
|
21
21
|
note: "Downloads Cypress's platform-specific test runner binary"
|
|
22
22
|
},
|
|
23
23
|
{
|
|
24
24
|
name: 'msw',
|
|
25
|
-
maximumVersion: '
|
|
26
|
-
note:
|
|
25
|
+
maximumVersion: '3.0.3',
|
|
26
|
+
note: 'No install script at all since 3.0.0; worker regeneration moved to the manual `msw init` CLI command instead of running automatically on install. Ceiling bumped anyway to prevent audit workflow from flagging old version'
|
|
27
27
|
},
|
|
28
28
|
{
|
|
29
29
|
name: 'nx',
|
|
30
|
-
maximumVersion: '23.
|
|
30
|
+
maximumVersion: '23.3.0',
|
|
31
31
|
note: 'Verifies native platform support and updates the Nx Cloud client if the workspace uses Nx Cloud'
|
|
32
32
|
},
|
|
33
33
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/audited-scripts.ts"],"sourcesContent":["export interface AuditedScript {\n name: string;\n action: 'allow' | 'ignore';\n maximumVersion?: string;\n note?: string;\n}\n\nexport const AUDITED_SCRIPTS: AuditedScript[] = [\n // Trusted to run their install scripts, up to the audited version.\n ...[\n {\n name: '@servicetitan/startup',\n note: 'Applies patch-package patches to installed dependencies',\n },\n {\n name: 'cypress',\n maximumVersion: '16.
|
|
1
|
+
{"version":3,"sources":["../../src/utils/audited-scripts.ts"],"sourcesContent":["export interface AuditedScript {\n name: string;\n action: 'allow' | 'ignore';\n maximumVersion?: string;\n note?: string;\n}\n\nexport const AUDITED_SCRIPTS: AuditedScript[] = [\n // Trusted to run their install scripts, up to the audited version.\n ...[\n {\n name: '@servicetitan/startup',\n note: 'Applies patch-package patches to installed dependencies',\n },\n {\n name: 'cypress',\n maximumVersion: '16.2.0',\n note: \"Downloads Cypress's platform-specific test runner binary\",\n },\n {\n name: 'msw',\n maximumVersion: '3.0.3',\n note: 'No install script at all since 3.0.0; worker regeneration moved to the manual `msw init` CLI command instead of running automatically on install. Ceiling bumped anyway to prevent audit workflow from flagging old version',\n },\n {\n name: 'nx',\n maximumVersion: '23.3.0',\n note: 'Verifies native platform support and updates the Nx Cloud client if the workspace uses Nx Cloud',\n },\n {\n name: 'tree-sitter',\n maximumVersion: '0.25.1',\n note: 'Installs a prebuilt native binary via node-gyp-build, compiling from source as a fallback',\n },\n ].map((entry: Omit<AuditedScript, 'action'>) => ({ ...entry, action: 'allow' as const })),\n\n // Have install scripts, but don't need them to function correctly.\n ...[\n {\n name: '@parcel/watcher',\n note: 'Installs platform-specific binary via optionalDependencies, install script is a legacy fallback',\n },\n {\n name: '@progress/kendo-licensing',\n note: 'Validates Kendo UI license key, not needed for functionality',\n },\n {\n name: '@scarf/scarf',\n note: 'Sends anonymous analytics/telemetry to Scarf, usage-tracking mechanism with no functional purpose',\n },\n {\n name: '@swc/core',\n note: 'Installs platform-specific binary via optionalDependencies, postinstall is a legacy fallback',\n },\n {\n name: '@tree-sitter-grammars/tree-sitter-yaml',\n note: 'Ships prebuilds for all supported targets via node-gyp-build, install script is a source-compile fallback',\n },\n {\n name: '@vaadin/vaadin-usage-statistics',\n note: \"Toggles Vaadin's development-time telemetry, no effect on functionality\",\n },\n {\n name: 'contentful',\n note: 'In 9.3.x, printed a message announcing that v10 was available, no functional purpose; no install script at all since 9.4.0',\n },\n {\n name: 'core-js-pure',\n note: 'Prints a donation/sponsorship banner to the console, no functional purpose',\n },\n {\n name: 'core-js',\n note: 'Prints a donation/sponsorship banner to the console, no functional purpose',\n },\n {\n name: 'es5-ext',\n note: 'Displays politically motivated message targeted at Russian developers, no effect on functionality',\n },\n {\n name: 'esbuild',\n note: 'Installs platform-specific binary via optionalDependencies, postinstall is a legacy fallback',\n },\n {\n name: 'tree-sitter-json',\n note: 'Ships prebuilds for all supported targets via node-gyp-build, install script is a source-compile fallback',\n },\n {\n name: 'unrs-resolver',\n note: 'Installs platform-specific binary via optionalDependencies, postinstall is a legacy fallback',\n },\n ].map((entry: Omit<AuditedScript, 'action'>) => ({ ...entry, action: 'ignore' as const })),\n];\n"],"names":["AUDITED_SCRIPTS","name","note","maximumVersion","map","entry","action"],"mappings":";;;;+BAOaA;;;eAAAA;;;AAAN,MAAMA,kBAAmC;IAC5C,mEAAmE;OAChE;QACC;YACIC,MAAM;YACNC,MAAM;QACV;QACA;YACID,MAAM;YACNE,gBAAgB;YAChBD,MAAM;QACV;QACA;YACID,MAAM;YACNE,gBAAgB;YAChBD,MAAM;QACV;QACA;YACID,MAAM;YACNE,gBAAgB;YAChBD,MAAM;QACV;QACA;YACID,MAAM;YACNE,gBAAgB;YAChBD,MAAM;QACV;KACH,CAACE,GAAG,CAAC,CAACC,QAA0C,CAAA;YAAE,GAAGA,KAAK;YAAEC,QAAQ;QAAiB,CAAA;IAEtF,mEAAmE;OAChE;QACC;YACIL,MAAM;YACNC,MAAM;QACV;QACA;YACID,MAAM;YACNC,MAAM;QACV;QACA;YACID,MAAM;YACNC,MAAM;QACV;QACA;YACID,MAAM;YACNC,MAAM;QACV;QACA;YACID,MAAM;YACNC,MAAM;QACV;QACA;YACID,MAAM;YACNC,MAAM;QACV;QACA;YACID,MAAM;YACNC,MAAM;QACV;QACA;YACID,MAAM;YACNC,MAAM;QACV;QACA;YACID,MAAM;YACNC,MAAM;QACV;QACA;YACID,MAAM;YACNC,MAAM;QACV;QACA;YACID,MAAM;YACNC,MAAM;QACV;QACA;YACID,MAAM;YACNC,MAAM;QACV;QACA;YACID,MAAM;YACNC,MAAM;QACV;KACH,CAACE,GAAG,CAAC,CAACC,QAA0C,CAAA;YAAE,GAAGA,KAAK;YAAEC,QAAQ;QAAkB,CAAA;CAC1F"}
|
package/dist/utils/npm.d.ts
CHANGED
package/dist/utils/npm.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"npm.d.ts","sourceRoot":"","sources":["../../src/utils/npm.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"npm.d.ts","sourceRoot":"","sources":["../../src/utils/npm.ts"],"names":[],"mappings":"AAIA,wBAAgB,SAAS,CAAC,EAAE,QAAQ,EAAE,GAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAO,sBAcjE;AAOD,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,sBAW3C"}
|
package/dist/utils/npm.js
CHANGED
|
@@ -2,17 +2,31 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
get npmGetUserConfig () {
|
|
13
|
+
return npmGetUserConfig;
|
|
14
|
+
},
|
|
15
|
+
get npmWhoAmI () {
|
|
8
16
|
return npmWhoAmI;
|
|
9
17
|
}
|
|
10
18
|
});
|
|
19
|
+
const _os = /*#__PURE__*/ _interop_require_default(require("os"));
|
|
11
20
|
const _debug = require("./debug");
|
|
12
|
-
const
|
|
21
|
+
const _os1 = require("./os");
|
|
22
|
+
function _interop_require_default(obj) {
|
|
23
|
+
return obj && obj.__esModule ? obj : {
|
|
24
|
+
default: obj
|
|
25
|
+
};
|
|
26
|
+
}
|
|
13
27
|
function npmWhoAmI({ registry } = {}) {
|
|
14
28
|
try {
|
|
15
|
-
const result = (0,
|
|
29
|
+
const result = (0, _os1.runCommand)('npm', [
|
|
16
30
|
'whoami',
|
|
17
31
|
...registry ? [
|
|
18
32
|
`--registry=${registry}`
|
|
@@ -33,5 +47,31 @@ function npmWhoAmI({ registry } = {}) {
|
|
|
33
47
|
// ignore
|
|
34
48
|
}
|
|
35
49
|
}
|
|
50
|
+
function npmGetUserConfig(key) {
|
|
51
|
+
const result = (0, _os1.runCommand)('npm', [
|
|
52
|
+
'config',
|
|
53
|
+
'get',
|
|
54
|
+
key,
|
|
55
|
+
`--prefix=${getHomePrefix()}`
|
|
56
|
+
], {
|
|
57
|
+
/*
|
|
58
|
+
* Environment variables override configuration files, for example
|
|
59
|
+
* when install itself runs via `npx --yes`.
|
|
60
|
+
*/ env: {
|
|
61
|
+
[`npm_config_${key.replace(/-/g, '_')}`]: undefined
|
|
62
|
+
},
|
|
63
|
+
stdio: [
|
|
64
|
+
'pipe',
|
|
65
|
+
'pipe',
|
|
66
|
+
'ignore'
|
|
67
|
+
]
|
|
68
|
+
}).trim();
|
|
69
|
+
return result === 'null' ? undefined : result;
|
|
70
|
+
}
|
|
71
|
+
function getHomePrefix() {
|
|
72
|
+
const home = _os.default.homedir();
|
|
73
|
+
// On Windows, npm runs through a shell that splits unquoted arguments at spaces.
|
|
74
|
+
return process.platform === 'win32' ? `"${home}"` : home;
|
|
75
|
+
}
|
|
36
76
|
|
|
37
77
|
//# sourceMappingURL=npm.js.map
|
package/dist/utils/npm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/npm.ts"],"sourcesContent":["import { debug } from './debug';\nimport { runCommand } from './os';\n\nexport function npmWhoAmI({ registry }: { registry?: string } = {}) {\n try {\n const result = runCommand(\n 'npm',\n ['whoami', ...(registry ? [`--registry=${registry}`] : [])],\n { stdio: ['pipe', 'pipe', 'ignore'], timeout: 10000 }\n ).trim();\n\n debug('install:whoami', { result });\n\n return result.trim();\n } catch {\n // ignore\n }\n}\n"],"names":["npmWhoAmI","registry","result","runCommand","stdio","timeout","trim","debug"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/utils/npm.ts"],"sourcesContent":["import os from 'os';\nimport { debug } from './debug';\nimport { runCommand } from './os';\n\nexport function npmWhoAmI({ registry }: { registry?: string } = {}) {\n try {\n const result = runCommand(\n 'npm',\n ['whoami', ...(registry ? [`--registry=${registry}`] : [])],\n { stdio: ['pipe', 'pipe', 'ignore'], timeout: 10000 }\n ).trim();\n\n debug('install:whoami', { result });\n\n return result.trim();\n } catch {\n // ignore\n }\n}\n\n/*\n * Reads a setting as seen from the home directory, so project-level .npmrc files\n * in the current directory do not affect the result. Returns undefined when the\n * setting is unset.\n */\nexport function npmGetUserConfig(key: string) {\n const result = runCommand('npm', ['config', 'get', key, `--prefix=${getHomePrefix()}`], {\n /*\n * Environment variables override configuration files, for example\n * when install itself runs via `npx --yes`.\n */\n env: { [`npm_config_${key.replace(/-/g, '_')}`]: undefined },\n stdio: ['pipe', 'pipe', 'ignore'],\n }).trim();\n\n return result === 'null' ? undefined : result;\n}\n\nfunction getHomePrefix() {\n const home = os.homedir();\n\n // On Windows, npm runs through a shell that splits unquoted arguments at spaces.\n return process.platform === 'win32' ? `\"${home}\"` : home;\n}\n"],"names":["npmGetUserConfig","npmWhoAmI","registry","result","runCommand","stdio","timeout","trim","debug","key","getHomePrefix","env","replace","undefined","home","os","homedir","process","platform"],"mappings":";;;;;;;;;;;QAyBgBA;eAAAA;;QArBAC;eAAAA;;;2DAJD;uBACO;qBACK;;;;;;AAEpB,SAASA,UAAU,EAAEC,QAAQ,EAAyB,GAAG,CAAC,CAAC;IAC9D,IAAI;QACA,MAAMC,SAASC,IAAAA,eAAU,EACrB,OACA;YAAC;eAAcF,WAAW;gBAAC,CAAC,WAAW,EAAEA,UAAU;aAAC,GAAG,EAAE;SAAE,EAC3D;YAAEG,OAAO;gBAAC;gBAAQ;gBAAQ;aAAS;YAAEC,SAAS;QAAM,GACtDC,IAAI;QAENC,IAAAA,YAAK,EAAC,kBAAkB;YAAEL;QAAO;QAEjC,OAAOA,OAAOI,IAAI;IACtB,EAAE,eAAM;IACJ,SAAS;IACb;AACJ;AAOO,SAASP,iBAAiBS,GAAW;IACxC,MAAMN,SAASC,IAAAA,eAAU,EAAC,OAAO;QAAC;QAAU;QAAOK;QAAK,CAAC,SAAS,EAAEC,iBAAiB;KAAC,EAAE;QACpF;;;SAGC,GACDC,KAAK;YAAE,CAAC,CAAC,WAAW,EAAEF,IAAIG,OAAO,CAAC,MAAM,MAAM,CAAC,EAAEC;QAAU;QAC3DR,OAAO;YAAC;YAAQ;YAAQ;SAAS;IACrC,GAAGE,IAAI;IAEP,OAAOJ,WAAW,SAASU,YAAYV;AAC3C;AAEA,SAASO;IACL,MAAMI,OAAOC,WAAE,CAACC,OAAO;IAEvB,iFAAiF;IACjF,OAAOC,QAAQC,QAAQ,KAAK,UAAU,CAAC,CAAC,EAAEJ,KAAK,CAAC,CAAC,GAAGA;AACxD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@servicetitan/install",
|
|
3
|
-
"version": "40.
|
|
3
|
+
"version": "40.2.0",
|
|
4
4
|
"description": "Lightweight wrapper around npm install that configures access to private packages",
|
|
5
5
|
"homepage": "https://docs.st.dev/docs/frontend/uikit/install",
|
|
6
6
|
"repository": {
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"webpack": false
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
|
-
"js-yaml": "~5.4.
|
|
33
|
+
"js-yaml": "~5.4.3"
|
|
34
34
|
},
|
|
35
35
|
"peerDependenciesMeta": {
|
|
36
36
|
"js-yaml": {
|
package/src/cli/install.ts
CHANGED
|
@@ -4,7 +4,16 @@ import os from 'os';
|
|
|
4
4
|
import path from 'path';
|
|
5
5
|
import type { AllowScripts } from '../package-manager';
|
|
6
6
|
import { getPackageManager, PackageManager } from '../package-manager';
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
debug,
|
|
9
|
+
getVersion,
|
|
10
|
+
gitCloneRepo,
|
|
11
|
+
isCI,
|
|
12
|
+
npmGetUserConfig,
|
|
13
|
+
npmWhoAmI,
|
|
14
|
+
readJson,
|
|
15
|
+
runCommand,
|
|
16
|
+
} from '../utils';
|
|
8
17
|
|
|
9
18
|
const REPO_NAME = 'frontend-dev-config';
|
|
10
19
|
const AUTH_TOKEN_KEY = '//registry.npmjs.org/:_authToken';
|
|
@@ -30,10 +39,29 @@ export class Install {
|
|
|
30
39
|
execute() {
|
|
31
40
|
this.log(`install cli v${getVersion()}`);
|
|
32
41
|
|
|
42
|
+
this.configureNpx();
|
|
33
43
|
const env = this.configureNpmToken();
|
|
34
44
|
this.installPackages(env);
|
|
35
45
|
}
|
|
36
46
|
|
|
47
|
+
private configureNpx() {
|
|
48
|
+
if (isCI() || this.args.fix) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
try {
|
|
53
|
+
if (npmGetUserConfig('yes') !== undefined) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
this.log('Configuring npx to require confirmation ...');
|
|
58
|
+
runCommand('npm', ['config', 'set', 'yes=false', '--location=user']);
|
|
59
|
+
} catch (e) {
|
|
60
|
+
console.warn(String(e));
|
|
61
|
+
console.warn('Failed to configure npx to require confirmation');
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
37
65
|
private configureNpmToken() {
|
|
38
66
|
if (isCI() || this.args.fix || this.args.token === false) {
|
|
39
67
|
return;
|
package/src/index.ts
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
1
|
export { PackageManager, getPackageManager } from './package-manager';
|
|
2
2
|
export type { DeclaredVersionQuery, ResolvedVersionQuery } from './package-manager';
|
|
3
|
-
export {
|
|
3
|
+
export {
|
|
4
|
+
AUDITED_SCRIPTS,
|
|
5
|
+
gitCloneRepo,
|
|
6
|
+
gitIsReachable,
|
|
7
|
+
isCI,
|
|
8
|
+
npmWhoAmI,
|
|
9
|
+
versionCompare,
|
|
10
|
+
} from './utils';
|
|
11
|
+
export type { AuditedScript } from './utils';
|
|
@@ -14,17 +14,17 @@ export const AUDITED_SCRIPTS: AuditedScript[] = [
|
|
|
14
14
|
},
|
|
15
15
|
{
|
|
16
16
|
name: 'cypress',
|
|
17
|
-
maximumVersion: '16.
|
|
17
|
+
maximumVersion: '16.2.0',
|
|
18
18
|
note: "Downloads Cypress's platform-specific test runner binary",
|
|
19
19
|
},
|
|
20
20
|
{
|
|
21
21
|
name: 'msw',
|
|
22
|
-
maximumVersion: '
|
|
23
|
-
note:
|
|
22
|
+
maximumVersion: '3.0.3',
|
|
23
|
+
note: 'No install script at all since 3.0.0; worker regeneration moved to the manual `msw init` CLI command instead of running automatically on install. Ceiling bumped anyway to prevent audit workflow from flagging old version',
|
|
24
24
|
},
|
|
25
25
|
{
|
|
26
26
|
name: 'nx',
|
|
27
|
-
maximumVersion: '23.
|
|
27
|
+
maximumVersion: '23.3.0',
|
|
28
28
|
note: 'Verifies native platform support and updates the Nx Cloud client if the workspace uses Nx Cloud',
|
|
29
29
|
},
|
|
30
30
|
{
|
package/src/utils/npm.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import os from 'os';
|
|
1
2
|
import { debug } from './debug';
|
|
2
3
|
import { runCommand } from './os';
|
|
3
4
|
|
|
@@ -16,3 +17,28 @@ export function npmWhoAmI({ registry }: { registry?: string } = {}) {
|
|
|
16
17
|
// ignore
|
|
17
18
|
}
|
|
18
19
|
}
|
|
20
|
+
|
|
21
|
+
/*
|
|
22
|
+
* Reads a setting as seen from the home directory, so project-level .npmrc files
|
|
23
|
+
* in the current directory do not affect the result. Returns undefined when the
|
|
24
|
+
* setting is unset.
|
|
25
|
+
*/
|
|
26
|
+
export function npmGetUserConfig(key: string) {
|
|
27
|
+
const result = runCommand('npm', ['config', 'get', key, `--prefix=${getHomePrefix()}`], {
|
|
28
|
+
/*
|
|
29
|
+
* Environment variables override configuration files, for example
|
|
30
|
+
* when install itself runs via `npx --yes`.
|
|
31
|
+
*/
|
|
32
|
+
env: { [`npm_config_${key.replace(/-/g, '_')}`]: undefined },
|
|
33
|
+
stdio: ['pipe', 'pipe', 'ignore'],
|
|
34
|
+
}).trim();
|
|
35
|
+
|
|
36
|
+
return result === 'null' ? undefined : result;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function getHomePrefix() {
|
|
40
|
+
const home = os.homedir();
|
|
41
|
+
|
|
42
|
+
// On Windows, npm runs through a shell that splits unquoted arguments at spaces.
|
|
43
|
+
return process.platform === 'win32' ? `"${home}"` : home;
|
|
44
|
+
}
|