From ec31c7411058059d2af188a99f53b22c8ce0feb8 Mon Sep 17 00:00:00 2001 From: Remi Schnekenburger Date: Wed, 9 Oct 2024 18:22:05 +0200 Subject: [PATCH] Move vscode builtin production from yarn to npm Also updates builtin to 1.94.0 fixes #131 contributed on behalf of STMicroelectronics Signed-off-by: Remi Schnekenburger --- package.json | 2 +- src/compile.js | 6 +++--- src/create-extension-pack.js | 8 ++++---- src/package-vsix.js | 2 +- src/publish-vsix.js | 2 +- src/vscode-bundle.js | 33 ++------------------------------- vscode | 2 +- 7 files changed, 13 insertions(+), 42 deletions(-) diff --git a/package.json b/package.json index 2cadb1a..063407a 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "private": true, "license": "EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0", "scripts": { - "build:extensions": "yarn --cwd vscode && yarn compile:extensions && yarn bundle:extensions", + "build:extensions": "npm --prefix vscode install && yarn compile:extensions && yarn bundle:extensions", "compile:extensions": "cross-env NODE_OPTIONS=--max-old-space-size=8192 node ./src/compile.js", "bundle:extensions": "cross-env NODE_OPTIONS=--max-old-space-size=8192 node ./src/bundle.js", "publish:vsix": "node ./src/publish-vsix.js", diff --git a/src/compile.js b/src/compile.js index d3ab4b8..f1aa7dc 100644 --- a/src/compile.js +++ b/src/compile.js @@ -41,9 +41,9 @@ async function createMissingLockFiles(extensionsPath) { for (let subFolderName of subFolderNames) { let subFolderPath = path.join(extensionsPath, subFolderName); - let yarnLockExists = fs.existsSync(path.join(subFolderPath, 'yarn.lock')); - if (!yarnLockExists) { - await run('yarn', ['install'], subFolderPath ); + let packageLockExists = fs.existsSync(path.join(subFolderPath, 'package-lock.json')); + if (!packageLockExists) { + await run('npm', ['install'], subFolderPath ); } } } diff --git a/src/create-extension-pack.js b/src/create-extension-pack.js index 2d6a285..7a50ea4 100644 --- a/src/create-extension-pack.js +++ b/src/create-extension-pack.js @@ -98,11 +98,11 @@ const externalBuiltins = ['ms-vscode.js-debug-companion', 'ms-vscode.js-debug']; fs.writeFileSync(licensePath, generateLicense()); fs.writeFileSync(readmePath, generateReadme()); - await createYarnLock(packFolderPath); + await createPackageLock(packFolderPath); await vsce.createVSIX({ 'cwd': packFolderPath, 'packagePath': dist(), - 'useYarn': true + 'useYarn': false }); async function resolveExtensions(extensionsArr) { @@ -163,8 +163,8 @@ const externalBuiltins = ['ms-vscode.js-debug-companion', 'ms-vscode.js-debug']; /** * @param {string} folderPath */ -async function createYarnLock(folderPath) { - await run('yarn', ['install'], folderPath); +async function createPackageLock(folderPath) { + await run('npm', ['install'], folderPath); } function generateLicense() { diff --git a/src/package-vsix.js b/src/package-vsix.js index 064b802..a8e88cc 100644 --- a/src/package-vsix.js +++ b/src/package-vsix.js @@ -170,7 +170,7 @@ const repository = { await vsce.createVSIX({ 'cwd': extensions(extension), 'packagePath': dist(), - 'useYarn': true, + 'useYarn': false, 'allowStarActivation': true }); result.push('successfully packaged: ' + pck.name); diff --git a/src/publish-vsix.js b/src/publish-vsix.js index 7c79ac9..30a21c6 100644 --- a/src/publish-vsix.js +++ b/src/publish-vsix.js @@ -83,7 +83,7 @@ async function publishExtension(vsix) { console.log(`Extension ${extension} v${version} is already published - skipping!`); } else { console.log('Publishing: ', dist(vsix), ' ...'); - const results = await ovsx.publish({ extensionFile: dist(vsix), yarn: true }); + const results = await ovsx.publish({ extensionFile: dist(vsix), yarn: false }); for (const result of results) { if (result.status === 'rejected') { message = `Error(s) Generated when publishing ${extension} v${version}!`; diff --git a/src/vscode-bundle.js b/src/vscode-bundle.js index b22bcdb..715b69a 100644 --- a/src/vscode-bundle.js +++ b/src/vscode-bundle.js @@ -18,44 +18,15 @@ const rimraf = require('../vscode/node_modules/rimraf'); const vfs = require('../vscode/node_modules/vinyl-fs'); const ext = require('../vscode/build/lib/extensions'); -const { theiaExtension, extensions, run, vscodeExtensions } = require('./paths.js'); - -const fs = require('fs'); -const path = require('path'); +const { theiaExtension, extensions, run } = require('./paths.js'); rimraf.sync(extensions()); (async () => { await new Promise((resolve, reject) => { - ext.packageLocalExtensionsStream(false) + ext.packageLocalExtensionsStream(false, false) .pipe(vfs.dest(theiaExtension())) .on('error', reject) .on('end', resolve); }); - copyYarnLock(vscodeExtensions(), extensions()) await run('yarn', ['install', '--production'], extensions('emmet')); })(); - -/** - * The 'yarn.lock' file is now required by the 'vsce' cli. - * This method copies it from the given source folder to a corresponding - * folder in the target. - * - * The method assumes that for each subfolder in the target a corresponding - * subfolder with the same name exists in the source folder. - * - * @param {string} sourceDir - The path of the source folder. - * @param {string} targetDir - The path of the destination folder. - */ -function copyYarnLock(sourceDir, targetDir) { - let subFolderNames = fs.readdirSync(targetDir, { withFileTypes: true }) - .filter(dirent => dirent.isDirectory()) - .map(dirent => dirent.name); - - for (let subFolderName of subFolderNames) { - let sourceYarnLockPath = path.join(sourceDir, subFolderName, 'yarn.lock'); - if (fs.existsSync(sourceYarnLockPath)) { - console.log(`copying: ${sourceYarnLockPath} ${path.join(targetDir, subFolderName)}`); - fs.copyFileSync(sourceYarnLockPath, path.join(targetDir, subFolderName, 'yarn.lock')); - } - } -} diff --git a/vscode b/vscode index e170252..d78a74b 160000 --- a/vscode +++ b/vscode @@ -1 +1 @@ -Subproject commit e170252f762678dec6ca2cc69aba1570769a5d39 +Subproject commit d78a74bcdfad14d5d3b1b782f87255d802b57511