Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/vs-code-designer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@
},
"private": true,
"scripts": {
"build:extension": "tsup && pnpm run copyFiles && cd dist && npm install --ignore-scripts",
"build:extension": "tsup && pnpm run copyFiles && node scripts/install-dist-dependencies.js --ignore-scripts",
"build:ui": "tsup --config tsup.e2e.test.config.ts",
"copyFiles": "node extension-copy-svgs.js",
"vscode:designer:pack": "pnpm run vscode:designer:pack:step1 && pnpm run vscode:designer:pack:step2",
"vscode:designer:pack:step1": "cd ./dist && npm install",
"vscode:designer:pack:step1": "node scripts/install-dist-dependencies.js",
"vscode:designer:pack:step2": "cd ./dist && vsce package",
"lint": "eslint . --report-unused-disable-directives --max-warnings 0",
"test:extension-unit": "vitest run --retry=3",
Expand Down
42 changes: 42 additions & 0 deletions apps/vs-code-designer/scripts/install-dist-dependencies.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
const { spawnSync } = require('child_process');
const { existsSync } = require('fs');
const { join } = require('path');

const distPath = join(__dirname, '..', 'dist');
if (!existsSync(distPath)) {
console.error(`Extension dist folder does not exist: ${distPath}`);
process.exit(1);
}

const args = ['install', ...process.argv.slice(2)];
const npmUserConfig = process.env.NPM_CONFIG_USERCONFIG?.trim();
if (npmUserConfig) {
if (!existsSync(npmUserConfig)) {
console.error('NPM_CONFIG_USERCONFIG is set, but the configured npm userconfig file does not exist.');
process.exit(1);
}

console.log('Using npm userconfig from NPM_CONFIG_USERCONFIG.');
args.push('--userconfig', npmUserConfig);
}

const npmCliPath = join(process.execPath, '..', 'node_modules', 'npm', 'bin', 'npm-cli.js');
const command = existsSync(npmCliPath) ? process.execPath : process.platform === 'win32' ? 'npm.cmd' : 'npm';
const commandArgs = existsSync(npmCliPath) ? [npmCliPath, ...args] : args;

const result = spawnSync(command, commandArgs, {
cwd: distPath,
stdio: 'inherit',
shell: false,
});

if (result.error) {
console.error(result.error.message);
process.exit(1);
}

process.exit(result.status ?? 1);
Loading