From e941a2ad2b1226f5aadebaba529b21ba3089ab7a Mon Sep 17 00:00:00 2001 From: Jeremy Tuloup Date: Tue, 20 Apr 2021 12:11:00 +0200 Subject: [PATCH] Add watch mode --- CONTRIBUTING.md | 8 +- app/package.json | 2 +- app/webpack.config.watch.js | 17 ++++ package.json | 6 +- packages/_metapackage/package.json | 36 ++++++++ packages/_metapackage/src/index.ts | 9 ++ packages/_metapackage/tsconfig.json | 19 +++++ yarn.lock | 127 ++++++++++++++++++++++++++++ 8 files changed, 221 insertions(+), 3 deletions(-) create mode 100644 app/webpack.config.watch.js create mode 100644 packages/_metapackage/package.json create mode 100644 packages/_metapackage/src/index.ts create mode 100644 packages/_metapackage/tsconfig.json diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 08f94037..7014ea3c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -28,7 +28,13 @@ pip install -e . `jupyterlab-classic` follows a monorepo structure. To build all the packages at once: ```bash -jlpm run build +jlpm build +``` + +There is also a `watch` script to watch for changes and rebuild the app automatically: + +```bash +jlpm watch ``` To make sure the `jupyterlab_classic` server extension is installed: diff --git a/app/package.json b/app/package.json index fef2e17f..bc91de84 100644 --- a/app/package.json +++ b/app/package.json @@ -15,7 +15,7 @@ "test:debug:watch": "node --inspect-brk node_modules/.bin/jest --runInBand --watch", "test:e2e": "jlpm run clean:artifacts && jest", "test:e2e:pwdebug": "jlpm run clean:artifacts && PWDEBUG=1 jlpm run test:e2e", - "watch": "webpack --watch" + "watch": "webpack --config ./webpack.config.watch.js" }, "resolutions": { "@jupyterlab-classic/application": "~0.1.10", diff --git a/app/webpack.config.watch.js b/app/webpack.config.watch.js new file mode 100644 index 00000000..afebfa64 --- /dev/null +++ b/app/webpack.config.watch.js @@ -0,0 +1,17 @@ +const base = require('./webpack.config'); +const ExtraWatchWebpackPlugin = require('extra-watch-webpack-plugin'); + +module.exports = [ + { + ...base[0], + bail: false, + watch: true, + plugins: [ + ...base[0].plugins, + new ExtraWatchWebpackPlugin({ + files: ['../packages/_metapackage/tsconfig.tsbuildinfo'] + }) + ] + }, + ...base.slice(1) +]; diff --git a/package.json b/package.json index 5f94305e..0accd6b7 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,10 @@ "test": "lerna run test", "test:e2e": "lerna run test:e2e --stream", "test:ci": "(jlpm run start&) && jlpm run test:e2e", - "update:dependency": "node ./node_modules/@jupyterlab/buildutils/lib/update-dependency.js --lerna" + "update:dependency": "node ./node_modules/@jupyterlab/buildutils/lib/update-dependency.js --lerna", + "watch": "run-p watch:lib watch:app", + "watch:lib": "lerna exec --stream --scope @jupyterlab-classic/metapackage jlpm watch", + "watch:app": "lerna exec --stream --scope \"@jupyterlab-classic/app\" jlpm watch" }, "husky": { "hooks": { @@ -52,6 +55,7 @@ "eslint-plugin-jest": "^24.1.3", "eslint-plugin-prettier": "^3.1.4", "eslint-plugin-react": "^7.21.5", + "extra-watch-webpack-plugin": "^1.0.3", "husky": "^3", "jest": "^26.4.2", "jest-junit": "^11.1.0", diff --git a/packages/_metapackage/package.json b/packages/_metapackage/package.json new file mode 100644 index 00000000..7b73cd56 --- /dev/null +++ b/packages/_metapackage/package.json @@ -0,0 +1,36 @@ +{ + "name": "@jupyterlab-classic/metapackage", + "private": true, + "version": "0.1.0", + "description": "JupyterLab Classic - Metapackage", + "homepage": "https://github.com/jtpio/jupyterlab-classic", + "bugs": { + "url": "https://github.com/jtpio/jupyterlab-classic/issues" + }, + "repository": { + "type": "git", + "url": "https://github.com/jtpio/jupyterlab-classic.git" + }, + "license": "BSD-3-Clause", + "author": "JupyterLab Classic Contributors", + "main": "lib/index.js", + "types": "lib/index.d.ts", + "scripts": { + "build": "tsc -b", + "watch": "tsc -b -w --preserveWatchOutput" + }, + "dependencies": { + "@jupyterlab-classic/application": "file:../application", + "@jupyterlab-classic/application-extension": "file:../application-extension", + "@jupyterlab-classic/docmanager-extension": "file:../docmanager-extension", + "@jupyterlab-classic/help-extension": "file:../help-extension", + "@jupyterlab-classic/lab-extension": "file:../lab-extension", + "@jupyterlab-classic/notebook-extension": "file:../notebook-extension", + "@jupyterlab-classic/terminal-extension": "file:../terminal-extension", + "@jupyterlab-classic/tree-extension": "file:../tree-extension", + "@jupyterlab-classic/ui-components": "file:../ui-components" + }, + "devDependencies": { + "typescript": "~4.1.3" + } +} diff --git a/packages/_metapackage/src/index.ts b/packages/_metapackage/src/index.ts new file mode 100644 index 00000000..6f0050b2 --- /dev/null +++ b/packages/_metapackage/src/index.ts @@ -0,0 +1,9 @@ +import '@jupyterlab-classic/application'; +import '@jupyterlab-classic/application-extension'; +import '@jupyterlab-classic/docmanager-extension'; +import '@jupyterlab-classic/help-extension'; +import '@jupyterlab-classic/lab-extension'; +import '@jupyterlab-classic/notebook-extension'; +import '@jupyterlab-classic/terminal-extension'; +import '@jupyterlab-classic/tree-extension'; +import '@jupyterlab-classic/ui-components'; diff --git a/packages/_metapackage/tsconfig.json b/packages/_metapackage/tsconfig.json new file mode 100644 index 00000000..ac5fbae6 --- /dev/null +++ b/packages/_metapackage/tsconfig.json @@ -0,0 +1,19 @@ +{ + "extends": "../../tsconfigbase", + "compilerOptions": { + "outDir": "lib", + "rootDir": "src" + }, + "include": ["src/**/*"], + "references": [ + { "path": "../application" }, + { "path": "../application-extension" }, + { "path": "../docmanager-extension" }, + { "path": "../help-extension" }, + { "path": "../lab-extension" }, + { "path": "../notebook-extension" }, + { "path": "../terminal-extension" }, + { "path": "../tree-extension" }, + { "path": "../ui-components" } + ] +} diff --git a/yarn.lock b/yarn.lock index 97d3944d..70492975 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1195,6 +1195,115 @@ "@types/yargs" "^15.0.0" chalk "^4.0.0" +"@jupyterlab-classic/application-extension@file:packages/application-extension": + version "0.1.10" + dependencies: + "@jupyterlab-classic/application" "^0.1.10" + "@jupyterlab-classic/ui-components" "^0.1.10" + "@jupyterlab/application" "^3.0.0" + "@jupyterlab/apputils" "^3.0.0" + "@jupyterlab/celltags" "^3.0.0" + "@jupyterlab/codeeditor" "^3.0.0" + "@jupyterlab/codemirror" "^3.0.0" + "@jupyterlab/coreutils" "^5.0.0" + "@jupyterlab/docmanager" "^3.0.0" + "@jupyterlab/docregistry" "^3.0.0" + "@jupyterlab/mainmenu" "^3.0.0" + "@jupyterlab/settingregistry" "^3.0.0" + "@jupyterlab/translation" "^3.0.0" + "@lumino/widgets" "^1.14.0" + +"@jupyterlab-classic/application@file:packages/application": + version "0.1.10" + dependencies: + "@jupyterlab/application" "^3.0.0" + "@jupyterlab/coreutils" "^5.0.0" + "@jupyterlab/docregistry" "^3.0.0" + "@jupyterlab/rendermime-interfaces" "^3.0.0" + "@jupyterlab/ui-components" "^3.0.0" + "@lumino/algorithm" "^1.3.3" + "@lumino/coreutils" "^1.5.3" + "@lumino/messaging" "^1.4.3" + "@lumino/polling" "^1.3.3" + "@lumino/signaling" "^1.4.3" + "@lumino/widgets" "^1.14.0" + +"@jupyterlab-classic/docmanager-extension@file:packages/docmanager-extension": + version "0.1.10" + dependencies: + "@jupyterlab/application" "^3.0.0" + "@jupyterlab/coreutils" "^5.0.0" + "@jupyterlab/docmanager" "^3.0.0" + "@jupyterlab/docregistry" "^3.0.0" + "@jupyterlab/services" "^6.0.0" + "@lumino/algorithm" "^1.3.3" + +"@jupyterlab-classic/help-extension@file:packages/help-extension": + version "0.1.10" + dependencies: + "@jupyterlab-classic/ui-components" "^0.1.10" + "@jupyterlab/application" "^3.0.0" + "@jupyterlab/apputils" "^3.0.0" + "@jupyterlab/mainmenu" "^3.0.0" + +"@jupyterlab-classic/lab-extension@file:packages/lab-extension": + version "0.1.10" + dependencies: + "@jupyterlab-classic/ui-components" "^0.1.10" + "@jupyterlab/application" "^3.0.0" + "@jupyterlab/apputils" "^3.0.0" + "@jupyterlab/coreutils" "^5.0.0" + "@jupyterlab/docregistry" "^3.0.0" + "@jupyterlab/mainmenu" "^3.0.0" + "@jupyterlab/notebook" "^3.0.0" + "@lumino/commands" "^1.11.4" + "@lumino/disposable" "^1.4.3" + +"@jupyterlab-classic/notebook-extension@file:packages/notebook-extension": + version "0.1.10" + dependencies: + "@jupyterlab-classic/application" "^0.1.10" + "@jupyterlab/application" "^3.0.0" + "@jupyterlab/apputils" "^3.0.0" + "@jupyterlab/docmanager" "^3.0.0" + "@jupyterlab/notebook" "^3.0.0" + "@lumino/polling" "^1.3.3" + "@lumino/widgets" "^1.14.0" + +"@jupyterlab-classic/terminal-extension@file:packages/terminal-extension": + version "0.1.10" + dependencies: + "@jupyterlab/application" "^3.0.0" + "@jupyterlab/coreutils" "^5.0.0" + "@jupyterlab/terminal" "^3.0.0" + "@lumino/algorithm" "^1.3.3" + +"@jupyterlab-classic/tree-extension@file:packages/tree-extension": + version "0.1.10" + dependencies: + "@jupyterlab-classic/application" "^0.1.10" + "@jupyterlab/application" "^3.0.0" + "@jupyterlab/apputils" "^3.0.0" + "@jupyterlab/coreutils" "^5.0.0" + "@jupyterlab/docmanager" "^3.0.0" + "@jupyterlab/filebrowser" "^3.0.0" + "@jupyterlab/mainmenu" "^3.0.0" + "@jupyterlab/services" "^6.0.0" + "@jupyterlab/settingregistry" "^3.0.0" + "@jupyterlab/statedb" "^3.0.0" + "@jupyterlab/translation" "^3.0.0" + "@jupyterlab/ui-components" "^3.0.0" + "@lumino/algorithm" "^1.3.3" + "@lumino/commands" "^1.12.0" + "@lumino/widgets" "^1.16.1" + +"@jupyterlab-classic/ui-components@file:packages/ui-components": + version "0.1.10" + dependencies: + "@jupyterlab/ui-components" "^3.0.0" + react "^17.0.1" + react-dom "^17.0.1" + "@jupyterlab/application@^3.0.0", "@jupyterlab/application@^3.0.7": version "3.0.7" resolved "https://registry.yarnpkg.com/@jupyterlab/application/-/application-3.0.7.tgz#de5f237cf06b6a69ddbe308e1449726ae05936a0" @@ -6111,6 +6220,16 @@ extglob@^2.0.4: snapdragon "^0.8.1" to-regex "^3.0.1" +extra-watch-webpack-plugin@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/extra-watch-webpack-plugin/-/extra-watch-webpack-plugin-1.0.3.tgz#774248f4ac590159bd5878d862d77afce697d7cc" + integrity sha512-ZScQdMH6hNofRRN6QMQFg+aa5vqimfBgnPXmRDhdaLpttT6hrzpY9Oyren3Gh/FySPrgsvKCNbx/NFA7XNdIsg== + dependencies: + glob "^7.1.2" + is-glob "^4.0.0" + lodash.uniq "^4.5.0" + schema-utils "^0.4.0" + extract-zip@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/extract-zip/-/extract-zip-2.0.1.tgz#663dca56fe46df890d5f131ef4a06d22bb8ba13a" @@ -10711,6 +10830,14 @@ scheduler@^0.20.2: loose-envify "^1.1.0" object-assign "^4.1.1" +schema-utils@^0.4.0: + version "0.4.7" + resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-0.4.7.tgz#ba74f597d2be2ea880131746ee17d0a093c68187" + integrity sha512-v/iwU6wvwGK8HbU9yi3/nhGzP0yGSuhQMzL6ySiec1FSrZZDkhm4noOSWzrNFo/jEc+SJY6jRTwuwbSXJPDUnQ== + dependencies: + ajv "^6.1.0" + ajv-keywords "^3.1.0" + schema-utils@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-1.0.0.tgz#0b79a93204d7b600d4b2850d1f66c2a34951c770"