Skip to content

Commit

Permalink
Build Vega bundles separately from other code
Browse files Browse the repository at this point in the history
This fixes jupyterlab#6709, and is a follow up to jupyterlab#6572. It separates building
vega assets from the rest of our package management. That way, we can
avoid any hoisting issues that we were seeing (possibly from yarnpkg/yarn#5520).

To test this, you can try this notebook which should render
both versions without errors:

https://gist.github.com/saulshanabrook/97c28550ab12e684adc3c325038537ce
  • Loading branch information
saulshanabrook committed Jun 26, 2019
1 parent e486e63 commit dfc6eea
Show file tree
Hide file tree
Showing 10 changed files with 6,705 additions and 915 deletions.
12 changes: 3 additions & 9 deletions package.json
Expand Up @@ -15,14 +15,6 @@
"tests/test-*",
"testutils",
"jupyterlab/tests/mock_packages/extension"
],
"nohoist": [
"**/vega-embed",
"**/vega-lite",
"**/vega",
"**/vega-embed/**",
"**/vega-lite/**",
"**/vega/**"
]
},
"scripts": {
Expand All @@ -40,7 +32,9 @@
"build:test": "lerna run build --scope \"@jupyterlab/test-*\" --concurrency 1",
"build:testutils": "cd testutils && jlpm run build",
"build:utils": "cd buildutils && jlpm run build",
"build:vega": "lerna run build:webpack --scope \"@jupyterlab/vega*-extension\" --concurrency 1",
"build:vega": "jlpm run build:vega:4 && jlpm run build:vega:5",
"build:vega:4": "cd prebuild/vega4 && jlpm && jlpm run build",
"build:vega:5": "cd prebuild/vega5 && jlpm && jlpm run build",
"bump:js:major": "node buildutils/lib/bump-js-major.js",
"bumpversion": "node buildutils/lib/bumpversion.js",
"clean": "jlpm run clean:dev && jlpm run clean:packages",
Expand Down
8 changes: 2 additions & 6 deletions packages/vega4-extension/package.json
Expand Up @@ -27,8 +27,7 @@
"lib": "lib/"
},
"scripts": {
"build": "tsc -b && webpack",
"build:webpack": "webpack",
"build": "tsc -b",
"clean": "rimraf lib",
"docs": "typedoc --options tdoptions.json --theme ../../typedoc-theme src",
"prepublishOnly": "npm run build",
Expand All @@ -44,10 +43,7 @@
"rimraf": "~2.6.2",
"typedoc": "^0.14.2",
"typescript": "~3.5.1",
"vega": "^4.4.0",
"vega-embed": "^4.2.0",
"vega-lite": "^2.7.0",
"webpack": "^4.32.2"
"vega-embed": "^4.2.0"
},
"publishConfig": {
"access": "public"
Expand Down
8 changes: 2 additions & 6 deletions packages/vega5-extension/package.json
Expand Up @@ -27,8 +27,7 @@
"lib": "lib/"
},
"scripts": {
"build": "tsc -b && webpack",
"build:webpack": "webpack",
"build": "tsc -b",
"clean": "rimraf lib",
"docs": "typedoc --options tdoptions.json --theme ../../typedoc-theme src",
"prepublishOnly": "npm run build",
Expand All @@ -44,10 +43,7 @@
"rimraf": "~2.6.2",
"typedoc": "^0.14.2",
"typescript": "~3.5.1",
"vega": "^5.4.0",
"vega-embed": "^4.2.0",
"vega-lite": "^3.3.0",
"webpack": "^4.32.2"
"vega-embed": "^4.2.0"
},
"publishConfig": {
"access": "public"
Expand Down
16 changes: 16 additions & 0 deletions prebuild/vega4/package.json
@@ -0,0 +1,16 @@
{
"name": "",
"version": "",
"scripts": {
"build": "webpack"
},
"devDependencies": {
"vega": "^4.4.0",
"vega-embed": "^4.2.0",
"vega-lite": "^2.7.0",
"webpack": "^4.32.2"
},
"publishConfig": {
"access": "private"
}
}
19 changes: 19 additions & 0 deletions prebuild/vega4/webpack.config.js
@@ -0,0 +1,19 @@
var path = require('path');

module.exports = {
entry: 'vega-embed',
mode: 'production',
devtool: 'source-map',
output: {
path: path.resolve(
__dirname,
'..',
'..',
'packages',
'vega4-extension',
'lib'
),
filename: 'built-vega-embed.js',
libraryTarget: 'commonjs2'
}
};

0 comments on commit dfc6eea

Please sign in to comment.