-
Notifications
You must be signed in to change notification settings - Fork 209
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build scripts and add metrics. (#1061)
- Loading branch information
Showing
30 changed files
with
1,370 additions
and
1,417 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/* global window, global */ | ||
const moduleExports = require('./index'); | ||
|
||
const _global = typeof window === 'undefined' ? global : window; | ||
_global.loaders = _global.luma || {}; | ||
|
||
module.exports = Object.assign(_global.luma, moduleExports); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/* global window, global */ | ||
const moduleExports = require('./index'); | ||
|
||
const _global = typeof window === 'undefined' ? global : window; | ||
_global.loaders = _global.luma || {}; | ||
|
||
module.exports = Object.assign(_global.luma, moduleExports); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/* global window, global */ | ||
const moduleExports = require('./index'); | ||
|
||
const _global = typeof window === 'undefined' ? global : window; | ||
_global.loaders = _global.luma || {}; | ||
|
||
module.exports = Object.assign(_global.luma, moduleExports); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/* global window, global */ | ||
const moduleExports = require('./index'); | ||
|
||
const _global = typeof window === 'undefined' ? global : window; | ||
_global.loaders = _global.luma || {}; | ||
|
||
module.exports = Object.assign(_global.luma, moduleExports); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/* global window, global */ | ||
const moduleExports = require('./index'); | ||
|
||
const _global = typeof window === 'undefined' ? global : window; | ||
_global.loaders = _global.luma || {}; | ||
|
||
module.exports = Object.assign(_global.luma, moduleExports); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/* global window, global */ | ||
const moduleExports = require('./index'); | ||
|
||
const _global = typeof window === 'undefined' ? global : window; | ||
_global.loaders = _global.luma || {}; | ||
|
||
module.exports = Object.assign(_global.luma, moduleExports); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/* global window, global */ | ||
const moduleExports = require('./index'); | ||
|
||
const _global = typeof window === 'undefined' ? global : window; | ||
_global.loaders = _global.luma || {}; | ||
|
||
module.exports = Object.assign(_global.luma, moduleExports); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/* global window, global */ | ||
const moduleExports = require('./index'); | ||
|
||
const _global = typeof window === 'undefined' ? global : window; | ||
_global.loaders = _global.luma || {}; | ||
|
||
module.exports = Object.assign(_global.luma, moduleExports); |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/* global window, global */ | ||
const moduleExports = require('./index'); | ||
|
||
const _global = typeof window === 'undefined' ? global : window; | ||
_global.loaders = _global.luma || {}; | ||
|
||
module.exports = Object.assign(_global.luma, moduleExports); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/* global window, global */ | ||
const moduleExports = require('./index'); | ||
|
||
const _global = typeof window === 'undefined' ? global : window; | ||
_global.loaders = _global.luma || {}; | ||
|
||
module.exports = Object.assign(_global.luma, moduleExports); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/* global window, global */ | ||
const moduleExports = require('./index'); | ||
|
||
const _global = typeof window === 'undefined' ? global : window; | ||
_global.loaders = _global.luma || {}; | ||
|
||
module.exports = Object.assign(_global.luma, moduleExports); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/* global window, global */ | ||
const moduleExports = require('./index'); | ||
|
||
const _global = typeof window === 'undefined' ? global : window; | ||
_global.loaders = _global.luma || {}; | ||
|
||
module.exports = Object.assign(_global.luma, moduleExports); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/* global window, global */ | ||
const moduleExports = require('./index'); | ||
|
||
const _global = typeof window === 'undefined' ? global : window; | ||
_global.loaders = _global.luma || {}; | ||
|
||
module.exports = Object.assign(_global.luma, moduleExports); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
const {resolve} = require('path'); | ||
const webpack = require('webpack'); | ||
|
||
const ALIASES = require('ocular-dev-tools/config/ocular.config')({ | ||
aliasMode: 'src', | ||
root: resolve(__dirname, '..') | ||
}).aliases; | ||
|
||
const PACKAGE_ROOT = resolve('.'); | ||
const PACKAGE_INFO = require(resolve(PACKAGE_ROOT, 'package.json')); | ||
|
||
/** | ||
* peerDependencies are excluded using `externals` | ||
* https://webpack.js.org/configuration/externals/ | ||
* e.g. @deck.gl/core is not bundled with @deck.gl/geo-layers | ||
*/ | ||
function getExternals(packageInfo) { | ||
const externals = { | ||
// Hard coded externals | ||
}; | ||
|
||
const {peerDependencies = {}, browser} = packageInfo; | ||
|
||
Object.assign(externals, browser); | ||
|
||
for (const depName in peerDependencies) { | ||
if (depName.startsWith('@luma.gl')) { | ||
// Instead of bundling the dependency, import from the global `deck` object | ||
externals[depName] = 'luma'; | ||
} | ||
} | ||
|
||
return externals; | ||
} | ||
|
||
const NODE = { | ||
Buffer: false, | ||
fs: 'empty', | ||
http: 'empty', | ||
https: 'empty', | ||
path: 'empty', | ||
crypto: 'empty' | ||
}; | ||
|
||
const config = { | ||
mode: 'production', | ||
|
||
entry: { | ||
main: resolve('./src/bundle') | ||
}, | ||
|
||
output: { | ||
libraryTarget: 'umd', | ||
path: PACKAGE_ROOT, | ||
filename: 'dist/dist.min.js' | ||
}, | ||
|
||
node: NODE, | ||
|
||
resolve: { | ||
alias: ALIASES | ||
}, | ||
|
||
module: { | ||
rules: [ | ||
{ | ||
// Compile ES2015 using babel | ||
test: /\.js$/, | ||
loader: 'babel-loader', | ||
include: /src/ | ||
} | ||
] | ||
}, | ||
|
||
externals: getExternals(PACKAGE_INFO), | ||
|
||
plugins: [ | ||
// This is used to define the __VERSION__ constant in core/lib/init.js | ||
// babel-plugin-version-inline uses the package version from the working directory | ||
// Therefore we need to manually import the correct version from the core | ||
// This is called in prepublishOnly, after lerna bumps the package versions | ||
new webpack.DefinePlugin({ | ||
__VERSION__: JSON.stringify(PACKAGE_INFO.version) | ||
}) | ||
], | ||
|
||
devtool: false | ||
}; | ||
|
||
module.exports = (env = {}) => { | ||
// console.log(JSON.stringify(env, null, 2)); | ||
|
||
if (env.dev) { | ||
// Set development mode (no minification) | ||
config.mode = 'development'; | ||
// Remove .min from the name | ||
config.output.filename = 'dist/dist.js'; | ||
// Disable transpilation | ||
config.module.rules = []; | ||
} | ||
|
||
// NOTE uncomment to display config | ||
// console.log('webpack config', JSON.stringify(config, null, 2)); | ||
|
||
return config; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#/bin/sh | ||
|
||
echo '# Minified Scripts' | ||
find modules -name dist.min.js | while read file; do | ||
ls -S -lh "$file" | awk '{print $5, $9}' | ||
done | ||
|
||
echo '# Worker sizes' | ||
find modules -name "*-loader.worker.js" | grep -v src | while read file; do | ||
ls -S -lh "$file" | awk '{print $5, $9}' | ||
done |
Oops, something went wrong.