chore(): begin adding ionic components to mono-repo.

This commit is contained in:
Josh Thomas
2017-06-21 09:33:06 -05:00
parent 1181fe98fc
commit bd5b67304d
2159 changed files with 15687 additions and 147 deletions

View File

@ -0,0 +1,53 @@
import { dirname, join } from 'path';
import { readFileSync } from 'fs';
import { task } from 'gulp';
import { ES_2015, PROJECT_ROOT } from '../constants';
import { createTempTsConfig, getFolderInfo, runAppScriptsServe } from '../util';
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`));
return;
}
serveTest(folderInfo).then(() => {
done();
}).catch((err: Error) => {
done(err);
});
});
function serveTest(folderInfo: any) {
const testOrDemoName = join(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')];
const pathToWriteFile = join(distTestRoot, 'tsconfig.json');
const pathToReadFile = join(PROJECT_ROOT, 'tsconfig.json');
createTempTsConfig(includeGlob, ES_2015, ES_2015, pathToReadFile, pathToWriteFile, { removeComments: true});
const sassConfigPath = join('scripts', 'e2e', 'sass.config.js');
const copyConfigPath = join('scripts', 'e2e', 'copy.config.js');
let appEntryPoint = join(srcTestRoot, 'app', 'main.ts');
try {
// check if the entry point exists, otherwise fall back to the legacy entry point without 'app' folder
readFileSync(appEntryPoint);
} catch (ex) {
// the file doesn't exist, so use the legacy entry point
appEntryPoint = join(srcTestRoot, 'main.ts');
}
// this assume that app.module.ts and main.ts are peers, which they should be no matter what
const appNgModulePath = join(dirname(appEntryPoint), 'app.module.ts');
const distDir = join(distTestRoot, 'www');
return runAppScriptsServe(testOrDemoName, appEntryPoint, appNgModulePath, ionicAngularDir, distDir, pathToWriteFile, ionicAngularDir, coreCompilerFilePath, coreDir, sassConfigPath, copyConfigPath, null);
}