mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-30 17:28:52 -05:00
node_modules is stale -> ignore node-version changes
This commit is contained in:
committed by
Henning Dieterichs
parent
5f094293b4
commit
c9335c2873
@@ -112,7 +112,7 @@ export class NpmUpToDateFeature extends vscode.Disposable {
|
||||
}
|
||||
try {
|
||||
const script = path.join(workspaceRoot, 'build', 'npm', 'installStateHash.ts');
|
||||
const output = cp.execFileSync(process.execPath, [script], {
|
||||
const output = cp.execFileSync(process.execPath, [script, '--ignore-node-version'], {
|
||||
cwd: workspaceRoot,
|
||||
timeout: 10_000,
|
||||
encoding: 'utf8',
|
||||
|
||||
@@ -87,7 +87,7 @@ function hashContent(content: string): string {
|
||||
return hash.digest('hex');
|
||||
}
|
||||
|
||||
export function computeState(): PostinstallState {
|
||||
export function computeState(options?: { ignoreNodeVersion?: boolean }): PostinstallState {
|
||||
const fileHashes: Record<string, string> = {};
|
||||
for (const filePath of collectInputFiles()) {
|
||||
const key = path.relative(root, filePath);
|
||||
@@ -97,7 +97,7 @@ export function computeState(): PostinstallState {
|
||||
// file may not be readable
|
||||
}
|
||||
}
|
||||
return { nodeVersion: process.versions.node, fileHashes };
|
||||
return { nodeVersion: options?.ignoreNodeVersion ? '' : process.versions.node, fileHashes };
|
||||
}
|
||||
|
||||
export function computeContents(): Record<string, string> {
|
||||
@@ -141,18 +141,23 @@ export function readSavedContents(): Record<string, string> | undefined {
|
||||
|
||||
// When run directly, output state as JSON for tooling (e.g. the vscode-extras extension).
|
||||
if (import.meta.filename === process.argv[1]) {
|
||||
if (process.argv[2] === '--normalize-file') {
|
||||
const filePath = process.argv[3];
|
||||
const args = new Set(process.argv.slice(2));
|
||||
|
||||
if (args.has('--normalize-file')) {
|
||||
const filePath = process.argv[process.argv.indexOf('--normalize-file') + 1];
|
||||
if (!filePath) {
|
||||
process.exit(1);
|
||||
}
|
||||
process.stdout.write(normalizeFileContent(filePath));
|
||||
} else {
|
||||
const ignoreNodeVersion = args.has('--ignore-node-version');
|
||||
const current = computeState({ ignoreNodeVersion });
|
||||
const saved = readSavedState();
|
||||
console.log(JSON.stringify({
|
||||
root,
|
||||
stateContentsFile,
|
||||
current: computeState(),
|
||||
saved: readSavedState(),
|
||||
current,
|
||||
saved: saved && ignoreNodeVersion ? { nodeVersion: '', fileHashes: saved.fileHashes } : saved,
|
||||
files: [...collectInputFiles(), stateFile],
|
||||
}));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user