Skip to content

Commit

Permalink
Use babel to publish source tree as before (visgl#318)
Browse files Browse the repository at this point in the history
  • Loading branch information
ibgreen authored and Shaojing Li committed Mar 8, 2017
1 parent 7baba35 commit f1bb5ed
Show file tree
Hide file tree
Showing 8 changed files with 509 additions and 60 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
dist/*
dist-es6/*
dist-demo/*
demo/dist/*
build/*
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ Ref: http://keepachangelog.com/en/0.3.0/

## Recent Dev Releases

#### [v3.1.0-beta.15] -
CHANGE: Revert to babel compilation to expose the dist file tree rather than a bundle

#### [v3.1.0-beta.14] -
FIX: GeoJson path layer
FIX: defaultProps handling
Expand Down
2 changes: 1 addition & 1 deletion examples/main/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const LOCAL_DEVELOPMENT_CONFIG = {
resolve: {
alias: {
// Imports the deck.gl library from the src directory in this repo
'deck.gl': resolve('../../src'),
'deck.gl': resolve('../../dist'),
// Important: ensure shared dependencies come from this app's node_modules
'luma.gl': resolve('./node_modules/luma.gl'),
react: resolve('./node_modules/react')
Expand Down
24 changes: 18 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "deck.gl",
"description": "A suite of 3D-enabled data visualization overlays, suitable for react-map-gl",
"license": "MIT",
"version": "3.1.0-beta.14",
"version": "3.1.0-beta.15",
"keywords": [
"webgl",
"visualization",
Expand All @@ -13,20 +13,26 @@
"type": "git",
"url": "https://github.com/uber/deck.gl.git"
},
"main": "dist/lib-bundle.js",
"main": "dist/index.js",
"module": "dist-es6/index.js",
"files": [
"dist",
"dist-es6",
"src"
],
"scripts": {
"start": "(cd examples/main && yarn && npm start)",
"compile": "rm -fr dist && buble src -o dist --no modules --y dangerousForOf --objectAssign",
"build": "npm run compile && webpack -d --display-modules",
"build-clean": "rm -fr dist dist-es6 && mkdir -p dist dist-es6 ",
"build-shaders": "rm -fr dist-es6 && mkdir -p dist-es6 && babel src --out-dir dist-es6 --plugins=static-fs",
"build-babel": "rm -fr dist && babel src --out-dir dist --presets=es2015 --plugins=static-fs --source-maps inline",
"build-buble": "buble dist-es6 -o dist --no modules --y dangerousForOf --objectAssign",
"build": "npm run build-clean && npm run build-shaders && npm run build-babel && webpack -d --display-modules",
"lint": "eslint src test exhibits/app.js examples",
"publish-prod": "npm run build && npm run test && npm publish",
"publish-beta": "npm run build && npm run test && npm publish --tag beta",
"publish-prod": "npm run build && npm run test && npm run test-dist && npm publish",
"publish-beta": "npm run build && npm run test && npm run test-dist && npm publish --tag beta",
"test": "npm run lint && npm run test-node",
"test-node": "node test/node.js",
"test-dist": "node test/node-dist.js",
"test-browser": "webpack-dev-server --config webpack.config.test-browser.js --progress --hot --open --port 3010",
"bench": "node test/bench/node.js",
"bench-browser": "webpack-dev-server --config webpack.config.bench-browser.js --progress --hot --open --port 3011",
Expand All @@ -42,7 +48,13 @@
"viewport-mercator-project": "3.0.0-beta4"
},
"devDependencies": {
"babel-cli": "^6.22.2",
"babel-core": "^6.22.1",
"babel-loader": "^6.2.10",
"babel-plugin-static-fs": "^1.1.0",
"babel-plugin-transform-es2015-modules-commonjs": "^6.22.0",
"babel-polyfill": "^6.20.0",
"babel-preset-es2015": "^6.22.0",
"benchmark": "^2.1.3",
"brfs-babel": "^1.0.0",
"buble": "^0.15.1",
Expand Down
19 changes: 18 additions & 1 deletion test/lib/layer.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ SubLayer.defaultProps = {
getColor: x => x.color
};

class SubLayer2 extends Layer {}
SubLayer2.layerName = 'SubLayer2';

class SubLayer3 extends Layer {}
SubLayer3.layerName = 'SubLayer2';

test('Layer#mergeDefaultProps', t => {
class A {}
A.defaultProps = {a: 1};
Expand Down Expand Up @@ -60,13 +66,24 @@ test('SubLayer#constructor', t => {
t.end();
});

test('SubLayer2#constructor (no defaultProps)', t => {
const layer = new SubLayer2(LAYER_PROPS);
t.ok(layer, 'SubLayer2 created');
t.end();
});

test('SubLayer3#constructor (no layerName, no defaultProps)', t => {
const layer = new SubLayer3(LAYER_PROPS);
t.ok(layer, 'SubLayer3 created');
t.end();
});

// test('Layer#constructor with bad or missing props', t => {
// t.throws(
// () => new Layer({...LAYER_PROPS, zoom: undefined}),
// /Property zoom undefined in layer testLayer/,
// 'Expected invalid prop to throw an error'
// );

// t.end();
// });

Expand Down
21 changes: 21 additions & 0 deletions test/node-dist.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Enables ES2015 import/export in Node.js
require('reify');

// Enables import of glsl
const fs = require('fs');
require.extensions['.glsl'] = function readShader(module, filename) {
module.exports = fs.readFileSync(filename, 'utf8');
};

// Registers an alias for this module
const path = require('path');
const moduleAlias = require('module-alias');
moduleAlias.addAlias('deck.gl', path.resolve('./dist'));

require('babel-polyfill');

// Import headless luma support
require('luma.gl/headless');

// Run the tests
require('./index');
26 changes: 13 additions & 13 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,19 @@ module.exports = {
return "module.exports = " + JSON.stringify(content); // eslint-disable-line
}
},
{
// Compile ES2015 using buble
test: /\.js$/,
loader: 'buble-loader',
include: [/src/],
options: {
objectAssign: 'Object.assign',
transforms: {
dangerousForOf: true,
modules: false
}
}
},
// {
// // Compile ES2015 using buble
// test: /\.js$/,
// loader: 'buble-loader',
// include: [/src/],
// options: {
// objectAssign: 'Object.assign',
// transforms: {
// dangerousForOf: true,
// modules: false
// }
// }
// },
{
// Inline shaders
include: [resolve('./src')],
Expand Down
Loading

0 comments on commit f1bb5ed

Please sign in to comment.