From 2466cb3172fa043b12dbeec87f86c0006c473fb0 Mon Sep 17 00:00:00 2001 From: Don Jayamanne Date: Tue, 1 Aug 2023 07:56:28 +1000 Subject: [PATCH] Work around --- build/ci/postInstall.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/build/ci/postInstall.js b/build/ci/postInstall.js index 7b3e76ae08c..c259438736d 100644 --- a/build/ci/postInstall.js +++ b/build/ci/postInstall.js @@ -238,6 +238,23 @@ function verifyMomentIsOnlyUsedByJupyterLabCoreUtils() { throw new Error(`Moment is being used by other packages (${otherPackagesUsingMoment.join(', ')}).`); } } + +/** + * Work around for https://github.com/microsoft/vscode-python/issues/21720 + * + * The npm package @vscode/python-extension has a peer dependency on @types/vscode. + * However Jupyter extensions uses @vscode-dts with the cli arg '-f' instead of @types/vscode. + * The webpack builds when running the command `npm list --production --parseable --depth=99999 --loglevel=error` + * Work around is to remove the peerDepencency on @types/vscode. + */ +function fixPythonExtensionNpmPackageJson() { + const jsonFilePath = path.join(__dirname, '..', '..', 'node_modules','@vscode','python-extension','package.json'); + const packageJson = JSON.parse(fs.readFileSync(jsonFilePath)); + if (packageJson.peerDependencies && packageJson.peerDependencies['@types/vscode']) { + delete packageJson.peerDependencies['@types/vscode']; + fs.writeFileSync(jsonFilePath, JSON.stringify(packageJson, undefined, 4)); + } +} async function downloadZmqBinaries() { if (common.getBundleConfiguration() === common.bundleConfiguration.web) { // No need to download zmq binaries for web. @@ -254,6 +271,7 @@ fixVariableNameInKernelDefaultJs(); removeUnnecessaryLoggingFromKernelDefault(); updateJSDomTypeDefinition(); fixStripComments(); +fixPythonExtensionNpmPackageJson(); verifyMomentIsOnlyUsedByJupyterLabCoreUtils(); downloadZmqBinaries() .then(() => process.exit(0))