@@ -2,7 +2,6 @@ const meow = require('meow');
2
2
const fs = require ( 'fs-extra' ) ;
3
3
const path = require ( 'path' ) ;
4
4
const semver = require ( 'semver' ) ;
5
- const lockfile = require ( '@yarnpkg/lockfile' ) ;
6
5
const yaml = require ( 'js-yaml' ) ;
7
6
8
7
const pkgjsonFilePath = path . resolve ( __dirname , '../package.json' ) ;
@@ -96,40 +95,6 @@ if (cli.flags.checkVersionMatch) {
96
95
const appVersion = pkgjsonFileData [ 'version' ] ;
97
96
console . log ( `JupyterLab Desktop version: ${ appVersion } ` ) ;
98
97
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
-
133
98
// check JupyterLab version bundled to Application Server
134
99
const constructorData = yaml . load (
135
100
fs . readFileSync (
@@ -158,15 +123,19 @@ if (cli.flags.checkVersionMatch) {
158
123
const appServerJLabVersion = specParts [ 1 ] ;
159
124
console . log ( `Application Server JupyterLab version: ${ appServerJLabVersion } ` ) ;
160
125
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
+ ) {
162
133
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 } `
164
135
) ;
165
136
process . exit ( 1 ) ;
166
137
}
167
138
168
- checkExtensionImports ( ) ;
169
-
170
139
console . log ( 'JupyterLab version match satisfied!' ) ;
171
140
process . exit ( 0 ) ;
172
141
}
0 commit comments