Skip to content

Commit beab133

Browse files
committed
remove set_jupyterlab_version CLI
1 parent d2ad847 commit beab133

File tree

3 files changed

+0
-165
lines changed

3 files changed

+0
-165
lines changed

.github/workflows/sync_lab_release.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ jobs:
4141
set -eux
4242
export LATEST=$(python scripts/get_latest_lab_version.py)
4343
echo "latest=${LATEST}" >> $GITHUB_ENV
44-
yarn set_jupyterlab_version ${LATEST}
4544
if [[ ! -z "$(git status --porcelain package.json)" ]]; then
4645
tbump --only-patch ${LATEST}-1 --non-interactive
4746
yarn install

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
"create_env_installer:mac": "rimraf ./env_installer/JupyterLab*.sh && constructor ./env_installer --platform=osx-64 --output-dir ./env_installer",
3030
"create_env_installer:win": "rimraf ./env_installer/JupyterLab*.exe && constructor ./env_installer --platform=win-64 --output-dir ./env_installer",
3131
"check_version_match": "node scripts/buildutil.js --check-version-match",
32-
"set_jupyterlab_version": "node scripts/buildutil.js --set-jupyterlab-version",
3332
"eslint": "eslint --ext .js,.jsx,.ts,.tsx --cache --fix .",
3433
"eslint:check": "eslint --ext .js,.jsx,.ts,.tsx --cache .",
3534
"eslint:check:typed": "eslint --config .eslintrc.typecheck.js --ext .js,.jsx,.ts,.tsx .",

scripts/buildutil.js

Lines changed: 0 additions & 163 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ const cli = meow(
1313
1414
Options
1515
--check-version-match check for JupyterLab version match
16-
--set-jupyterlab-version set JupyterLab version
1716
1817
Other options:
1918
--help show usage information
@@ -27,61 +26,11 @@ const cli = meow(
2726
checkVersionMatch: {
2827
type: 'boolean',
2928
default: false
30-
},
31-
setJupyterlabVersion: {
32-
type: 'string',
33-
default: ''
3429
}
3530
}
3631
}
3732
);
3833

