caliper-harness 0.1.5 → 0.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/README.md +7 -1
- package/install.cjs +14 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -12,13 +12,19 @@ user account. If your current terminal cannot find it, open a new terminal;
|
|
|
12
12
|
installation cannot change the PATH of a terminal that is already running. You
|
|
13
13
|
can then enter any project directory and run `caliper`.
|
|
14
14
|
|
|
15
|
+
Recent npm versions ask for approval before running a package's install script.
|
|
16
|
+
If npm reports that `caliper-harness` is not covered by `allowScripts`, run
|
|
17
|
+
`npm install-scripts approve caliper-harness` and then
|
|
18
|
+
`npm rebuild caliper-harness` in the same directory to finish installing.
|
|
19
|
+
|
|
15
20
|
Plain npm installation creates `node_modules` and npm package files in the
|
|
16
21
|
installation directory. To avoid those files in a project, install globally with
|
|
17
22
|
`npm install -g caliper-harness`; npm supplies the global command in that case.
|
|
18
23
|
|
|
19
24
|
Supported platforms are macOS Apple Silicon, Windows x64 and Linux x64/ARM64.
|
|
20
25
|
Node 20 or newer is needed for the npm launcher. On Windows, the launcher checks
|
|
21
|
-
the Microsoft Visual C++ runtime
|
|
26
|
+
the Microsoft Visual C++ runtime (the x64 redistributable, version 14.44.35211.0
|
|
27
|
+
or newer) before starting. If it is missing or outdated,
|
|
22
28
|
the shared prerequisite helper downloads Microsoft's installer directly and may
|
|
23
29
|
request administrator approval or a restart. A compatible installation needs no
|
|
24
30
|
download. Caliper does not bundle Microsoft's installer or runtime DLLs.
|
package/install.cjs
CHANGED
|
@@ -52,13 +52,25 @@ function legacyWindowsRuntime(root) {
|
|
|
52
52
|
});
|
|
53
53
|
} catch { return false; }
|
|
54
54
|
}
|
|
55
|
+
// Windows PowerShell 5.1 must never autoload PowerShell 7 modules: a parent
|
|
56
|
+
// pwsh session exports its own PSModulePath to children, and 5.1 then fails
|
|
57
|
+
// loading Core-edition modules such as Microsoft.PowerShell.Security
|
|
58
|
+
// (Get-AuthenticodeSignature). Spawn powershell.exe with the Windows
|
|
59
|
+
// PowerShell module defaults instead of the inherited module path.
|
|
60
|
+
function windowsPowerShellEnv() {
|
|
61
|
+
const profile = process.env.USERPROFILE || os.homedir();
|
|
62
|
+
const programFiles = process.env.ProgramFiles || 'C:\\Program Files';
|
|
63
|
+
const systemRoot = process.env.SystemRoot || 'C:\\Windows';
|
|
64
|
+
const PSModulePath = [profile + '\\Documents\\WindowsPowerShell\\Modules', programFiles + '\\WindowsPowerShell\\Modules', systemRoot + '\\system32\\WindowsPowerShell\\v1.0\\Modules'].join(';');
|
|
65
|
+
return { ...process.env, PSModulePath };
|
|
66
|
+
}
|
|
55
67
|
async function ensurePrerequisites(root) {
|
|
56
68
|
if (process.platform !== 'win32') return;
|
|
57
69
|
const helper = path.join(root, 'ensure-windows-runtime.ps1');
|
|
58
70
|
if (!fs.existsSync(helper) && legacyWindowsRuntime(root)) return;
|
|
59
71
|
if (!process.env.SystemRoot) throw new Error('SystemRoot unavailable; cannot check Windows runtime');
|
|
60
72
|
await new Promise((resolve, reject) => {
|
|
61
|
-
const child = spawn(path.join(process.env.SystemRoot, 'System32', 'WindowsPowerShell', 'v1.0', 'powershell.exe'), ['-NoProfile', '-ExecutionPolicy', 'Bypass', '-File', helper], {stdio: 'inherit', windowsHide: false});
|
|
73
|
+
const child = spawn(path.join(process.env.SystemRoot, 'System32', 'WindowsPowerShell', 'v1.0', 'powershell.exe'), ['-NoProfile', '-ExecutionPolicy', 'Bypass', '-File', helper], {env: windowsPowerShellEnv(), stdio: 'inherit', windowsHide: false});
|
|
62
74
|
child.on('error', reject);
|
|
63
75
|
child.on('exit', code => code === 0 ? resolve() : reject(new Error(`Windows runtime prerequisite failed (${code}); previous selection preserved. Finish any requested restart before retrying.`)));
|
|
64
76
|
});
|
|
@@ -84,7 +96,7 @@ async function registerCommand(root) {
|
|
|
84
96
|
args = ['-NoProfile', '-ExecutionPolicy', 'Bypass', '-File', path.join(root, 'install-windows.ps1'), '-TargetDirectory', root];
|
|
85
97
|
}
|
|
86
98
|
await new Promise((resolve, reject) => {
|
|
87
|
-
const child = spawn(command, args, {stdio: 'inherit', windowsHide: false});
|
|
99
|
+
const child = spawn(command, args, process.platform === 'win32' ? {env: windowsPowerShellEnv(), stdio: 'inherit', windowsHide: false} : {stdio: 'inherit', windowsHide: false});
|
|
88
100
|
child.on('error', reject);
|
|
89
101
|
child.on('exit', code => code === 0 ? resolve() : reject(new Error(`Caliper command registration failed (${code}); application retained at ${root}`)));
|
|
90
102
|
});
|
package/package.json
CHANGED