mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 12:29:55 +08:00
chore(e2e): add --dev option to e2e.prod to speed up builds for faster but less thorough verification
This commit is contained in:
@ -34,6 +34,7 @@ task('e2e.prod', ['e2e.prepare'], (done: Function) => {
|
|||||||
done();
|
done();
|
||||||
}).catch((err: Error) => {
|
}).catch((err: Error) => {
|
||||||
done(err);
|
done(err);
|
||||||
|
process.exit(1);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -106,13 +107,10 @@ function buildTest(filePath: string) {
|
|||||||
const sassConfigPath = join('scripts', 'e2e', 'sass.config.js');
|
const sassConfigPath = join('scripts', 'e2e', 'sass.config.js');
|
||||||
const copyConfigPath = join('scripts', 'e2e', 'copy.config.js');
|
const copyConfigPath = join('scripts', 'e2e', 'copy.config.js');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const appNgModulePath = join(dirname(appEntryPoint), 'app.module.ts');
|
const appNgModulePath = join(dirname(appEntryPoint), 'app.module.ts');
|
||||||
const distDir = join(distTestRoot, 'www');
|
const distDir = join(distTestRoot, 'www');
|
||||||
|
|
||||||
return runAppScriptsBuild(appEntryPoint, appNgModulePath, ionicAngularDir, distDir, pathToWriteFile, ionicAngularDir, sassConfigPath, copyConfigPath).then(() => {
|
return runAppScriptsBuild(appEntryPoint, appNgModulePath, ionicAngularDir, distDir, pathToWriteFile, ionicAngularDir, sassConfigPath, copyConfigPath, argv.dev).then(() => {
|
||||||
const end = Date.now();
|
const end = Date.now();
|
||||||
console.log(`${filePath} took a total of ${(end - start) / 1000} seconds to build`);
|
console.log(`${filePath} took a total of ${(end - start) / 1000} seconds to build`);
|
||||||
});
|
});
|
||||||
|
@ -236,10 +236,10 @@ export function runAppScriptsServe(testOrDemoName: string, appEntryPoint: string
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function runAppScriptsBuild(appEntryPoint: string, appNgModulePath: string, srcDir: string, distDir: string, tsConfig: string, ionicAngularDir: string, sassConfigPath: string, copyConfigPath: string) {
|
export function runAppScriptsBuild(appEntryPoint: string, appNgModulePath: string, srcDir: string, distDir: string, tsConfig: string, ionicAngularDir: string, sassConfigPath: string, copyConfigPath: string, isDev: boolean = false) {
|
||||||
const pathToAppScripts = join(NODE_MODULES_ROOT, '.bin', 'ionic-app-scripts');
|
const pathToAppScripts = join(NODE_MODULES_ROOT, '.bin', 'ionic-app-scripts');
|
||||||
const debug: boolean = argv.debug;
|
const debug: boolean = argv.debug;
|
||||||
return runWorker(pathToAppScripts, debug, appEntryPoint, appNgModulePath, srcDir, distDir, tsConfig, ionicAngularDir, sassConfigPath, copyConfigPath);
|
return runWorker(pathToAppScripts, debug, appEntryPoint, appNgModulePath, srcDir, distDir, tsConfig, ionicAngularDir, sassConfigPath, copyConfigPath, isDev);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Resolves the path for a node package executable. */
|
/** Resolves the path for a node package executable. */
|
||||||
|
@ -3,7 +3,7 @@ import { join } from 'path';
|
|||||||
|
|
||||||
import { MessageToWorker, WorkerProcess } from './interfaces';
|
import { MessageToWorker, WorkerProcess } from './interfaces';
|
||||||
|
|
||||||
export function runWorker(pathToAppScripts: string, debug: boolean, appEntryPoint: string, appNgModulePath: string, srcDir: string, distDir: string, tsConfig: string, ionicAngularDir: string, sassConfigPath: string, copyConfigPath: string) {
|
export function runWorker(pathToAppScripts: string, debug: boolean, appEntryPoint: string, appNgModulePath: string, srcDir: string, distDir: string, tsConfig: string, ionicAngularDir: string, sassConfigPath: string, copyConfigPath: string, isDev: boolean) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
|
||||||
const msgToWorker: MessageToWorker = {
|
const msgToWorker: MessageToWorker = {
|
||||||
@ -16,11 +16,13 @@ export function runWorker(pathToAppScripts: string, debug: boolean, appEntryPoin
|
|||||||
tsConfig: tsConfig,
|
tsConfig: tsConfig,
|
||||||
ionicAngularDir: ionicAngularDir,
|
ionicAngularDir: ionicAngularDir,
|
||||||
sassConfigPath: sassConfigPath,
|
sassConfigPath: sassConfigPath,
|
||||||
copyConfigPath: copyConfigPath
|
copyConfigPath: copyConfigPath,
|
||||||
|
isDev: isDev
|
||||||
};
|
};
|
||||||
|
|
||||||
const worker = <ChildProcess>createWorker(msgToWorker);
|
const worker = <ChildProcess>createWorker(msgToWorker);
|
||||||
console.log(`Starting to build test ${appEntryPoint}`);
|
|
||||||
|
console.log(`Starting to do a ${isDev ? 'dev' : 'prod'} build test ${appEntryPoint}`);
|
||||||
|
|
||||||
worker.on('error', (err: any) => {
|
worker.on('error', (err: any) => {
|
||||||
console.error(`worker error, entrypoint: ${appEntryPoint}, pid: ${worker.pid}, error: ${err}`);
|
console.error(`worker error, entrypoint: ${appEntryPoint}, pid: ${worker.pid}, error: ${err}`);
|
||||||
@ -56,8 +58,6 @@ export function createWorker(msg: MessageToWorker): any {
|
|||||||
try {
|
try {
|
||||||
let scriptArgs = [
|
let scriptArgs = [
|
||||||
'build',
|
'build',
|
||||||
'--aot',
|
|
||||||
'--optimizejs',
|
|
||||||
'--appEntryPoint', msg.appEntryPoint,
|
'--appEntryPoint', msg.appEntryPoint,
|
||||||
'--appNgModulePath', msg.appNgModulePath,
|
'--appNgModulePath', msg.appNgModulePath,
|
||||||
'--srcDir', msg.srcDir,
|
'--srcDir', msg.srcDir,
|
||||||
@ -71,9 +71,13 @@ export function createWorker(msg: MessageToWorker): any {
|
|||||||
'--sass', msg.sassConfigPath,
|
'--sass', msg.sassConfigPath,
|
||||||
'--copy', msg.copyConfigPath,
|
'--copy', msg.copyConfigPath,
|
||||||
'--enableLint', 'false',
|
'--enableLint', 'false',
|
||||||
// '--disableLogging', 'true'
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// TODO, use prod once we're a little more settled
|
||||||
|
if (!msg.isDev) {
|
||||||
|
scriptArgs.push('--aot');
|
||||||
|
}
|
||||||
|
|
||||||
if (msg.debug) {
|
if (msg.debug) {
|
||||||
scriptArgs.push('--debug');
|
scriptArgs.push('--debug');
|
||||||
}
|
}
|
||||||
|
@ -15,4 +15,5 @@ export interface MessageToWorker {
|
|||||||
ionicAngularDir: string;
|
ionicAngularDir: string;
|
||||||
sassConfigPath: string;
|
sassConfigPath: string;
|
||||||
copyConfigPath: string;
|
copyConfigPath: string;
|
||||||
|
isDev: boolean;
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user