39-
// remove ~ or ^ prefix from semver version
40-
function makeVersionAbsolute(version) {
41-
if (version.length > 0 && (version[0] === '^' || version[0] === '~')) {
42-
return version.substring(1);
43-
}
44-
45-
return version;
46-
}
47-
48-
/*
49-
* Checks if JupyterLab extensions listed in package.json
50-
* are properly included into the bundle in "extensions/index.ts"
51-
*/
52-
function checkExtensionImports() {
53-
console.log('Checking for missing extension imports...');
54-
55-
const pkgjsonFileData = fs.existsSync(pkgjsonFilePath)
56-
? fs.readJSONSync(pkgjsonFilePath)
57-
: undefined;
58-
if (!pkgjsonFileData) {
59-
console.error('package.json not found!');
60-
process.exit(1);
61-
}
62-
63-
const extensions = pkgjsonFileData.jupyterlab.extensions;
64-
const mimeExtensions = pkgjsonFileData.jupyterlab.mimeExtensions;
65-
const extensionsFilePath = path.resolve(
66-
__dirname,
67-
`../src/browser/extensions/index.ts`
68-
);
69-
let extensionsFileContent = '';
70-
try {
71-
extensionsFileContent = fs.readFileSync(extensionsFilePath, 'utf8');
72-
} catch (e) {
73-
console.error('Error loading "extensions/index.ts"', e);
74-
}
75-
for (const extension of [...extensions, ...mimeExtensions]) {
76-
if (!extensionsFileContent.includes(`require('${extension}')`)) {
77-
console.error(`${extension} is not imported in "extensions/index.ts"`);
78-
process.exit(1);
79-
}
80-
}
81-
82-
console.log('All extensions are bundled correctly.');
83-
}
84-
8534
if (cli.flags.checkVersionMatch) {
8635
// parse application version
8736
const pkgjsonFileData = fs.existsSync(pkgjsonFilePath)
@@ -139,115 +88,3 @@ if (cli.flags.checkVersionMatch) {
13988
console.log('JupyterLab version match satisfied!');
14089
process.exit(0);
14190
}
142-
143-
if (cli.flags.setJupyterlabVersion !== '') {
144-
const https = require('https');
145-
const newVersion = cli.flags.setJupyterlabVersion;
146-
console.log(`Downloading JupyterLab v${newVersion} package.json`);
147-
148-
const url = `https://raw.githubusercontent.com/jupyterlab/jupyterlab/v${newVersion}/jupyterlab/staging/package.json`;
149-
150-
https
151-
.get(url, res => {
152-
let body = '';
153-
154-
res.on('data', chunk => {
155-
body += chunk;
156-
});
157-
158-
res.on('end', () => {
159-
try {
160-
let newPkgData = JSON.parse(body);
161-
if (!(newPkgData.devDependencies && newPkgData.resolutions)) {
162-
console.error(`Invalid package.json format for v${newVersion}!`);
163-
process.exit(1);
164-
}
165-
166-
const newResolutions = { ...newPkgData.resolutions };
167-
const newDependencies = {
168-
...newPkgData.devDependencies,
169-
...newResolutions
170-
};
171-
172-
const pkgjsonFileData = fs.existsSync(pkgjsonFilePath)
173-
? fs.readJSONSync(pkgjsonFilePath)
174-
: undefined;
175-
if (!pkgjsonFileData) {
176-
console.error('package.json not found!');
177-
process.exit(1);
178-
}
179-
180-
const oldDependencies = pkgjsonFileData.dependencies;
181-
182-
for (const packageName in oldDependencies) {
183-
if (
184-
packageName.startsWith('@jupyterlab') &&
185-
packageName in newDependencies
186-
) {
187-
oldDependencies[packageName] = makeVersionAbsolute(
188-
newDependencies[packageName]
189-
);
190-
}
191-
}
192-
193-
// copy resolutions and singleton packages as-is
194-
pkgjsonFileData.resolutions = newResolutions;
195-
pkgjsonFileData.singletonPackages = newPkgData.singletonPackages;
196-
197-
fs.writeFileSync(
198-
pkgjsonFilePath,
199-
JSON.stringify(pkgjsonFileData, null, 2)
200-
);
201-
202-
console.log(`JupyterLab dependencies updated to v${newVersion}`);
203-
204-
checkExtensionImports();
205-
206-
// Check if all extensions of the new JupyterLab version are
207-
// bundled into the application
208-
console.log('Checking for extension list match...');
209-
const extensions = pkgjsonFileData.jupyterlab.extensions;
210-
const mimeExtensions = pkgjsonFileData.jupyterlab.mimeExtensions;
211-
const excludedExtensions =
212-
pkgjsonFileData.jupyterlab.excludedExtensions;
213-
214-
const extensionSet = new Set([...extensions, ...excludedExtensions]);
215-
const mimeExtensionSet = new Set([
216-
...mimeExtensions,
217-
...excludedExtensions
218-
]);
219-
220-
for (const extension in newPkgData.jupyterlab.extensions) {
221-
if (!extensionSet.has(extension)) {
222-
console.error(
223-
`JupyterLab v${newVersion} ${extension} is not bundled into the application!`
224-
);
225-
process.exit(1);
226-
}
227-
}
228-
229-
for (const extension in newPkgData.jupyterlab.mimeExtensions) {
230-
if (!mimeExtensionSet.has(extension)) {
231-
console.error(
232-
`JupyterLab v${newVersion} ${extension} is not bundled into the application!`
233-
);
234-
process.exit(1);
235-
}
236-
}
237-
238-
console.log(
239-
'All extensions in the new version are bundled correctly.'
240-
);
241-
242-
process.exit(0);
243-
} catch (error) {
244-
console.error(error.message);
245-
process.exit(1);
246-
}
247-
});
248-
})
249-
.on('error', error => {
250-
console.error(error.message);
251-
process.exit(1);
252-
});
253-
}

0 commit comments

Comments
 (0)