refactor(packaging): points to es5 code with es2015 import/header, points to umd cod

points to es5 code with es2015 import/header,  points to umd code,  points to
pure es2015 code
This commit is contained in:
Dan Bucholtz
2017-03-27 16:42:01 -05:00
parent 3819740998
commit 54acc74fdb
3 changed files with 24 additions and 23 deletions

View File

@ -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_BUNDLE_ROOT = join(DIST_BUILD_ROOT, BUNDLES);
export const DIST_BUILD_UMD_ROOT = join(DIST_BUILD_ROOT, UMD_MODULE); 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_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 DIST_VENDOR_ROOT = join(DIST_ROOT, VENDOR_NAME);
export const NODE_MODULES_ROOT = join(PROJECT_ROOT, NODE_MODULES); export const NODE_MODULES_ROOT = join(PROJECT_ROOT, NODE_MODULES);
export const SCRIPTS_ROOT = join(PROJECT_ROOT, SCRIPTS_NAME); export const SCRIPTS_ROOT = join(PROJECT_ROOT, SCRIPTS_NAME);

View File

@ -1,5 +1,5 @@
import { task } from 'gulp'; 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'; import { copySourceToDest, createTempTsConfig, deleteFiles, runNgc, runTsc } from '../util';
@ -45,29 +45,10 @@ export function buildIonicAngularUmdTsc(excludeSpec: boolean, stripDebug: boolea
export function buildIonicAngularEsm(stripDebug: boolean, done: Function) { export function buildIonicAngularEsm(stripDebug: boolean, done: Function) {
const stream = copySourceToDest(DIST_BUILD_ESM_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) => {
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);
});
});
}
export function buildIonicPureEs6(stripDebug: boolean, done: Function) {
const stream = copySourceToDest(DIST_BUILD_ROOT, true, true, stripDebug); const stream = copySourceToDest(DIST_BUILD_ROOT, true, true, stripDebug);
stream.on('end', () => { stream.on('end', () => {
// the source files are copied, copy over a tsconfig from // 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`); createTempTsConfig(['./**/*.ts'], ES5, ES_2015, `${PROJECT_ROOT}/tsconfig.json`, `${DIST_BUILD_ROOT}/tsconfig.json`);
runNgc(`${DIST_BUILD_ROOT}/tsconfig.json`, (err) => { runNgc(`${DIST_BUILD_ROOT}/tsconfig.json`, (err) => {
if (err) { if (err) {
done(err); done(err);
@ -82,6 +63,25 @@ export function buildIonicPureEs6(stripDebug: boolean, done: Function) {
}); });
} }
export function buildIonicPureEs6(stripDebug: boolean, done: Function) {
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_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_ES2015_ROOT}/**/*.ts`,
`${DIST_BUILD_ES2015_ROOT}/node_modules`,
`${DIST_BUILD_ES2015_ROOT}/tsconfig.json`,
`!${DIST_BUILD_ES2015_ROOT}/**/*.d.ts`], done);
});
});
}
/* this task builds out the necessary stuff for karma */ /* this task builds out the necessary stuff for karma */
task('compile.karma', (done: Function) => { task('compile.karma', (done: Function) => {
buildIonicAngularUmdTsc(false, false, done); buildIonicAngularUmdTsc(false, false, done);

View File

@ -8,8 +8,9 @@
"url": "https://github.com/driftyco/ionic.git" "url": "https://github.com/driftyco/ionic.git"
}, },
"license": "MIT", "license": "MIT",
"main": "esm/index.js", "main": "umd/index.js",
"module": "index.js", "module": "index.js",
"es2015": "es2015/index.js",
"peerDependencies": { "peerDependencies": {
"@angular/common": "", "@angular/common": "",
"@angular/compiler": "", "@angular/compiler": "",