chore: 'hoist' package to reduce pipeline variance (#1705)
This adds a new build mode where the built assets will replace those in the repo. This can be used in pipelines to avoid having the "workingDir" that doesn't exist until later. I also looked at modifying the checked-in package.json, but this was difficult because: (a) we modify the _name_ for nightly builds, which includes local development, and having this change based on the build is noisy. (b) there's just a lot of package.json (about 13k lines) which uncompressed is sizable
This commit is contained in:
Родитель
dbd40e39fe
Коммит
d7ef9e6bf0
|
@ -17,7 +17,6 @@ parameters:
|
||||||
extends:
|
extends:
|
||||||
template: azure-pipelines/extension/pre-release.yml@templates
|
template: azure-pipelines/extension/pre-release.yml@templates
|
||||||
parameters:
|
parameters:
|
||||||
workingDirectory: dist
|
|
||||||
usePreReleaseChannel: false
|
usePreReleaseChannel: false
|
||||||
vscePackageArgs: --no-dependencies
|
vscePackageArgs: --no-dependencies
|
||||||
cgIgnoreDirectories: 'testdata,demos,.vscode-test'
|
cgIgnoreDirectories: 'testdata,demos,.vscode-test'
|
||||||
|
@ -26,8 +25,8 @@ extends:
|
||||||
- script: npm install --legacy-peer-deps
|
- script: npm install --legacy-peer-deps
|
||||||
displayName: Install dependencies
|
displayName: Install dependencies
|
||||||
|
|
||||||
- script: npm run compile -- package:prepare --nightly
|
- script: npx -y @vscode/l10n-dev export --outDir ./l10n-extract ./src
|
||||||
displayName: Package
|
|
||||||
|
|
||||||
- script: npx -y @vscode/l10n-dev export --outDir ./dist/l10n-extract ./src
|
|
||||||
displayName: Extract localization
|
displayName: Extract localization
|
||||||
|
|
||||||
|
- script: npm run compile -- package:hoist --nightly
|
||||||
|
displayName: Package
|
||||||
|
|
|
@ -24,7 +24,6 @@ parameters:
|
||||||
extends:
|
extends:
|
||||||
template: azure-pipelines/extension/stable.yml@templates
|
template: azure-pipelines/extension/stable.yml@templates
|
||||||
parameters:
|
parameters:
|
||||||
workingDirectory: dist
|
|
||||||
publishExtension: ${{ parameters.publishExtension }}
|
publishExtension: ${{ parameters.publishExtension }}
|
||||||
vscePackageArgs: --no-dependencies
|
vscePackageArgs: --no-dependencies
|
||||||
cgIgnoreDirectories: 'testdata,demos,.vscode-test'
|
cgIgnoreDirectories: 'testdata,demos,.vscode-test'
|
||||||
|
@ -32,8 +31,8 @@ extends:
|
||||||
ghCreateRelease: true
|
ghCreateRelease: true
|
||||||
ghReleaseAddChangeLog: true
|
ghReleaseAddChangeLog: true
|
||||||
l10nShouldOnlyPush: true
|
l10nShouldOnlyPush: true
|
||||||
l10nPackageNlsPath: ../package.nls.json
|
l10nPackageNlsPath: package.nls.json
|
||||||
l10nSourcePaths: ../src
|
l10nSourcePaths: src
|
||||||
buildSteps:
|
buildSteps:
|
||||||
- script: npm install --legacy-peer-deps
|
- script: npm install --legacy-peer-deps
|
||||||
displayName: Install dependencies
|
displayName: Install dependencies
|
||||||
|
@ -47,5 +46,5 @@ extends:
|
||||||
- publish: $(Build.ArtifactStagingDirectory)/dap-server
|
- publish: $(Build.ArtifactStagingDirectory)/dap-server
|
||||||
artifact: Publish DAP Debug Server Bundle
|
artifact: Publish DAP Debug Server Bundle
|
||||||
|
|
||||||
- script: npm run compile -- package:prepare
|
- script: npm run compile -- package:hoist
|
||||||
displayName: Package Stable
|
displayName: Package Stable
|
||||||
|
|
18
gulpfile.js
18
gulpfile.js
|
@ -14,7 +14,6 @@ const execSync = require('child_process').execSync;
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const cp = require('child_process');
|
const cp = require('child_process');
|
||||||
const util = require('util');
|
const util = require('util');
|
||||||
const deepmerge = require('deepmerge');
|
|
||||||
const esbuild = require('esbuild');
|
const esbuild = require('esbuild');
|
||||||
const esbuildPlugins = require('./src/build/esbuildPlugins');
|
const esbuildPlugins = require('./src/build/esbuildPlugins');
|
||||||
const got = require('got').default;
|
const got = require('got').default;
|
||||||
|
@ -153,7 +152,7 @@ gulp.task('compile:dynamic', async () => {
|
||||||
await fixNightlyReadme();
|
await fixNightlyReadme();
|
||||||
}
|
}
|
||||||
|
|
||||||
packageJson = deepmerge(packageJson, contributions);
|
packageJson = Object.assign(packageJson, contributions);
|
||||||
|
|
||||||
await writeFile(`${buildDir}/package.json`, JSON.stringify(packageJson));
|
await writeFile(`${buildDir}/package.json`, JSON.stringify(packageJson));
|
||||||
});
|
});
|
||||||
|
@ -339,6 +338,21 @@ gulp.task(
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/** Prepares the package and then hoists it to the root directory. Destructive. */
|
||||||
|
gulp.task('package:hoist', gulp.series('package:prepare', async () => {
|
||||||
|
const srcFiles = await fs.promises.readdir(buildDir);
|
||||||
|
const ignoredFiles = new Set(await fs.promises.readdir(__dirname));
|
||||||
|
|
||||||
|
ignoredFiles.delete('l10n-extract'); // special case: made in the pipeline
|
||||||
|
|
||||||
|
for (const file of srcFiles) {
|
||||||
|
ignoredFiles.delete(file);
|
||||||
|
await fs.promises.rm(path.join(__dirname, file), { force: true, recursive: true });
|
||||||
|
await fs.promises.rename(path.join(buildDir, file), path.join(__dirname, file));
|
||||||
|
}
|
||||||
|
await fs.promises.appendFile(path.join(__dirname, '.vscodeignore'), [...ignoredFiles].join('\n'));
|
||||||
|
}));
|
||||||
|
|
||||||
gulp.task('package', gulp.series('package:prepare', 'package:createVSIX'));
|
gulp.task('package', gulp.series('package:prepare', 'package:createVSIX'));
|
||||||
|
|
||||||
gulp.task('flatSessionBundle', gulp.series('clean', 'compile', 'flatSessionBundle:webpack-bundle'));
|
gulp.task('flatSessionBundle', gulp.series('clean', 'compile', 'flatSessionBundle:webpack-bundle'));
|
||||||
|
|
|
@ -83,7 +83,6 @@
|
||||||
"chai-as-promised": "^7.1.1",
|
"chai-as-promised": "^7.1.1",
|
||||||
"chai-string": "^1.5.0",
|
"chai-string": "^1.5.0",
|
||||||
"chai-subset": "^1.6.0",
|
"chai-subset": "^1.6.0",
|
||||||
"deepmerge": "^4.2.2",
|
|
||||||
"del": "^6.0.0",
|
"del": "^6.0.0",
|
||||||
"diff": "^5.0.0",
|
"diff": "^5.0.0",
|
||||||
"esbuild": "^0.17.10",
|
"esbuild": "^0.17.10",
|
||||||
|
@ -4540,15 +4539,6 @@
|
||||||
"integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==",
|
"integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/deepmerge": {
|
|
||||||
"version": "4.2.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.2.2.tgz",
|
|
||||||
"integrity": "sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg==",
|
|
||||||
"dev": true,
|
|
||||||
"engines": {
|
|
||||||
"node": ">=0.10.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/default-browser": {
|
"node_modules/default-browser": {
|
||||||
"version": "2.0.1",
|
"version": "2.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/default-browser/-/default-browser-2.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/default-browser/-/default-browser-2.0.1.tgz",
|
||||||
|
@ -18402,12 +18392,6 @@
|
||||||
"integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==",
|
"integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"deepmerge": {
|
|
||||||
"version": "4.2.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.2.2.tgz",
|
|
||||||
"integrity": "sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"default-browser": {
|
"default-browser": {
|
||||||
"version": "2.0.1",
|
"version": "2.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/default-browser/-/default-browser-2.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/default-browser/-/default-browser-2.0.1.tgz",
|
||||||
|
|
14
package.json
14
package.json
|
@ -130,7 +130,6 @@
|
||||||
"chai-as-promised": "^7.1.1",
|
"chai-as-promised": "^7.1.1",
|
||||||
"chai-string": "^1.5.0",
|
"chai-string": "^1.5.0",
|
||||||
"chai-subset": "^1.6.0",
|
"chai-subset": "^1.6.0",
|
||||||
"deepmerge": "^4.2.2",
|
|
||||||
"del": "^6.0.0",
|
"del": "^6.0.0",
|
||||||
"diff": "^5.0.0",
|
"diff": "^5.0.0",
|
||||||
"esbuild": "^0.17.10",
|
"esbuild": "^0.17.10",
|
||||||
|
@ -174,16 +173,5 @@
|
||||||
],
|
],
|
||||||
"extensionKind": [
|
"extensionKind": [
|
||||||
"workspace"
|
"workspace"
|
||||||
],
|
]
|
||||||
"contributes": {
|
|
||||||
"terminal": {
|
|
||||||
"profiles": [
|
|
||||||
{
|
|
||||||
"id": "extension.js-debug.debugTerminal",
|
|
||||||
"title": "%debug.terminal.label%",
|
|
||||||
"icon": "$(debug)"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1591,6 +1591,15 @@ if (require.main === module) {
|
||||||
title: 'JavaScript Debugger',
|
title: 'JavaScript Debugger',
|
||||||
properties: configurationSchema,
|
properties: configurationSchema,
|
||||||
},
|
},
|
||||||
|
terminal: {
|
||||||
|
profiles: [
|
||||||
|
{
|
||||||
|
id: 'extension.js-debug.debugTerminal',
|
||||||
|
title: refString('debug.terminal.label'),
|
||||||
|
icon: '$(debug)',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
views,
|
views,
|
||||||
viewsWelcome,
|
viewsWelcome,
|
||||||
},
|
},
|
||||||
|
|
Загрузка…
Ссылка в новой задаче