@sdlcai/setup 0.3.2 → 0.3.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/cli.mjs +18 -3
- package/package.json +1 -1
package/bin/cli.mjs
CHANGED
|
@@ -21,7 +21,8 @@ const SCOPE = '@avanade-region-iceg';
|
|
|
21
21
|
const ASSETS = {
|
|
22
22
|
'ava-custom-agents': { pkg: '@avanade-region-iceg/ava-agents', args: ['install'], label: 'AVA custom agents' },
|
|
23
23
|
'ava-agents': { pkg: '@avanade-region-iceg/ava-agents', args: ['install'], label: 'AVA custom agents' },
|
|
24
|
-
'mnemo': { pkg: '@avanade-region-iceg/mnemo-setup', args: [], label: 'mnemo (memory)' },
|
|
24
|
+
'mnemo': { pkg: '@avanade-region-iceg/mnemo-setup', args: [], label: 'mnemo (AVA memory)' },
|
|
25
|
+
'ava-mem': { pkg: '@avanade-region-iceg/mnemo-setup', args: [], label: 'mnemo (AVA memory)' },
|
|
25
26
|
'gh-mnemo': { pkg: '@avanade-region-iceg/gh-mnemo', args: [], label: 'mnemo gh extension' },
|
|
26
27
|
};
|
|
27
28
|
|
|
@@ -123,8 +124,22 @@ function main() {
|
|
|
123
124
|
configureNpmAuth(token);
|
|
124
125
|
|
|
125
126
|
info(`\n→ Installing ${target.label} (${target.pkg})…\n`);
|
|
126
|
-
|
|
127
|
-
|
|
127
|
+
// Install to a known dir then invoke the bin file directly with node.
|
|
128
|
+
// Avoids the Windows cmd.exe PATH issue where npx / npm-exec cannot
|
|
129
|
+
// resolve the temporary .bin wrapper after a nested shell spawn.
|
|
130
|
+
const installDir = join(homedir(), '.sdlcai', target.pkg.replace(/[@/]/g, '-'));
|
|
131
|
+
const r1 = run('npm', ['install', '--prefix', installDir, '--no-save', '--no-audit', '--no-fund', target.pkg]);
|
|
132
|
+
if (r1.status !== 0) die(`Failed to install ${target.pkg}.`);
|
|
133
|
+
const pkgJsonPath = join(installDir, 'node_modules', ...target.pkg.split('/'), 'package.json');
|
|
134
|
+
const pkgMeta = JSON.parse(readFileSync(pkgJsonPath, 'utf8'));
|
|
135
|
+
const binMap = typeof pkgMeta.bin === 'string'
|
|
136
|
+
? { [pkgMeta.name.replace(/^@[^/]+\//, '')]: pkgMeta.bin }
|
|
137
|
+
: (pkgMeta.bin || {});
|
|
138
|
+
const binRel = Object.values(binMap)[0];
|
|
139
|
+
if (!binRel) die(`No binary declared in ${target.pkg}.`);
|
|
140
|
+
const binAbs = join(installDir, 'node_modules', ...target.pkg.split('/'), ...binRel.split('/'));
|
|
141
|
+
const r2 = spawnSync(process.execPath, [binAbs, ...target.args, ...passthrough], { stdio: 'inherit' });
|
|
142
|
+
process.exit(r2.status ?? 0);
|
|
128
143
|
}
|
|
129
144
|
|
|
130
145
|
main();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sdlcai/setup",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.6",
|
|
4
4
|
"description": "One-command bootstrap for private Avanade dev-tool assets (AVA agents, mnemo, …): GitHub browser login + Avanade-Region-ICEG access gate + install.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|