Add script to link schemas

pull/6294/head
Jeremy Tuloup 4 years ago
parent c037d1affa
commit efa9740494

@ -24,8 +24,8 @@ conda activate retrolab
# Install package in development mode
pip install -e .
# Link the RetroLab JupyterLab extension
jupyter labextension develop . --overwrite
# Link the RetroLab JupyterLab extension and RetroLab schemas
jlpm develop
# Enable the server extension
jupyter server extension enable retrolab

@ -1,4 +1,8 @@
#!/bin/bash
set -euo pipefail
python -m pip install .
jlpm && jlpm run build
python -m pip install -e .
jlpm run develop
jupyter server extension enable retrolab
jupyter serverextension enable retrolab

@ -0,0 +1,51 @@
/* -----------------------------------------------------------------------------
| Copyright (c) Jupyter Development Team.
| Distributed under the terms of the Modified BSD License.
|----------------------------------------------------------------------------*/
import commander from 'commander';
import fs from 'fs-extra';
import path from 'path';
import process from 'process';
import { run } from '@jupyterlab/buildutils';
commander
.description('Setup the repository for develop mode')
.option('--overwrite', 'Force linking the RetroLab schemas')
.option('--source', 'The path to the retrolab package')
.action((options: any) => {
const { overwrite } = options;
const prefix = run(
'python -c "import sys; print(sys.prefix)"',
{
stdio: 'pipe'
},
true
);
const source = path.resolve(options.source ?? process.cwd());
const sourceDir = path.join(source, 'retrolab', 'schemas', '@retrolab');
const destDir = path.join(
prefix,
'share',
'jupyter',
'lab',
'schemas',
'@retrolab'
);
if (overwrite) {
try {
fs.unlinkSync(destDir);
console.log('Removed previous symlink:', destDir);
} catch (e) {
console.info('Skip unlinkink', destDir);
}
}
console.log('Symlinking:', sourceDir, destDir);
fs.symlinkSync(sourceDir, destDir, 'dir');
});
commander.parse(process.argv);

@ -26,6 +26,7 @@
"clean": "lerna run clean",
"eslint": "eslint . --ext .ts,.tsx --fix",
"eslint:check": "eslint . --ext .ts,.tsx",
"develop": "jupyter labextension develop . --overwrite && node ./buildutils/lib/develop.js --overwrite",
"install": "lerna bootstrap",
"integrity": "node buildutils/lib/ensure-repo.js",
"prettier": "prettier --write \"**/*{.ts,.tsx,.js,.jsx,.css,.json,.md}\"",

Loading…
Cancel
Save