Skip to content

Commit

Permalink
Merge pull request #539 from Kitware/fat-bundle
Browse files Browse the repository at this point in the history
Create a "fat bundle" for use without webpack, etc.
  • Loading branch information
waxlamp committed May 14, 2018
2 parents 7dacf70 + 8b9e529 commit f46cc9f
Show file tree
Hide file tree
Showing 34 changed files with 212 additions and 123 deletions.
5 changes: 4 additions & 1 deletion circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,12 @@ compile:
# Build Candela.
- npm run build

# Build the examples.
# Build the examples package.
- npm run build:examples

# Build the big bundle.
- npm run build:bundle

# Build the unit test and coverage test bundles.
- npm run build:test
- npm run build:coverage
Expand Down
15 changes: 8 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,19 @@
"scripts": {
"install": "lerna bootstrap --hoist",
"clean:lerna": "lerna clean",
"clean:dist": "bash scripts/clean-all",
"build": "bash scripts/build-all",
"clean": "lerna run clean",
"build": "lerna run build --ignore @candela/examples --ignore @candela/all",
"build:examples": "cd packages/examples && npm run build",
"build:bundle": "cd packages/all && npm run build",
"examples": "cd packages/examples && npm run serve",
"build:test": "bash scripts/build-test",
"build:coverage": "COVERAGE=1 bash scripts/build-test",
"test:unit": "bash scripts/run-test",
"build:test": "lerna run build:test",
"build:coverage": "COVERAGE=1 npm run build:test",
"test:unit": "lerna run test --ignore @candela/examples",
"test:image": "cd packages/examples && npm test",
"test:coverage": "COVERAGE=1 bash scripts/run-test",
"test:coverage": "COVERAGE=1 npm run test:unit",
"coverage:report": "http-server build/coverage/html -p ${PORT-3000}",
"build:docs": "sphinx-build -a -b html docs/ build/docs/",
"lint": "bash scripts/run-lint",
"lint": "lerna run lint --ignore @candela/trackerdash",
"lint:pycandela": "flake8 --config python/pycandela/flake8.cfg python/pycandela",
"docs": "http-server build/docs -p ${PORT-3000}",
"commit": "git-cz",
Expand Down
4 changes: 4 additions & 0 deletions packages/all/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Change Log

All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
62 changes: 62 additions & 0 deletions packages/all/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
"name": "@candela/all",
"version": "0.20.0",
"description": "Candela all-inclusive library",
"main": "dist/candela-all.js",
"scripts": {
"build": "webpack --mode development",
"clean": "rm -rf dist build",
"lint": "semistandard | snazzy"
},
"publishConfig": {
"access": "public"
},
"babel": {
"presets": [
"@babel/env"
]
},
"keywords": [],
"author": "Kitware Inc.",
"license": "Apache-2.0",
"semistandard": {
"ignore": [
"dist",
"build"
]
},
"dependencies": {
"@candela/core": "^0.20.0",
"@candela/events": "^0.20.0",
"@candela/geojs": "^0.20.0",
"@candela/glo": "^0.20.0",
"@candela/lineup": "^0.20.0",
"@candela/onset": "^0.20.0",
"@candela/sententree": "^0.20.0",
"@candela/similaritygraph": "^0.20.0",
"@candela/size": "^0.20.0",
"@candela/stats": "^0.20.0",
"@candela/treeheatmap": "^0.20.0",
"@candela/upset": "^0.20.0",
"@candela/vega": "^0.20.0"
},
"devDependencies": {
"@babel/core": "^7.0.0-beta.44",
"@babel/preset-env": "^7.0.0-beta.44",
"@babel/register": "^7.0.0-beta.44",
"babel-loader": "^8.0.0-beta.2",
"istanbul-instrumenter-loader": "^3.0.1",
"karma": "^2.0.2",
"karma-chrome-launcher": "^2.2.0",
"karma-coverage-istanbul-reporter": "^1.4.2",
"karma-tap": "^4.1.3",
"karma-tap-pretty-reporter": "^4.0.0",
"semistandard": "^7.0.5",
"snazzy": "^4.0.0",
"tap-spec": "^4.1.1",
"tape": "^4.9.0",
"tape-catch": "^1.0.6",
"webpack": "^4.6.0",
"webpack-cli": "^2.0.14"
}
}
53 changes: 53 additions & 0 deletions packages/all/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import * as core from '@candela/core';
import * as events from '@candela/events';
import * as geojs from '@candela/geojs';
import * as glo from '@candela/glo';
import * as lineup from '@candela/lineup';
import * as onset from '@candela/onset';
import * as sententree from '@candela/sententree';
import * as similaritygraph from '@candela/similaritygraph';
import * as size from '@candela/size';
import * as stats from '@candela/stats';
import * as treeheatmap from '@candela/treeheatmap';
import * as upset from '@candela/upset';
import * as vega from '@candela/vega';

