Skip to content

Commit 9c45d50

Browse files
committed
fix version match check
1 parent 551667f commit 9c45d50

File tree

3 files changed

+8
-45
lines changed

3 files changed

+8
-45
lines changed

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,6 @@
165165
"@types/yargs": "^17.0.18",
166166
"@typescript-eslint/eslint-plugin": "~5.28.0",
167167
"@typescript-eslint/parser": "~5.28.0",
168-
"@yarnpkg/lockfile": "~1.1.0",
169168
"css-loader": "~5.1.1",
170169
"electron": "^23.1.4",
171170
"electron-builder": "^23.6.0",

scripts/buildutil.js

Lines changed: 8 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ const meow = require('meow');
22
const fs = require('fs-extra');
33
const path = require('path');
44
const semver = require('semver');
5-
const lockfile = require('@yarnpkg/lockfile');
65
const yaml = require('js-yaml');
76

87
const pkgjsonFilePath = path.resolve(__dirname, '../package.json');
@@ -96,40 +95,6 @@ if (cli.flags.checkVersionMatch) {
9695
const appVersion = pkgjsonFileData['version'];
9796
console.log(`JupyterLab Desktop version: ${appVersion}`);
9897

99-
// parse JupyterLab version bundled to application UI
100-
const yarnlockFilePath = path.resolve(__dirname, '../yarn.lock');
101-
if (!fs.existsSync(yarnlockFilePath)) {
102-
console.error('yarn.lock not found!');
103-
process.exit(1);
104-
}
105-
106-
const yarnLockFileContent = fs.readFileSync(yarnlockFilePath, 'utf8');
107-
const yarnLockData = lockfile.parse(yarnLockFileContent).object;
108-
const yarnPackages = Object.keys(yarnLockData);
109-
const metapackage = yarnPackages.find(pkg =>
110-
pkg.startsWith('@jupyterlab/metapackage')
111-
);
112-
if (!metapackage) {
113-
console.error('@jupyterlab/metapackage not found!');
114-
process.exit(1);
115-
}
116-
117-
const jlabVersion = yarnLockData[metapackage].version;
118-
console.log(`JupyterLab version: ${jlabVersion}`);
119-
120-
if (
121-
!semver.valid(appVersion) ||
122-
!semver.valid(jlabVersion) ||
123-
semver.major(appVersion) !== semver.major(jlabVersion) ||
124-
semver.minor(appVersion) !== semver.minor(jlabVersion) ||
125-
semver.patch(appVersion) !== semver.patch(jlabVersion)
126-
) {
127-
console.error(
128-
`Application package version ${appVersion} doesn't match bundled JupyterLab version ${jlabVersion}`
129-
);
130-
process.exit(1);
131-
}
132-
13398
// check JupyterLab version bundled to Application Server
13499
const constructorData = yaml.load(
135100
fs.readFileSync(
@@ -158,15 +123,19 @@ if (cli.flags.checkVersionMatch) {
158123
const appServerJLabVersion = specParts[1];
159124
console.log(`Application Server JupyterLab version: ${appServerJLabVersion}`);
160125

161-
if (appServerJLabVersion !== jlabVersion) {
126+
if (
127+
!semver.valid(appVersion) ||
128+
!semver.valid(appServerJLabVersion) ||
129+
semver.major(appVersion) !== semver.major(appServerJLabVersion) ||
130+
semver.minor(appVersion) !== semver.minor(appServerJLabVersion) ||
131+
semver.patch(appVersion) !== semver.patch(appServerJLabVersion)
132+
) {
162133
console.error(
163-
`Application Server package version ${appServerJLabVersion} doesn't match bundled JupyterLab version ${jlabVersion}`
134+
`Application package version ${appVersion} doesn't match bundled JupyterLab Python package version ${appServerJLabVersion}`
164135
);
165136
process.exit(1);
166137
}
167138

168-
checkExtensionImports();
169-
170139
console.log('JupyterLab version match satisfied!');
171140
process.exit(0);
172141
}

yarn.lock

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -701,11 +701,6 @@
701701
resolved "https://registry.yarnpkg.com/@xtuc/long/-/long-4.2.2.tgz#d291c6a4e97989b5c61d9acf396ae4fe133a718d"
702702
integrity sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==
703703

704-
"@yarnpkg/lockfile@~1.1.0":
705-
version "1.1.0"
706-
resolved "https://registry.yarnpkg.com/@yarnpkg/lockfile/-/lockfile-1.1.0.tgz#e77a97fbd345b76d83245edcd17d393b1b41fb31"
707-
integrity sha512-GpSwvyXOcOOlV70vbnzjj4fW5xW/FdUF6nQEt1ENy7m4ZCczi1+/buVUPAqmGfqznsORNFzUMjctTIp8a9tuCQ==
708-
709704
acorn-import-assertions@^1.7.6:
710705
version "1.8.0"
711706
resolved "https://registry.yarnpkg.com/acorn-import-assertions/-/acorn-import-assertions-1.8.0.tgz#ba2b5939ce62c238db6d93d81c9b111b29b855e9"

0 commit comments

Comments
 (0)