build(aio): remove `--` from more yarn commands (#19421)

This commit is contained in:
George Kalpakas 2017-09-28 19:29:04 +03:00 committed by Victor Berchet
parent 0e00265647
commit f7199aa8c8
2 changed files with 18 additions and 17 deletions

View File

@ -30,7 +30,7 @@ Here are the most important tasks you might need to use:
* `yarn docs-lint` - check that the doc gen code follows our style rules. * `yarn docs-lint` - check that the doc gen code follows our style rules.
* `yarn docs-test` - run the unit tests for the doc generation code. * `yarn docs-test` - run the unit tests for the doc generation code.
* `yarn boilerplate:add` - generate all the boilerplate code for the examples, so that they can be run locally. Add the option `-- --local` to use your local version of Angular contained in the "dist" folder. * `yarn boilerplate:add` - generate all the boilerplate code for the examples, so that they can be run locally. Add the option `--local` to use your local version of Angular contained in the "dist" folder.
* `yarn boilerplate:remove` - remove all the boilerplate code that was added via `yarn boilerplate:add`. * `yarn boilerplate:remove` - remove all the boilerplate code that was added via `yarn boilerplate:add`.
* `yarn generate-plunkers` - generate the plunker files that are used by the `live-example` tags in the docs. * `yarn generate-plunkers` - generate the plunker files that are used by the `live-example` tags in the docs.
* `yarn generate-zips` - generate the zip files from the examples. Zip available via the `live-example` tags in the docs. * `yarn generate-zips` - generate the zip files from the examples. Zip available via the `live-example` tags in the docs.

View File

@ -48,13 +48,13 @@ function runE2e() {
if (argv.setup) { if (argv.setup) {
// Run setup. // Run setup.
console.log('runE2e: copy boilerplate'); console.log('runE2e: copy boilerplate');
const spawnInfo = spawnExt('yarn', ['boilerplate:add', '--', argv.local ? '--local' : ''], { cwd: AIO_PATH }); const spawnInfo = spawnExt('yarn', ['boilerplate:add', argv.local ? '--local' : ''], { cwd: AIO_PATH });
promise = spawnInfo.promise promise = spawnInfo.promise
.then(() => { .then(() => {
console.log('runE2e: update webdriver'); console.log('runE2e: update webdriver');
return spawnExt('yarn', ['webdriver:update'], { cwd: SHARED_PATH }).promise; return spawnExt('yarn', ['webdriver:update'], { cwd: SHARED_PATH }).promise;
}); });
}; }
const outputFile = path.join(AIO_PATH, './protractor-results.txt'); const outputFile = path.join(AIO_PATH, './protractor-results.txt');
@ -91,7 +91,7 @@ function findAndRunE2eTests(filter, outputFile, shard) {
.then(e2eSpecPaths => { .then(e2eSpecPaths => {
Object.keys(e2eSpecPaths).forEach(key => { Object.keys(e2eSpecPaths).forEach(key => {
const value = e2eSpecPaths[key]; const value = e2eSpecPaths[key];
e2eSpecPaths[key] = value.filter((p, index) => index % shardDivider === shardModulo) e2eSpecPaths[key] = value.filter((p, index) => index % shardDivider === shardModulo);
}); });
return e2eSpecPaths.systemjs.reduce((promise, specPath) => { return e2eSpecPaths.systemjs.reduce((promise, specPath) => {
@ -111,13 +111,14 @@ function findAndRunE2eTests(filter, outputFile, shard) {
arr.push(specPath); arr.push(specPath);
}); });
}); });
}, Promise.resolve()) }, Promise.resolve());
})})
.then(() => {
const stopTime = new Date().getTime();
status.elapsedTime = (stopTime - startTime) / 1000;
return status;
}); });
})
.then(() => {
const stopTime = new Date().getTime();
status.elapsedTime = (stopTime - startTime) / 1000;
return status;
});
} }
// Start the example in appDir; then run protractor with the specified // Start the example in appDir; then run protractor with the specified
@ -128,7 +129,7 @@ function runE2eTestsSystemJS(appDir, outputFile) {
const config = loadExampleConfig(appDir); const config = loadExampleConfig(appDir);
const appBuildSpawnInfo = spawnExt('yarn', [config.build], { cwd: appDir }); const appBuildSpawnInfo = spawnExt('yarn', [config.build], { cwd: appDir });
const appRunSpawnInfo = spawnExt('yarn', [config.run, '--', '-s'], { cwd: appDir }, true); const appRunSpawnInfo = spawnExt('yarn', [config.run, '-s'], { cwd: appDir }, true);
let run = runProtractorSystemJS(appBuildSpawnInfo.promise, appDir, appRunSpawnInfo, outputFile); let run = runProtractorSystemJS(appBuildSpawnInfo.promise, appDir, appRunSpawnInfo, outputFile);
@ -147,12 +148,12 @@ function runProtractorSystemJS(prepPromise, appDir, appRunSpawnInfo, outputFile)
fs.appendFileSync(outputFile, emsg); fs.appendFileSync(outputFile, emsg);
return Promise.reject(emsg); return Promise.reject(emsg);
}) })
.then(function (data) { .then(function () {
let transpileError = false; let transpileError = false;
// Start protractor. // Start protractor.
const spawnInfo = spawnExt('yarn', ['protractor', '--', const spawnInfo = spawnExt('yarn', ['protractor',
PROTRACTOR_CONFIG_FILENAME, PROTRACTOR_CONFIG_FILENAME,
`--specs=${specFilename}`, `--specs=${specFilename}`,
'--params.appDir=' + appDir, '--params.appDir=' + appDir,
@ -162,19 +163,19 @@ function runProtractorSystemJS(prepPromise, appDir, appRunSpawnInfo, outputFile)
spawnInfo.proc.stderr.on('data', function (data) { spawnInfo.proc.stderr.on('data', function (data) {
transpileError = transpileError || /npm ERR! Exit status 100/.test(data.toString()); transpileError = transpileError || /npm ERR! Exit status 100/.test(data.toString());
}); });
return spawnInfo.promise.catch(function (err) { return spawnInfo.promise.catch(function () {
if (transpileError) { if (transpileError) {
const emsg = `${specFilename} failed to transpile.\n\n`; const emsg = `${specFilename} failed to transpile.\n\n`;
console.log(emsg); console.log(emsg);
fs.appendFileSync(outputFile, emsg); fs.appendFileSync(outputFile, emsg);
} }
return Promise.reject(emsg); return Promise.reject();
}); });
}) })
.then( .then(
function () { return finish(appRunSpawnInfo.proc.pid, true); }, function () { return finish(appRunSpawnInfo.proc.pid, true); },
function () { return finish(appRunSpawnInfo.proc.pid, false); } function () { return finish(appRunSpawnInfo.proc.pid, false); }
) );
} }
function finish(spawnProcId, ok) { function finish(spawnProcId, ok) {
@ -243,7 +244,7 @@ function reportStatus(status, outputFile) {
function spawnExt(command, args, options, ignoreClose = false) { function spawnExt(command, args, options, ignoreClose = false) {
let proc; let proc;
const promise = new Promise((resolve, reject) => { const promise = new Promise((resolve, reject) => {
let descr = command + " " + args.join(' '); let descr = command + ' ' + args.join(' ');
console.log('running: ' + descr); console.log('running: ' + descr);
try { try {
proc = xSpawn.spawn(command, args, options); proc = xSpawn.spawn(command, args, options);