Skip to content

Commit

Permalink
refactor(packaging): points to es5 code with es2015 import/header, po…
Browse files Browse the repository at this point in the history
…ints to umd cod

 points to es5 code with es2015 import/header,  points to umd code,  points to
pure es2015 code
  • Loading branch information
danbucholtz committed Mar 27, 2017
1 parent 3819740 commit 54acc74
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 17 deletions.
2 changes: 1 addition & 1 deletion scripts/gulp/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const DIST_BUILD_ROOT = join(DIST_ROOT, PACKAGE_NAME);
export const DIST_BUNDLE_ROOT = join(DIST_BUILD_ROOT, BUNDLES);
export const DIST_BUILD_UMD_ROOT = join(DIST_BUILD_ROOT, UMD_MODULE);
export const DIST_BUILD_UMD_BUNDLE_ENTRYPOINT = join(DIST_BUILD_ROOT, INDEX_JS);
export const DIST_BUILD_ESM_ROOT = join(DIST_BUILD_ROOT, 'esm');
export const DIST_BUILD_ES2015_ROOT = join(DIST_BUILD_ROOT, 'es2015');
export const DIST_VENDOR_ROOT = join(DIST_ROOT, VENDOR_NAME);
export const NODE_MODULES_ROOT = join(PROJECT_ROOT, NODE_MODULES);
export const SCRIPTS_ROOT = join(PROJECT_ROOT, SCRIPTS_NAME);
Expand Down
30 changes: 15 additions & 15 deletions scripts/gulp/tasks/build.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { task } from 'gulp';
import { DIST_BUILD_ROOT, DIST_BUILD_ESM_ROOT, DIST_BUILD_UMD_ROOT, ES5, ES_2015, PROJECT_ROOT, UMD_MODULE } from '../constants';
import { DIST_BUILD_ROOT, DIST_BUILD_ES2015_ROOT, DIST_BUILD_UMD_ROOT, ES5, ES_2015, PROJECT_ROOT, UMD_MODULE } from '../constants';
import { copySourceToDest, createTempTsConfig, deleteFiles, runNgc, runTsc } from '../util';


Expand Down Expand Up @@ -45,39 +45,39 @@ export function buildIonicAngularUmdTsc(excludeSpec: boolean, stripDebug: boolea


export function buildIonicAngularEsm(stripDebug: boolean, done: Function) {
const stream = copySourceToDest(DIST_BUILD_ESM_ROOT, true, true, stripDebug);
const stream = copySourceToDest(DIST_BUILD_ROOT, true, true, stripDebug);
stream.on('end', () => {
// the source files are copied, copy over a tsconfig from
createTempTsConfig(['./**/*.ts'], ES_2015, ES_2015, `${PROJECT_ROOT}/tsconfig.json`, `${DIST_BUILD_ESM_ROOT}/tsconfig.json`);
runNgc(`${DIST_BUILD_ESM_ROOT}/tsconfig.json`, (err) => {
createTempTsConfig(['./**/*.ts'], ES5, ES_2015, `${PROJECT_ROOT}/tsconfig.json`, `${DIST_BUILD_ROOT}/tsconfig.json`);
runNgc(`${DIST_BUILD_ROOT}/tsconfig.json`, (err) => {
if (err) {
done(err);
return;
}
// clean up any .ts files that remain as well as ngc metadata
deleteFiles([`${DIST_BUILD_ESM_ROOT}/**/*.ts`,
`${DIST_BUILD_ESM_ROOT}/node_modules`,
`${DIST_BUILD_ESM_ROOT}/tsconfig.json`,
`!${DIST_BUILD_ESM_ROOT}/**/*.d.ts`], done);
deleteFiles([`${DIST_BUILD_ROOT}/**/*.ts`,
`${DIST_BUILD_ROOT}/node_modules`,
`${DIST_BUILD_ROOT}/tsconfig.json`,
`!${DIST_BUILD_ROOT}/**/*.d.ts`], done);
});
});
}

export function buildIonicPureEs6(stripDebug: boolean, done: Function) {
const stream = copySourceToDest(DIST_BUILD_ROOT, true, true, stripDebug);
const stream = copySourceToDest(DIST_BUILD_ES2015_ROOT, true, true, stripDebug);
stream.on('end', () => {
// the source files are copied, copy over a tsconfig from
createTempTsConfig(['./**/*.ts'], ES_2015, ES_2015, `${PROJECT_ROOT}/tsconfig.json`, `${DIST_BUILD_ROOT}/tsconfig.json`);
runNgc(`${DIST_BUILD_ROOT}/tsconfig.json`, (err) => {
createTempTsConfig(['./**/*.ts'], ES_2015, ES_2015, `${PROJECT_ROOT}/tsconfig.json`, `${DIST_BUILD_ES2015_ROOT}/tsconfig.json`);
runNgc(`${DIST_BUILD_ES2015_ROOT}/tsconfig.json`, (err) => {
if (err) {
done(err);
return;
}
// clean up any .ts files that remain as well as ngc metadata
deleteFiles([`${DIST_BUILD_ROOT}/**/*.ts`,
`${DIST_BUILD_ROOT}/node_modules`,
`${DIST_BUILD_ROOT}/tsconfig.json`,
`!${DIST_BUILD_ROOT}/**/*.d.ts`], done);
deleteFiles([`${DIST_BUILD_ES2015_ROOT}/**/*.ts`,
`${DIST_BUILD_ES2015_ROOT}/node_modules`,
`${DIST_BUILD_ES2015_ROOT}/tsconfig.json`,
`!${DIST_BUILD_ES2015_ROOT}/**/*.d.ts`], done);
});
});
}
Expand Down
3 changes: 2 additions & 1 deletion scripts/npm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
"url": "https://github.com/driftyco/ionic.git"
},
"license": "MIT",
"main": "esm/index.js",
"main": "umd/index.js",
"module": "index.js",
"es2015": "es2015/index.js",
"peerDependencies": {
"@angular/common": "",
"@angular/compiler": "",
Expand Down

0 comments on commit 54acc74

Please sign in to comment.