blun-king-cli 9.1.4 → 9.1.6
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/bin/launcher-runtime.js +10 -2
- package/bin/update-notice.js +37 -15
- package/package.json +1 -1
package/bin/launcher-runtime.js
CHANGED
|
@@ -81,13 +81,21 @@ function readPackageVersion() {
|
|
|
81
81
|
return version;
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
+
function shouldDetachProtectedCore(options = {}) {
|
|
85
|
+
const platform = options.platform || process.platform;
|
|
86
|
+
const stdinIsTTY = Object.hasOwn(options, 'stdinIsTTY')
|
|
87
|
+
? options.stdinIsTTY
|
|
88
|
+
: process.stdin.isTTY;
|
|
89
|
+
return platform !== 'win32' || stdinIsTTY !== true;
|
|
90
|
+
}
|
|
91
|
+
|
|
84
92
|
function spawnProtectedCore(args, env, cwd) {
|
|
85
93
|
const child = spawn(
|
|
86
94
|
process.execPath,
|
|
87
95
|
[path.join(PKG, 'bin', 'core-bootstrap.js'), ...args],
|
|
88
96
|
{
|
|
89
97
|
cwd,
|
|
90
|
-
detached:
|
|
98
|
+
detached: shouldDetachProtectedCore(),
|
|
91
99
|
env,
|
|
92
100
|
stdio: ['inherit', 'inherit', 'inherit', 'ipc'],
|
|
93
101
|
windowsHide: true,
|
|
@@ -290,4 +298,4 @@ async function runLauncher(options = {}) {
|
|
|
290
298
|
}
|
|
291
299
|
}
|
|
292
300
|
|
|
293
|
-
module.exports = { resolveLauncherPrivatePaths, runLauncher };
|
|
301
|
+
module.exports = { resolveLauncherPrivatePaths, runLauncher, shouldDetachProtectedCore };
|
package/bin/update-notice.js
CHANGED
|
@@ -620,10 +620,19 @@ function createInstallInvocation(version, options = {}) {
|
|
|
620
620
|
if (platform !== 'win32' && path.basename(installPrefix) === 'lib') {
|
|
621
621
|
installPrefix = path.dirname(installPrefix);
|
|
622
622
|
}
|
|
623
|
-
let
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
if (!
|
|
623
|
+
let npmUserConfigPath;
|
|
624
|
+
let npmGlobalConfigPath;
|
|
625
|
+
if (options.npmUserConfigPath || options.npmGlobalConfigPath) {
|
|
626
|
+
if (!options.npmUserConfigPath || !options.npmGlobalConfigPath) {
|
|
627
|
+
throw new Error('INVALID_NPM_CONFIG_PATHS');
|
|
628
|
+
}
|
|
629
|
+
npmUserConfigPath = fs.realpathSync(path.resolve(options.npmUserConfigPath));
|
|
630
|
+
npmGlobalConfigPath = fs.realpathSync(path.resolve(options.npmGlobalConfigPath));
|
|
631
|
+
if (!fs.statSync(npmUserConfigPath).isFile()
|
|
632
|
+
|| !fs.statSync(npmGlobalConfigPath).isFile()
|
|
633
|
+
|| npmUserConfigPath === npmGlobalConfigPath) {
|
|
634
|
+
throw new Error('INVALID_NPM_CONFIG_PATHS');
|
|
635
|
+
}
|
|
627
636
|
}
|
|
628
637
|
return {
|
|
629
638
|
command: execPath,
|
|
@@ -638,16 +647,21 @@ function createInstallInvocation(version, options = {}) {
|
|
|
638
647
|
'--ignore-scripts=false',
|
|
639
648
|
'--package-lock-only=false',
|
|
640
649
|
`--prefix=${installPrefix}`,
|
|
641
|
-
...(
|
|
642
|
-
`--userconfig=${
|
|
643
|
-
`--globalconfig=${
|
|
650
|
+
...(npmUserConfigPath ? [
|
|
651
|
+
`--userconfig=${npmUserConfigPath}`,
|
|
652
|
+
`--globalconfig=${npmGlobalConfigPath}`,
|
|
644
653
|
] : []),
|
|
645
654
|
],
|
|
646
655
|
windowsVerbatimArguments: false,
|
|
647
656
|
};
|
|
648
657
|
}
|
|
649
658
|
|
|
650
|
-
function createInstallEnvironment(
|
|
659
|
+
function createInstallEnvironment(
|
|
660
|
+
sourceEnv,
|
|
661
|
+
installDirectory,
|
|
662
|
+
npmUserConfigPath,
|
|
663
|
+
npmGlobalConfigPath,
|
|
664
|
+
) {
|
|
651
665
|
const allowedKeys = new Set([
|
|
652
666
|
'appdata',
|
|
653
667
|
'comspec',
|
|
@@ -685,8 +699,8 @@ function createInstallEnvironment(sourceEnv, installDirectory, npmConfigPath) {
|
|
|
685
699
|
result.npm_config_dry_run = 'false';
|
|
686
700
|
result.npm_config_ignore_scripts = 'false';
|
|
687
701
|
result.npm_config_package_lock_only = 'false';
|
|
688
|
-
result.npm_config_userconfig =
|
|
689
|
-
result.npm_config_globalconfig =
|
|
702
|
+
result.npm_config_userconfig = npmUserConfigPath;
|
|
703
|
+
result.npm_config_globalconfig = npmGlobalConfigPath;
|
|
690
704
|
return result;
|
|
691
705
|
}
|
|
692
706
|
|
|
@@ -763,7 +777,8 @@ function preparePinnedInstaller(version, options = {}) {
|
|
|
763
777
|
let closeSettled = false;
|
|
764
778
|
let selectedAction;
|
|
765
779
|
let installDirectory;
|
|
766
|
-
let
|
|
780
|
+
let npmUserConfigPath;
|
|
781
|
+
let npmGlobalConfigPath;
|
|
767
782
|
let disconnectTimer;
|
|
768
783
|
const close = Promise.withResolvers();
|
|
769
784
|
const closePromise = close.promise;
|
|
@@ -848,9 +863,15 @@ function preparePinnedInstaller(version, options = {}) {
|
|
|
848
863
|
resolveInstallTempRoot(options),
|
|
849
864
|
options.blunDir,
|
|
850
865
|
);
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
866
|
+
npmUserConfigPath = path.join(installDirectory, 'user-npmrc');
|
|
867
|
+
npmGlobalConfigPath = path.join(installDirectory, 'global-npmrc');
|
|
868
|
+
writePrivateFile(npmUserConfigPath, '');
|
|
869
|
+
writePrivateFile(npmGlobalConfigPath, '');
|
|
870
|
+
invocation = createInstallInvocation(version, {
|
|
871
|
+
...options,
|
|
872
|
+
npmUserConfigPath,
|
|
873
|
+
npmGlobalConfigPath,
|
|
874
|
+
});
|
|
854
875
|
child = forkImpl(path.join(__dirname, 'update-lease.js'), ['--installer-worker'], {
|
|
855
876
|
detached: true,
|
|
856
877
|
execPath: invocation.command,
|
|
@@ -858,7 +879,8 @@ function preparePinnedInstaller(version, options = {}) {
|
|
|
858
879
|
env: createInstallEnvironment(
|
|
859
880
|
options.env || process.env,
|
|
860
881
|
installDirectory,
|
|
861
|
-
|
|
882
|
+
npmUserConfigPath,
|
|
883
|
+
npmGlobalConfigPath,
|
|
862
884
|
),
|
|
863
885
|
stdio: ['inherit', 'inherit', 'inherit', 'ipc'],
|
|
864
886
|
windowsHide: true,
|