function load (obj, target) {
for (let prop in obj) {
target[prop] = obj[prop];
}
}

// Collect all candela components into a single object.
let components = {};
for (let bundle of [geojs, glo, lineup, onset, sententree, similaritygraph, stats, treeheatmap, upset]) {
load(bundle, components);
}
for (let component in vega) {
if (vega[component] !== vega.VegaView) {
components[component] = vega[component];
}
}

// Collect all candela mixings into a single object.
let mixins = {};
for (let bundle of [events, size]) {
load(bundle, mixins);
}
mixins.VegaView = vega.VegaView;

let VisComponent = core.VisComponent;

// Export everything, both as default...
export default {
VisComponent,
components,
mixins
};

// ...and non-default.
export {
VisComponent,
components,
mixins
};
26 changes: 26 additions & 0 deletions packages/all/webpack.config.babel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import path from 'path';

export default {
entry: './src/index.js',
output: {
libraryTarget: 'umd',
path: path.resolve('dist'),
filename: 'candela-all.js'
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: [
'@babel/env'
]
}
}
}
]
}
};
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"clean": "rm -rf dist build",
"lint": "semistandard | snazzy",
"build:test": "webpack --config webpack.config.test.babel.js --mode development",
"test": "karma start --log-level error"
"test": "karma start --colors --log-level error"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/events/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"clean": "rm -rf dist build",
"lint": "semistandard | snazzy",
"build:test": "webpack --config webpack.config.test.babel.js --mode development",
"test": "karma start --log-level error"
"test": "karma start --colors --log-level error"
},
"publishConfig": {
"access": "public"
Expand Down
4 changes: 2 additions & 2 deletions packages/examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
"babel-loader": "^8.0.0-beta.2",
"callsite": "^1.0.0",
"css-loader": "^0.28.11",
"d3-selection": "^1.3.0",
"datalib": "^1.8.0",
"d3-selection": "^1.1.0",
"datalib": "^1.7.3",
"html-webpack-plugin": "^3.2.0",
"http-server": "^0.11.1",
"jade": "^1.11.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/treeheatmap/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { heatmap } from '../datasets';
import showComponent from '../util/showComponent';

window.onload = () => {
showComponent(TreeHeatmap, {
const vis = showComponent(TreeHeatmap, {
data: heatmap,
scale: 'column'
});
Expand Down
2 changes: 1 addition & 1 deletion packages/geojs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"clean": "rm -rf dist build",
"lint": "semistandard | snazzy",
"build:test": "webpack --config webpack.config.test.babel.js --mode development",
"test": "karma start --log-level error"
"test": "karma start --colors --log-level error"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/glo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"clean": "rm -rf dist build",
"lint": "semistandard | snazzy",
"build:test": "webpack --config webpack.config.test.babel.js --mode development",
"test": "karma start --log-level error"
"test": "karma start --colors --log-level error"
},
"publishConfig": {
"access": "public"
Expand Down
4 changes: 2 additions & 2 deletions packages/lineup/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"clean": "rm -rf dist build",
"lint": "semistandard | snazzy",
"build:test": "webpack --config webpack.config.test.babel.js --mode development",
"test": "karma start --log-level error"
"test": "karma start --colors --log-level error"
},
"publishConfig": {
"access": "public"
Expand Down Expand Up @@ -41,7 +41,7 @@
"@babel/register": "^7.0.0-beta.44",
"@candela/core": "^0.20.1",
"babel-loader": "^8.0.0-beta.2",
"css-loader": "^0.26.1",
"css-loader": "^0.28.11",
"file-loader": "^1.1.11",
"istanbul-instrumenter-loader": "^3.0.1",
"karma": "^2.0.2",
Expand Down
10 changes: 7 additions & 3 deletions packages/lineup/webpack.config.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@ export default {
path: path.resolve('dist'),
filename: 'candela-lineup.js'
},
externals: {
d3: 'd3'
},
externals: [
'@candela/core',
'd3',
'datalib',
'jquery',
'lineupjs'
],
module: {
rules: [
{
Expand Down
2 changes: 1 addition & 1 deletion packages/onset/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"clean": "rm -rf dist build",
"lint": "semistandard | snazzy",
"build:test": "webpack --config webpack.config.test.babel.js --mode development",
"test": "karma start --log-level error"
"test": "karma start --colors --log-level error"
},
"publishConfig": {
"access": "public"
Expand Down
9 changes: 6 additions & 3 deletions packages/onset/webpack.config.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@ export default {
path: path.resolve('dist'),
filename: 'candela-onset.js'
},
externals: {
d3: 'd3'
},
externals: [
'@candela/core',
'd3',
'datalib',
'onset'
],
module: {
rules: [
{
Expand Down
2 changes: 1 addition & 1 deletion packages/sententree/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"clean": "rm -rf dist build",
"lint": "semistandard | snazzy",
"build:test": "webpack --config webpack.config.test.babel.js --mode development",
"test": "karma start --log-level error"
"test": "karma start --colors --log-level error"
},
"publishConfig": {
"access": "public"
Expand Down
4 changes: 4 additions & 0 deletions packages/sententree/webpack.config.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ export default {
path: path.resolve('dist'),
filename: 'candela-sententree.js'
},
externals: [
'@candela/core',
'sententree'
],
module: {
rules: [
{
Expand Down
2 changes: 1 addition & 1 deletion packages/similaritygraph/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"clean": "rm -rf dist build",
"lint": "semistandard | snazzy",
"build:test": "webpack --config webpack.config.test.babel.js --mode development",
"test": "karma start --log-level error"
"test": "karma start --colors --log-level error"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/size/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"clean": "rm -rf dist build",
"lint": "semistandard | snazzy",
"build:test": "webpack --config webpack.config.test.babel.js --mode development",
"test": "karma start --log-level error"
"test": "karma start --colors --log-level error"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/stats/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"clean": "rm -rf dist build",
"lint": "semistandard | snazzy",
"build:test": "webpack --config webpack.config.test.babel.js --mode development",
"test": "karma start --log-level error"
"test": "karma start --colors --log-level error"
},
"publishConfig": {
"access": "public"
Expand Down
1 change: 0 additions & 1 deletion packages/trackerdash/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"description": "Candela components for the TrackerDash dashboard",
"main": "dist/candela-trackerdash.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "webpack --mode development",
"clean": "rm -rf dist build",
"lint": "semistandard | snazzy"
Expand Down
2 changes: 1 addition & 1 deletion packages/treeheatmap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"clean": "rm -rf dist build",
"lint": "semistandard | snazzy",
"build:test": "webpack --config webpack.config.test.babel.js --mode development",
"test": "karma start --log-level error"
"test": "karma start --colors --log-level error"
},
"publishConfig": {
"access": "public"
Expand Down
8 changes: 8 additions & 0 deletions packages/treeheatmap/webpack.config.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ export default {
path: path.resolve('dist'),
filename: 'candela-treeheatmap.js'
},
externals: [
'@candela/core',
'd3-array',
'd3-scale',
'd3-selection',
'd3-shape',
'd3-transition'
],
module: {
rules: [
{
Expand Down
2 changes: 1 addition & 1 deletion packages/upset/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"clean": "rm -rf dist build",
"lint": "semistandard | snazzy",
"build:test": "webpack --config webpack.config.test.babel.js --mode development",
"test": "karma start --log-level error"
"test": "karma start --colors --log-level error"
},
"publishConfig": {
"access": "public"
Expand Down

0 comments on commit f46cc9f

Please sign in to comment.