Skip to content

Commit

Permalink
Merge pull request #84 from bigopon/master
Browse files Browse the repository at this point in the history
chore(build): enable UMD build for use in conjunction with aurelia-script
  • Loading branch information
EisenbergEffect authored Jan 15, 2019
2 parents 1ea54b5 + 44a7ba9 commit 9d65fd8
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 15 deletions.
24 changes: 20 additions & 4 deletions build/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,20 @@ const configs = {
es2015: {
input: ENTRY_PATH,
outputs: [
{ file: "dist/es2015/aurelia-store.js", format: "es" }
{ file: "dist/es2015/aurelia-store.js", format: "es" },
{
file: 'dist/umd/aurelia-store.js',
format: 'umd',
name: 'au.store',
globals: {
'aurelia-framework': 'au',
'aurelia-dependency-injection': 'au',
'aurelia-logging': 'au.LogManager',
'aurelia-pal': 'au',
'rxjs': 'rxjs',
'rxjs/operators': 'rxjs'
}
}
]
},
es5: {
Expand All @@ -34,11 +47,14 @@ const configs = {
}
}

const targetFormats: IBuildTargetFormat[] = args.format || ["es5", "es2015", "es2017"];
const targetFormats: IBuildTargetFormat[] = args.format || ["es2015", "es2017", "es5"];
Promise
.all(targetFormats.map(target => {
const { outputs, ...options } = configs[target];
return build(target, { ...options, external: EXTERNAL_LIBS }, outputs as rollup.OutputOptionsFile[]);
const { outputs, ...options } = (configs as any)[target];
return build(
target,
{ ...options, external: EXTERNAL_LIBS }, outputs as rollup.OutputOptions[]
);
}))
.then(() => generateDts())
.catch(ex => {
Expand Down
4 changes: 2 additions & 2 deletions build/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ export type IBuildTargetFormat = "es5" | "es2015" | "es2017";

export async function build(
target: IBuildTargetFormat,
options: rollup.RollupFileOptions,
outputs: rollup.OutputOptionsFile[]
options: rollup.InputOptions,
outputs: rollup.OutputOptions[]
): Promise<void> {
return rollup
.rollup({
Expand Down
23 changes: 16 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
],
"main": "dist/commonjs/aurelia-store.js",
"module": "dist/es2015/aurelia-store.js",
"browser": "dist/umd/aurelia-store.js",
"unpkg": "dist/umd/aurelia-store.js",
"typings": "dist/aurelia-store.d.ts",
"scripts": {
"lint": "cross-env tslint --project tsconfig.json",
Expand Down Expand Up @@ -117,8 +119,8 @@
"jest": "^22.4.4",
"jest-css-modules": "^1.1.0",
"rimraf": "^2.6.1",
"rollup": "^0.66.6",
"rollup-plugin-typescript2": "^0.17.2",
"rollup": "^1.1.0",
"rollup-plugin-typescript2": "^0.18.1",
"ts-jest": "^22.4.6",
"ts-node": "^7.0.1",
"tslint": "^5.11.0",
Expand Down

0 comments on commit 9d65fd8

Please sign in to comment.