mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-21 21:15:24 +08:00

* chore(build): WIP getting ionic working with app-scripts the tsconfig file change is just for testing, this will need to be undone * chore(demos): update tsconfig and gitignore for demos update tsconfig and gitinogre for demos * chore(build): WIP check in progress with building with app-scripts this only works with demos/action-sheet currently * refactor(demos): add custom copy config add custom copy config * chore(tsconfig): revert root tsconfig * chore(demos): change import paths * chore(demos): move sass config, add new tsconfig, update template * chore(scripts): update demos tasks to use app scripts with folder name tweak the createTempTsConfig function to include a path to read from, move getFolderInfo into util to share at this point you should be able to run `gulp demos.prod` with a folder e.g. `--f=alert` and open the index of that test to see it. Doesn’t work yet with all of the tests at once. Need to have ran `gulp release.prepareReleasePackage` first. * chore(build): WIP working on getting all of the demos building * chore(demos): update demos task for app-scripts build * chore(demos): fix tslint errors thrown by app-scripts * chore(demos): get the demos working with fonts and variable file * chore(demos): add watch task to the new prod task * chore(demos): remove old demos.prod file and rename new one to it * chore(npm): remove build npm script * chore(demos): only log component name in url if one was passed
80 lines
3.3 KiB
TypeScript
80 lines
3.3 KiB
TypeScript
import { task } from 'gulp';
|
|
import { DIST_BUILD_ROOT, DIST_BUILD_ES2015_ROOT, DIST_BUILD_UMD_ROOT, ES5, ES_2015, PROJECT_ROOT, UMD_MODULE } from '../constants';
|
|
import { copySourceToDest, copySwiperToPath, createTempTsConfig, deleteFiles, runNgc } from '../util';
|
|
|
|
|
|
export function buildIonicAngularUmd(excludeSpec: boolean, stripDebug: boolean, done: Function) {
|
|
const stream = copySourceToDest(DIST_BUILD_UMD_ROOT, excludeSpec, true, stripDebug);
|
|
stream.on('end', () => {
|
|
// the source files are copied, copy over a tsconfig from
|
|
createTempTsConfig(['./**/*.ts'], ES5, UMD_MODULE, `${PROJECT_ROOT}/tsconfig.json`, `${DIST_BUILD_UMD_ROOT}/tsconfig.json`);
|
|
runNgc(`${DIST_BUILD_UMD_ROOT}/tsconfig.json`, (err) => {
|
|
if (err) {
|
|
done(err);
|
|
return;
|
|
}
|
|
|
|
copySwiperToPath(`${DIST_BUILD_UMD_ROOT}/components/slides`, UMD_MODULE);
|
|
// clean up any .ts files that remain as well as ngc metadata
|
|
deleteFiles([`${DIST_BUILD_UMD_ROOT}/**/*.ts`,
|
|
`${DIST_BUILD_UMD_ROOT}/node_modules`,
|
|
`${DIST_BUILD_UMD_ROOT}/tsconfig.json`,
|
|
`!${DIST_BUILD_UMD_ROOT}/**/*.d.ts`], done);
|
|
});
|
|
});
|
|
}
|
|
|
|
export function buildIonicAngularEsm(stripDebug: boolean, done: Function) {
|
|
const stream = copySourceToDest(DIST_BUILD_ROOT, true, true, stripDebug);
|
|
stream.on('end', () => {
|
|
// the source files are copied, copy over a tsconfig from
|
|
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;
|
|
}
|
|
copySwiperToPath(`${DIST_BUILD_ROOT}/components/slides`, ES_2015);
|
|
// 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);
|
|
});
|
|
});
|
|
}
|
|
|
|
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;
|
|
}
|
|
copySwiperToPath(`${DIST_BUILD_ES2015_ROOT}/components/slides`, ES_2015);
|
|
// 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 */
|
|
task('compile.karma', (done: Function) => {
|
|
buildIonicAngularUmd(false, false, done);
|
|
});
|
|
|
|
/* this task builds out the ionic-angular (commonjs and esm) directories for release */
|
|
task('compile.release', (done: Function) => {
|
|
buildIonicAngularEsm(true, () => {
|
|
buildIonicAngularUmd(true, true, () => {
|
|
buildIonicPureEs6(true, done);
|
|
});
|
|
});
|
|
});
|