mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
chore(): ensure scripts match v4
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import './tasks/build';
|
||||
import './tasks/clean';
|
||||
import './tasks/core';
|
||||
import './tasks/default';
|
||||
import './tasks/demos';
|
||||
import './tasks/demos.dev';
|
||||
|
||||
53
scripts/gulp/tasks/core.ts
Normal file
53
scripts/gulp/tasks/core.ts
Normal file
@@ -0,0 +1,53 @@
|
||||
import { PROJECT_ROOT } from '../constants';
|
||||
import { task } from 'gulp';
|
||||
import { accessSync } from 'fs';
|
||||
import { join } from 'path';
|
||||
|
||||
|
||||
task('core', (done) => {
|
||||
buildAngularBinding(false, done);
|
||||
});
|
||||
|
||||
task('core.watch', (done) => {
|
||||
buildAngularBinding(true, done);
|
||||
});
|
||||
|
||||
|
||||
function buildAngularBinding(isDevAndWatch: boolean, done: Function) {
|
||||
let hasRunDone = false;
|
||||
const cwd = join(PROJECT_ROOT, '../ionic-core');
|
||||
const args = [
|
||||
'run',
|
||||
'build.angular'
|
||||
];
|
||||
|
||||
if (isDevAndWatch) {
|
||||
args.push('--', 'dev', 'watch');
|
||||
}
|
||||
|
||||
try {
|
||||
accessSync(cwd);
|
||||
} catch (e) {
|
||||
console.log('core directory not found:', cwd);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const spawn = require('child_process').spawn;
|
||||
const ls = spawn('npm', args, { cwd: cwd });
|
||||
|
||||
ls.stdout.on('data', (data) => {
|
||||
console.log(data.toString().trim());
|
||||
if (!hasRunDone && data.toString().trim().indexOf('compile, done') > -1) {
|
||||
hasRunDone = true;
|
||||
done();
|
||||
}
|
||||
});
|
||||
|
||||
ls.stderr.on('data', (data) => {
|
||||
console.log(data.toString().trim());
|
||||
});
|
||||
|
||||
ls.on('close', (code) => {
|
||||
done();
|
||||
});
|
||||
}
|
||||
@@ -19,8 +19,10 @@ task('demos.watch', ['demos.prepare'], (done: Function) => {
|
||||
});
|
||||
|
||||
function serveDemo(folderName: any) {
|
||||
|
||||
const testOrDemoName = folderName;
|
||||
const ionicAngularDir = join(PROJECT_ROOT, 'src');
|
||||
const coreCompilerFilePath = join(PROJECT_ROOT, 'dist', 'ionic-angular', 'compiler');
|
||||
const coreDir = join(PROJECT_ROOT, 'dist', 'ionic-angular');
|
||||
const srcTestRoot = join(DEMOS_ROOT, 'src', folderName);
|
||||
const distDemoRoot = join(DIST_DEMOS_ROOT, folderName);
|
||||
const includeGlob = [ join(ionicAngularDir, '**', '*.ts'),
|
||||
@@ -40,5 +42,5 @@ function serveDemo(folderName: any) {
|
||||
const appNgModulePath = join(srcTestRoot, 'app', 'app.module.ts');
|
||||
const distDir = join(distDemoRoot, 'www');
|
||||
|
||||
return runAppScriptsServe(folderName, appEntryPoint, appNgModulePath, ionicAngularDir, distDir, pathToWriteFile, ionicAngularDir, sassConfigPath, copyConfigPath, watchConfigPath);
|
||||
return runAppScriptsServe(testOrDemoName, appEntryPoint, appNgModulePath, ionicAngularDir, distDir, pathToWriteFile, ionicAngularDir, coreCompilerFilePath, coreDir, sassConfigPath, copyConfigPath, watchConfigPath);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import { task } from 'gulp';
|
||||
import { ES_2015, PROJECT_ROOT } from '../constants';
|
||||
import { createTempTsConfig, getFolderInfo, runAppScriptsServe } from '../util';
|
||||
|
||||
task('e2e.watch', ['e2e.prepare'], (done: Function) => {
|
||||
task('e2e.watch', ['e2e.prepare', 'core.watch'], (done: Function) => {
|
||||
const folderInfo = getFolderInfo();
|
||||
if (!folderInfo || !folderInfo.componentName || !folderInfo.componentTest) {
|
||||
done(new Error(`Usage: gulp e2e.watch --folder nav/basic`));
|
||||
@@ -21,8 +21,10 @@ task('e2e.watch', ['e2e.prepare'], (done: Function) => {
|
||||
});
|
||||
|
||||
function serveTest(folderInfo: any) {
|
||||
|
||||
const testOrDemoName = folderInfo.componentName + '/' + folderInfo.componentTest;
|
||||
const ionicAngularDir = join(PROJECT_ROOT, 'src');
|
||||
const coreCompilerFilePath = join(PROJECT_ROOT, '..', 'ionic-core', 'dist', 'compiler');
|
||||
const coreDir = join(PROJECT_ROOT, '..', 'ionic-core', 'dist', 'compiled-ionic-angular');
|
||||
const srcTestRoot = join(PROJECT_ROOT, 'src', 'components', folderInfo.componentName, 'test', folderInfo.componentTest);
|
||||
const distTestRoot = join(PROJECT_ROOT, 'dist', 'e2e', 'components', folderInfo.componentName, 'test', folderInfo.componentTest);
|
||||
const includeGlob = [ join(ionicAngularDir, '**', '*.ts')];
|
||||
@@ -47,5 +49,5 @@ function serveTest(folderInfo: any) {
|
||||
const appNgModulePath = join(dirname(appEntryPoint), 'app.module.ts');
|
||||
const distDir = join(distTestRoot, 'www');
|
||||
|
||||
return runAppScriptsServe(folderInfo.componentName + '/' + folderInfo.componentTest, appEntryPoint, appNgModulePath, ionicAngularDir, distDir, pathToWriteFile, ionicAngularDir, sassConfigPath, copyConfigPath, null);
|
||||
return runAppScriptsServe(testOrDemoName, appEntryPoint, appNgModulePath, ionicAngularDir, distDir, pathToWriteFile, ionicAngularDir, coreCompilerFilePath, coreDir, sassConfigPath, copyConfigPath, null);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ task('e2e.prepareSass', (done: Function) => {
|
||||
done();
|
||||
});
|
||||
|
||||
task('e2e.prod', ['e2e.prepare'], (done: Function) => {
|
||||
task('e2e.prod', ['e2e.prepare', 'core'], (done: Function) => {
|
||||
// okay, first find out all of the e2e tests to run by finding all of the 'main.ts' files
|
||||
filterE2eTestfiles().then((filePaths: string[]) => {
|
||||
if (filePaths && filePaths.length > 0) {
|
||||
|
||||
@@ -194,6 +194,7 @@ task('release.copyProdVersion', () => {
|
||||
|
||||
task('release.prepareReleasePackage', (done: (err: any) => void) => {
|
||||
runSequence('clean',
|
||||
'core',
|
||||
'release.polyfill',
|
||||
'compile.release',
|
||||
'release.copyTemplates',
|
||||
|
||||
@@ -56,6 +56,10 @@ export function createTempTsConfig(includeGlob: string[], target: string, module
|
||||
}
|
||||
config.include = includeGlob;
|
||||
|
||||
config.exclude = [
|
||||
'./components/badge/**/*'
|
||||
];
|
||||
|
||||
if (overrideCompileOptions) {
|
||||
config.compilerOptions = Object.assign(config.compilerOptions, overrideCompileOptions);
|
||||
}
|
||||
@@ -188,7 +192,7 @@ export function runWebpack(pathToWebpackConfig: string, done: Function) {
|
||||
});
|
||||
}
|
||||
|
||||
export function runAppScriptsServe(testOrDemoName: string, appEntryPoint: string, appNgModulePath: string, srcDir: string, distDir: string, tsConfig: string, ionicAngularDir: string, sassConfigPath: string, copyConfigPath: string, watchConfigPath: string) {
|
||||
export function runAppScriptsServe(testOrDemoName: string, appEntryPoint: string, appNgModulePath: string, srcDir: string, distDir: string, tsConfig: string, ionicAngularDir: string, coreCompilerFilePath: string, coreDir: string, sassConfigPath: string, copyConfigPath: string, watchConfigPath: string) {
|
||||
console.log('Running ionic-app-scripts serve with', testOrDemoName);
|
||||
const deepLinksDir = dirname(dirname(appNgModulePath));
|
||||
let scriptArgs = [
|
||||
@@ -201,6 +205,8 @@ export function runAppScriptsServe(testOrDemoName: string, appEntryPoint: string
|
||||
'--tsconfig', tsConfig,
|
||||
'--readConfigJson', 'false',
|
||||
'--ionicAngularDir', ionicAngularDir,
|
||||
'--coreCompilerFilePath', coreCompilerFilePath,
|
||||
'--coreDir', coreDir,
|
||||
'--sass', sassConfigPath,
|
||||
'--copy', copyConfigPath,
|
||||
'--enableLint', 'false',
|
||||
|
||||
Reference in New Issue
Block a user