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:
Connor Peet 2023-05-11 15:57:17 -07:00 коммит произвёл GitHub
Родитель dbd40e39fe
Коммит d7ef9e6bf0
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
6 изменённых файлов: 33 добавлений и 40 удалений

Просмотреть файл

@ -17,7 +17,6 @@ parameters:
extends:
template: azure-pipelines/extension/pre-release.yml@templates
parameters:
workingDirectory: dist
usePreReleaseChannel: false
vscePackageArgs: --no-dependencies
cgIgnoreDirectories: 'testdata,demos,.vscode-test'
@ -26,8 +25,8 @@ extends:
- script: npm install --legacy-peer-deps
displayName: Install dependencies
- script: npm run compile -- package:prepare --nightly
displayName: Package
- script: npx -y @vscode/l10n-dev export --outDir ./dist/l10n-extract ./src
- script: npx -y @vscode/l10n-dev export --outDir ./l10n-extract ./src
displayName: Extract localization
- script: npm run compile -- package:hoist --nightly
displayName: Package

Просмотреть файл

@ -24,7 +24,6 @@ parameters:
extends:
template: azure-pipelines/extension/stable.yml@templates
parameters:
workingDirectory: dist
publishExtension: ${{ parameters.publishExtension }}
vscePackageArgs: --no-dependencies
cgIgnoreDirectories: 'testdata,demos,.vscode-test'
@ -32,8 +31,8 @@ extends:
ghCreateRelease: true
ghReleaseAddChangeLog: true
l10nShouldOnlyPush: true
l10nPackageNlsPath: ../package.nls.json
l10nSourcePaths: ../src
l10nPackageNlsPath: package.nls.json
l10nSourcePaths: src
buildSteps:
- script: npm install --legacy-peer-deps
displayName: Install dependencies
@ -47,5 +46,5 @@ extends:
- publish: $(Build.ArtifactStagingDirectory)/dap-server
artifact: Publish DAP Debug Server Bundle
- script: npm run compile -- package:prepare
- script: npm run compile -- package:hoist
displayName: Package Stable

Просмотреть файл

@ -14,7 +14,6 @@ const execSync = require('child_process').execSync;
const fs = require('fs');
const cp = require('child_process');
const util = require('util');
const deepmerge = require('deepmerge');
const esbuild = require('esbuild');
const esbuildPlugins = require('./src/build/esbuildPlugins');
const got = require('got').default;
@ -153,7 +152,7 @@ gulp.task('compile:dynamic', async () => {
await fixNightlyReadme();
}
packageJson = deepmerge(packageJson, contributions);
packageJson = Object.assign(packageJson, contributions);
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('flatSessionBundle', gulp.series('clean', 'compile', 'flatSessionBundle:webpack-bundle'));

16
package-lock.json сгенерированный
Просмотреть файл

@ -83,7 +83,6 @@
"chai-as-promised": "^7.1.1",
"chai-string": "^1.5.0",
"chai-subset": "^1.6.0",
"deepmerge": "^4.2.2",
"del": "^6.0.0",
"diff": "^5.0.0",
"esbuild": "^0.17.10",
@ -4540,15 +4539,6 @@
"integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==",
"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": {
"version": "2.0.1",
"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==",
"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": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/default-browser/-/default-browser-2.0.1.tgz",

Просмотреть файл

@ -130,7 +130,6 @@
"chai-as-promised": "^7.1.1",
"chai-string": "^1.5.0",
"chai-subset": "^1.6.0",
"deepmerge": "^4.2.2",
"del": "^6.0.0",
"diff": "^5.0.0",
"esbuild": "^0.17.10",
@ -174,16 +173,5 @@
],
"extensionKind": [
"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',
properties: configurationSchema,
},
terminal: {
profiles: [
{
id: 'extension.js-debug.debugTerminal',
title: refString('debug.terminal.label'),
icon: '$(debug)',
},
],
},
views,
viewsWelcome,
},