Skip to content

Commit

Permalink
feat(build): Build and distribute UMD bundles
Browse files Browse the repository at this point in the history
  • Loading branch information
christopherthielen committed May 6, 2017
1 parent 09848a4 commit 0a8da85
Show file tree
Hide file tree
Showing 4 changed files with 160 additions and 10 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# master only
build
build_packages
_bundles
site
stats.html

# common
**/.*
Expand Down
15 changes: 11 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"name": "@uirouter/core",
"description": "UI-Router Core: Framework agnostic, State-based routing for JavaScript Single Page Apps",
"version": "5.0.1",
"version": "5.0.2",
"scripts": {
"clean": "shx rm -rf lib lib-esm",
"build": "npm run clean && tsc && tsc -m es6 --outDir lib-esm && npm run fixdts",
"clean": "shx rm -rf lib lib-esm _bundles",
"build": "npm run clean && tsc && tsc -m es6 --outDir lib-esm && npm run fixdts && npm run bundle",
"bundle": "rollup -c && rollup -c --environment MINIFY",
"fixdts": "dts-downlevel 'lib/**/*.d.ts' 'lib-esm/**/*.d.ts'",
"install": "node ./migrate/migratewarn.js",
"prepare": "npm run build",
Expand Down Expand Up @@ -72,12 +73,18 @@
"karma-chrome-launcher": "~0.1.0",
"karma-coverage": "^0.5.3",
"karma-jasmine": "^1.0.2",
"karma-phantomjs-launcher": "^1.0.2",
"karma-phantomjs-launcher": "^1.0.4",
"karma-script-launcher": "~0.1.0",
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "^1.8.0",
"npm-run-all": "^3.1.1",
"readline-sync": "^1.4.4",
"rollup": "^0.41.6",
"rollup-plugin-node-resolve": "^3.0.0",
"rollup-plugin-progress": "^0.2.1",
"rollup-plugin-sourcemaps": "^0.4.2",
"rollup-plugin-uglify": "^1.0.2",
"rollup-plugin-visualizer": "^0.2.1",
"shelljs": "^0.7.0",
"shx": "^0.1.4",
"tslint": "^4.5.1",
Expand Down
46 changes: 46 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import nodeResolve from 'rollup-plugin-node-resolve';
import uglify from 'rollup-plugin-uglify';
import progress from 'rollup-plugin-progress';
import sourcemaps from 'rollup-plugin-sourcemaps';
import visualizer from 'rollup-plugin-visualizer';

var MINIFY = process.env.MINIFY;

var pkg = require('./package.json');
var banner =
`/**
* ${pkg.description}
* @version v${pkg.version}
* @link ${pkg.homepage}
* @license MIT License, http://www.opensource.org/licenses/MIT
*/`;

var uglifyOpts = { output: {} };
// retain multiline comment with @license
uglifyOpts.output.comments = (node, comment) =>
comment.type === 'comment2' && /@license/i.test(comment.value);

var plugins = [
nodeResolve({jsnext: true}),
progress({ clearLine: false }),
sourcemaps(),
visualizer({ sourcemap: true }),
];

if (MINIFY) plugins.push(uglify(uglifyOpts));

var extension = MINIFY ? ".min.js" : ".js";

const CONFIG = {
moduleName: '@uirouter/core',
entry: 'lib-esm/index.js',
dest: '_bundles/ui-router-core' + extension,

sourceMap: true,
format: 'umd',
exports: 'named',
plugins: plugins,
banner: banner,
};

export default CONFIG;
106 changes: 101 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,10 @@ asynckit@^0.4.0:
version "0.4.0"
resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79"

atob@^2.0.0:
version "2.0.3"
resolved "https://registry.yarnpkg.com/atob/-/atob-2.0.3.tgz#19c7a760473774468f20b2d2d03372ad7d4cbf5d"

[email protected]:
version "3.0.0-beta.10"
resolved "https://registry.yarnpkg.com/awesome-typescript-loader/-/awesome-typescript-loader-3.0.0-beta.10.tgz#2e07b2a30ad4b02717e13421bc6952d2100acab9"
Expand Down Expand Up @@ -316,6 +320,12 @@ braces@^1.8.2:
preserve "^0.2.0"
repeat-element "^1.1.2"

browser-resolve@^1.11.0:
version "1.11.2"
resolved "https://registry.yarnpkg.com/browser-resolve/-/browser-resolve-1.11.2.tgz#8ff09b0a2c421718a1051c260b32e48f442938ce"
dependencies:
resolve "1.1.7"

[email protected]:
version "0.4.0"
resolved "https://registry.yarnpkg.com/browserify-aes/-/browserify-aes-0.4.0.tgz#067149b668df31c4b58533e02d01e806d8608e2c"
Expand All @@ -340,7 +350,7 @@ buffer@^4.9.0:
ieee754 "^1.1.4"
isarray "^1.0.0"

builtin-modules@^1.0.0:
builtin-modules@^1.0.0, builtin-modules@^1.1.0:
version "1.1.1"
resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f"

Expand Down Expand Up @@ -1024,6 +1034,14 @@ estraverse@^1.9.1:
version "1.9.3"
resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-1.9.3.tgz#af67f2dc922582415950926091a4005d29c9bb44"

estree-walker@^0.2.1:
version "0.2.1"
resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-0.2.1.tgz#bdafe8095383d8414d5dc2ecf4c9173b6db9412e"

estree-walker@^0.3.0:
version "0.3.1"
resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-0.3.1.tgz#e6b1a51cf7292524e7237c312e5fe6660c1ce1aa"

esutils@^2.0.2:
version "2.0.2"
resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b"
Expand Down Expand Up @@ -1604,6 +1622,10 @@ is-glob@^2.0.0, is-glob@^2.0.1:
dependencies:
is-extglob "^1.0.0"

is-module@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/is-module/-/is-module-1.0.0.tgz#3258fb69f78c14d5b815d664336b4cffb6441591"

is-my-json-valid@^2.12.4:
version "2.16.0"
resolved "https://registry.yarnpkg.com/is-my-json-valid/-/is-my-json-valid-2.16.0.tgz#f079dd9bfdae65ee2038aae8acbc86ab109e3693"
Expand Down Expand Up @@ -1821,7 +1843,7 @@ karma-jasmine@^1.0.2:
version "1.1.0"
resolved "https://registry.yarnpkg.com/karma-jasmine/-/karma-jasmine-1.1.0.tgz#22e4c06bf9a182e5294d1f705e3733811b810acf"

karma-phantomjs-launcher@^1.0.2:
karma-phantomjs-launcher@^1.0.4:
version "1.0.4"
resolved "https://registry.yarnpkg.com/karma-phantomjs-launcher/-/karma-phantomjs-launcher-1.0.4.tgz#d23ca34801bda9863ad318e3bb4bd4062b13acd2"
dependencies:
Expand Down Expand Up @@ -2045,7 +2067,7 @@ meow@^3.3.0, meow@^3.7.0:
redent "^1.0.0"
trim-newlines "^1.0.0"

micromatch@^2.1.5:
micromatch@^2.1.5, micromatch@^2.3.11:
version "2.3.11"
resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-2.3.11.tgz#86677c97d1720b363431d04d0d15293bd38c1565"
dependencies:
Expand Down Expand Up @@ -2738,7 +2760,11 @@ [email protected]:
version "1.0.0"
resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff"

[email protected]:
resolve-url@^0.2.1:
version "0.2.1"
resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a"

[email protected], [email protected]:
version "1.1.7"
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b"

Expand All @@ -2764,6 +2790,59 @@ [email protected]:
version "0.2.0"
resolved "https://registry.yarnpkg.com/ripemd160/-/ripemd160-0.2.0.tgz#2bf198bde167cacfa51c0a928e84b68bbe171fce"

rollup-plugin-node-resolve@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/rollup-plugin-node-resolve/-/rollup-plugin-node-resolve-3.0.0.tgz#8b897c4c3030d5001277b0514b25d2ca09683ee0"
dependencies:
browser-resolve "^1.11.0"
builtin-modules "^1.1.0"
is-module "^1.0.0"
resolve "^1.1.6"

rollup-plugin-progress@^0.2.1:
version "0.2.1"
resolved "https://registry.yarnpkg.com/rollup-plugin-progress/-/rollup-plugin-progress-0.2.1.tgz#e3c932a0316374daaf37f471c86d4adfb9caee57"
dependencies:
chalk "^1.1.3"
rollup-pluginutils "^1.5.1"

rollup-plugin-sourcemaps@^0.4.2:
version "0.4.2"
resolved "https://registry.yarnpkg.com/rollup-plugin-sourcemaps/-/rollup-plugin-sourcemaps-0.4.2.tgz#62125aa94087aadf7b83ef4dfaf629b473135e87"
dependencies:
rollup-pluginutils "^2.0.1"
source-map-resolve "^0.5.0"

rollup-plugin-uglify@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/rollup-plugin-uglify/-/rollup-plugin-uglify-1.0.2.tgz#d4aa6f5df13522eae1ba17780c7c4c7096038359"
dependencies:
uglify-js "^2.6.1"

rollup-plugin-visualizer@^0.2.1:
version "0.2.1"
resolved "https://registry.yarnpkg.com/rollup-plugin-visualizer/-/rollup-plugin-visualizer-0.2.1.tgz#f8ce144a23f3f41d6bc930066119b47f1415d4ab"

rollup-pluginutils@^1.5.1:
version "1.5.2"
resolved "https://registry.yarnpkg.com/rollup-pluginutils/-/rollup-pluginutils-1.5.2.tgz#1e156e778f94b7255bfa1b3d0178be8f5c552408"
dependencies:
estree-walker "^0.2.1"
minimatch "^3.0.2"

rollup-pluginutils@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/rollup-pluginutils/-/rollup-pluginutils-2.0.1.tgz#7ec95b3573f6543a46a6461bd9a7c544525d0fc0"
dependencies:
estree-walker "^0.3.0"
micromatch "^2.3.11"

rollup@^0.41.6:
version "0.41.6"
resolved "https://registry.yarnpkg.com/rollup/-/rollup-0.41.6.tgz#e0d05497877a398c104d816d2733a718a7a94e2a"
dependencies:
source-map-support "^0.4.0"

safe-buffer@^5.0.1:
version "5.0.1"
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.0.1.tgz#d263ca54696cd8a306b5ca6551e92de57918fbe7"
Expand Down Expand Up @@ -2888,12 +2967,25 @@ source-list-map@~0.1.7:
version "0.1.8"
resolved "https://registry.yarnpkg.com/source-list-map/-/source-list-map-0.1.8.tgz#c550b2ab5427f6b3f21f5afead88c4f5587b2106"

source-map-resolve@^0.5.0:
version "0.5.0"
resolved "https://registry.yarnpkg.com/source-map-resolve/-/source-map-resolve-0.5.0.tgz#fcad0b64b70afb27699e425950cb5ebcd410bc20"
dependencies:
atob "^2.0.0"
resolve-url "^0.2.1"
source-map-url "^0.4.0"
urix "^0.1.0"

source-map-support@^0.4.0:
version "0.4.15"
resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.4.15.tgz#03202df65c06d2bd8c7ec2362a193056fef8d3b1"
dependencies:
source-map "^0.5.6"

source-map-url@^0.4.0:
version "0.4.0"
resolved "https://registry.yarnpkg.com/source-map-url/-/source-map-url-0.4.0.tgz#3e935d7ddd73631b97659956d55128e87b5084a3"

source-map@^0.1.41:
version "0.1.43"
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.1.43.tgz#c24bc146ca517c1471f5dacbe2571b2b7f9e3346"
Expand Down Expand Up @@ -3223,7 +3315,7 @@ typescript@^2.1.4:
version "2.3.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.3.2.tgz#f0f045e196f69a72f06b25fd3bd39d01c3ce9984"

uglify-js@^2.6, uglify-js@~2.7.3:
uglify-js@^2.6, uglify-js@^2.6.1, uglify-js@~2.7.3:
version "2.7.5"
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.7.5.tgz#4612c0c7baaee2ba7c487de4904ae122079f2ca8"
dependencies:
Expand Down Expand Up @@ -3271,6 +3363,10 @@ update-notifier@^2.0.0:
semver-diff "^2.0.0"
xdg-basedir "^3.0.0"

urix@^0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/urix/-/urix-0.1.0.tgz#da937f7a62e21fec1fd18d49b35c2935067a6c72"

url-parse-lax@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/url-parse-lax/-/url-parse-lax-1.0.0.tgz#7af8f303645e9bd79a272e7a14ac68bc0609da73"
Expand Down

0 comments on commit 0a8da85

Please sign in to comment.