Skip to content

Commit 0a8da85

Browse files
feat(build): Build and distribute UMD bundles
1 parent 09848a4 commit 0a8da85

File tree

4 files changed

+160
-10
lines changed

4 files changed

+160
-10
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
# master only
21
build
32
build_packages
3+
_bundles
44
site
5+
stats.html
56

67
# common
78
**/.*

package.json

+11-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
{
22
"name": "@uirouter/core",
33
"description": "UI-Router Core: Framework agnostic, State-based routing for JavaScript Single Page Apps",
4-
"version": "5.0.1",
4+
"version": "5.0.2",
55
"scripts": {
6-
"clean": "shx rm -rf lib lib-esm",
7-
"build": "npm run clean && tsc && tsc -m es6 --outDir lib-esm && npm run fixdts",
6+
"clean": "shx rm -rf lib lib-esm _bundles",
7+
"build": "npm run clean && tsc && tsc -m es6 --outDir lib-esm && npm run fixdts && npm run bundle",
8+
"bundle": "rollup -c && rollup -c --environment MINIFY",
89
"fixdts": "dts-downlevel 'lib/**/*.d.ts' 'lib-esm/**/*.d.ts'",
910
"install": "node ./migrate/migratewarn.js",
1011
"prepare": "npm run build",
@@ -72,12 +73,18 @@
7273
"karma-chrome-launcher": "~0.1.0",
7374
"karma-coverage": "^0.5.3",
7475
"karma-jasmine": "^1.0.2",
75-
"karma-phantomjs-launcher": "^1.0.2",
76+
"karma-phantomjs-launcher": "^1.0.4",
7677
"karma-script-launcher": "~0.1.0",
7778
"karma-sourcemap-loader": "^0.3.7",
7879
"karma-webpack": "^1.8.0",
7980
"npm-run-all": "^3.1.1",
8081
"readline-sync": "^1.4.4",
82+
"rollup": "^0.41.6",
83+
"rollup-plugin-node-resolve": "^3.0.0",
84+
"rollup-plugin-progress": "^0.2.1",
85+
"rollup-plugin-sourcemaps": "^0.4.2",
86+
"rollup-plugin-uglify": "^1.0.2",
87+
"rollup-plugin-visualizer": "^0.2.1",
8188
"shelljs": "^0.7.0",
8289
"shx": "^0.1.4",
8390
"tslint": "^4.5.1",

rollup.config.js

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import nodeResolve from 'rollup-plugin-node-resolve';
2+
import uglify from 'rollup-plugin-uglify';
3+
import progress from 'rollup-plugin-progress';
4+
import sourcemaps from 'rollup-plugin-sourcemaps';
5+
import visualizer from 'rollup-plugin-visualizer';
6+
7+
var MINIFY = process.env.MINIFY;
8+
9+
var pkg = require('./package.json');
10+
var banner =
11+
`/**
12+
* ${pkg.description}
13+
* @version v${pkg.version}
14+
* @link ${pkg.homepage}
15+
* @license MIT License, http://www.opensource.org/licenses/MIT
16+
*/`;
17+
18+
var uglifyOpts = { output: {} };
19+
// retain multiline comment with @license
20+
uglifyOpts.output.comments = (node, comment) =>
21+
comment.type === 'comment2' && /@license/i.test(comment.value);
22+
23+
var plugins = [
24+
nodeResolve({jsnext: true}),
25+
progress({ clearLine: false }),
26+
sourcemaps(),
27+
visualizer({ sourcemap: true }),
28+
];
29+
30+
if (MINIFY) plugins.push(uglify(uglifyOpts));
31+
32+
var extension = MINIFY ? ".min.js" : ".js";
33+
34+
const CONFIG = {
35+
moduleName: '@uirouter/core',
36+
entry: 'lib-esm/index.js',
37+
dest: '_bundles/ui-router-core' + extension,
38+
39+
sourceMap: true,
40+
format: 'umd',
41+
exports: 'named',
42+
plugins: plugins,
43+
banner: banner,
44+
};
45+
46+
export default CONFIG;

yarn.lock

+101-5
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,10 @@ asynckit@^0.4.0:
181181
version "0.4.0"
182182
resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79"
183183

184+
atob@^2.0.0:
185+
version "2.0.3"
186+
resolved "https://registry.yarnpkg.com/atob/-/atob-2.0.3.tgz#19c7a760473774468f20b2d2d03372ad7d4cbf5d"
187+
184188
185189
version "3.0.0-beta.10"
186190
resolved "https://registry.yarnpkg.com/awesome-typescript-loader/-/awesome-typescript-loader-3.0.0-beta.10.tgz#2e07b2a30ad4b02717e13421bc6952d2100acab9"
@@ -316,6 +320,12 @@ braces@^1.8.2:
316320
preserve "^0.2.0"
317321
repeat-element "^1.1.2"
318322

323+
browser-resolve@^1.11.0:
324+
version "1.11.2"
325+
resolved "https://registry.yarnpkg.com/browser-resolve/-/browser-resolve-1.11.2.tgz#8ff09b0a2c421718a1051c260b32e48f442938ce"
326+
dependencies:
327+
resolve "1.1.7"
328+
319329
320330
version "0.4.0"
321331
resolved "https://registry.yarnpkg.com/browserify-aes/-/browserify-aes-0.4.0.tgz#067149b668df31c4b58533e02d01e806d8608e2c"
@@ -340,7 +350,7 @@ buffer@^4.9.0:
340350
ieee754 "^1.1.4"
341351
isarray "^1.0.0"
342352

343-
builtin-modules@^1.0.0:
353+
builtin-modules@^1.0.0, builtin-modules@^1.1.0:
344354
version "1.1.1"
345355
resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f"
346356

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

1037+
estree-walker@^0.2.1:
1038+
version "0.2.1"
1039+
resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-0.2.1.tgz#bdafe8095383d8414d5dc2ecf4c9173b6db9412e"
1040+
1041+
estree-walker@^0.3.0:
1042+
version "0.3.1"
1043+
resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-0.3.1.tgz#e6b1a51cf7292524e7237c312e5fe6660c1ce1aa"
1044+
10271045
esutils@^2.0.2:
10281046
version "2.0.2"
10291047
resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b"
@@ -1604,6 +1622,10 @@ is-glob@^2.0.0, is-glob@^2.0.1:
16041622
dependencies:
16051623
is-extglob "^1.0.0"
16061624

1625+
is-module@^1.0.0:
1626+
version "1.0.0"
1627+
resolved "https://registry.yarnpkg.com/is-module/-/is-module-1.0.0.tgz#3258fb69f78c14d5b815d664336b4cffb6441591"
1628+
16071629
is-my-json-valid@^2.12.4:
16081630
version "2.16.0"
16091631
resolved "https://registry.yarnpkg.com/is-my-json-valid/-/is-my-json-valid-2.16.0.tgz#f079dd9bfdae65ee2038aae8acbc86ab109e3693"
@@ -1821,7 +1843,7 @@ karma-jasmine@^1.0.2:
18211843
version "1.1.0"
18221844
resolved "https://registry.yarnpkg.com/karma-jasmine/-/karma-jasmine-1.1.0.tgz#22e4c06bf9a182e5294d1f705e3733811b810acf"
18231845

1824-
karma-phantomjs-launcher@^1.0.2:
1846+
karma-phantomjs-launcher@^1.0.4:
18251847
version "1.0.4"
18261848
resolved "https://registry.yarnpkg.com/karma-phantomjs-launcher/-/karma-phantomjs-launcher-1.0.4.tgz#d23ca34801bda9863ad318e3bb4bd4062b13acd2"
18271849
dependencies:
@@ -2045,7 +2067,7 @@ meow@^3.3.0, meow@^3.7.0:
20452067
redent "^1.0.0"
20462068
trim-newlines "^1.0.0"
20472069

2048-
micromatch@^2.1.5:
2070+
micromatch@^2.1.5, micromatch@^2.3.11:
20492071
version "2.3.11"
20502072
resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-2.3.11.tgz#86677c97d1720b363431d04d0d15293bd38c1565"
20512073
dependencies:
@@ -2738,7 +2760,11 @@ [email protected]:
27382760
version "1.0.0"
27392761
resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff"
27402762

2741-
2763+
resolve-url@^0.2.1:
2764+
version "0.2.1"
2765+
resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a"
2766+
2767+
27422768
version "1.1.7"
27432769
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b"
27442770

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

2793+
rollup-plugin-node-resolve@^3.0.0:
2794+
version "3.0.0"
2795+
resolved "https://registry.yarnpkg.com/rollup-plugin-node-resolve/-/rollup-plugin-node-resolve-3.0.0.tgz#8b897c4c3030d5001277b0514b25d2ca09683ee0"
2796+
dependencies:
2797+
browser-resolve "^1.11.0"
2798+
builtin-modules "^1.1.0"
2799+
is-module "^1.0.0"
2800+
resolve "^1.1.6"
2801+
2802+
rollup-plugin-progress@^0.2.1:
2803+
version "0.2.1"
2804+
resolved "https://registry.yarnpkg.com/rollup-plugin-progress/-/rollup-plugin-progress-0.2.1.tgz#e3c932a0316374daaf37f471c86d4adfb9caee57"
2805+
dependencies:
2806+
chalk "^1.1.3"
2807+
rollup-pluginutils "^1.5.1"
2808+
2809+
rollup-plugin-sourcemaps@^0.4.2:
2810+
version "0.4.2"
2811+
resolved "https://registry.yarnpkg.com/rollup-plugin-sourcemaps/-/rollup-plugin-sourcemaps-0.4.2.tgz#62125aa94087aadf7b83ef4dfaf629b473135e87"
2812+
dependencies:
2813+
rollup-pluginutils "^2.0.1"
2814+
source-map-resolve "^0.5.0"
2815+
2816+
rollup-plugin-uglify@^1.0.2:
2817+
version "1.0.2"
2818+
resolved "https://registry.yarnpkg.com/rollup-plugin-uglify/-/rollup-plugin-uglify-1.0.2.tgz#d4aa6f5df13522eae1ba17780c7c4c7096038359"
2819+
dependencies:
2820+
uglify-js "^2.6.1"
2821+
2822+
rollup-plugin-visualizer@^0.2.1:
2823+
version "0.2.1"
2824+
resolved "https://registry.yarnpkg.com/rollup-plugin-visualizer/-/rollup-plugin-visualizer-0.2.1.tgz#f8ce144a23f3f41d6bc930066119b47f1415d4ab"
2825+
2826+
rollup-pluginutils@^1.5.1:
2827+
version "1.5.2"
2828+
resolved "https://registry.yarnpkg.com/rollup-pluginutils/-/rollup-pluginutils-1.5.2.tgz#1e156e778f94b7255bfa1b3d0178be8f5c552408"
2829+
dependencies:
2830+
estree-walker "^0.2.1"
2831+
minimatch "^3.0.2"
2832+
2833+
rollup-pluginutils@^2.0.1:
2834+
version "2.0.1"
2835+
resolved "https://registry.yarnpkg.com/rollup-pluginutils/-/rollup-pluginutils-2.0.1.tgz#7ec95b3573f6543a46a6461bd9a7c544525d0fc0"
2836+
dependencies:
2837+
estree-walker "^0.3.0"
2838+
micromatch "^2.3.11"
2839+
2840+
rollup@^0.41.6:
2841+
version "0.41.6"
2842+
resolved "https://registry.yarnpkg.com/rollup/-/rollup-0.41.6.tgz#e0d05497877a398c104d816d2733a718a7a94e2a"
2843+
dependencies:
2844+
source-map-support "^0.4.0"
2845+
27672846
safe-buffer@^5.0.1:
27682847
version "5.0.1"
27692848
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.0.1.tgz#d263ca54696cd8a306b5ca6551e92de57918fbe7"
@@ -2888,12 +2967,25 @@ source-list-map@~0.1.7:
28882967
version "0.1.8"
28892968
resolved "https://registry.yarnpkg.com/source-list-map/-/source-list-map-0.1.8.tgz#c550b2ab5427f6b3f21f5afead88c4f5587b2106"
28902969

2970+
source-map-resolve@^0.5.0:
2971+
version "0.5.0"
2972+
resolved "https://registry.yarnpkg.com/source-map-resolve/-/source-map-resolve-0.5.0.tgz#fcad0b64b70afb27699e425950cb5ebcd410bc20"
2973+
dependencies:
2974+
atob "^2.0.0"
2975+
resolve-url "^0.2.1"
2976+
source-map-url "^0.4.0"
2977+
urix "^0.1.0"
2978+
28912979
source-map-support@^0.4.0:
28922980
version "0.4.15"
28932981
resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.4.15.tgz#03202df65c06d2bd8c7ec2362a193056fef8d3b1"
28942982
dependencies:
28952983
source-map "^0.5.6"
28962984

2985+
source-map-url@^0.4.0:
2986+
version "0.4.0"
2987+
resolved "https://registry.yarnpkg.com/source-map-url/-/source-map-url-0.4.0.tgz#3e935d7ddd73631b97659956d55128e87b5084a3"
2988+
28972989
source-map@^0.1.41:
28982990
version "0.1.43"
28992991
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.1.43.tgz#c24bc146ca517c1471f5dacbe2571b2b7f9e3346"
@@ -3223,7 +3315,7 @@ typescript@^2.1.4:
32233315
version "2.3.2"
32243316
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.3.2.tgz#f0f045e196f69a72f06b25fd3bd39d01c3ce9984"
32253317

3226-
uglify-js@^2.6, uglify-js@~2.7.3:
3318+
uglify-js@^2.6, uglify-js@^2.6.1, uglify-js@~2.7.3:
32273319
version "2.7.5"
32283320
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.7.5.tgz#4612c0c7baaee2ba7c487de4904ae122079f2ca8"
32293321
dependencies:
@@ -3271,6 +3363,10 @@ update-notifier@^2.0.0:
32713363
semver-diff "^2.0.0"
32723364
xdg-basedir "^3.0.0"
32733365

3366+
urix@^0.1.0:
3367+
version "0.1.0"
3368+
resolved "https://registry.yarnpkg.com/urix/-/urix-0.1.0.tgz#da937f7a62e21fec1fd18d49b35c2935067a6c72"
3369+
32743370
url-parse-lax@^1.0.0:
32753371
version "1.0.0"
32763372
resolved "https://registry.yarnpkg.com/url-parse-lax/-/url-parse-lax-1.0.0.tgz#7af8f303645e9bd79a272e7a14ac68bc0609da73"

0 commit comments

Comments
 (0)