build(aio): move gulp tasks to package.json

Generate the docs with `yarn docs`.
Test the doc generation code with `yarn docs-test`

The docs are automatically built as part of the `yarn build` task,
so there is no need to rebuild them in the test_aio.sh file
This commit is contained in:
Peter Bacon Darwin 2017-03-03 11:18:15 +00:00 committed by Igor Minar
parent 8757656508
commit ab0db66bf7
8 changed files with 12 additions and 79 deletions

View File

@ -1,3 +0,0 @@
module.exports = (gulp) => () => {
// TODO:(petebd): hook up with whatever builds need doing for the webapp
};

View File

@ -1,24 +0,0 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
module.exports = {
generate: (gulp) => () => {
const path = require('path');
const Dgeni = require('dgeni');
const angularDocsPackage = require(path.resolve(__dirname, '../transforms/angular.io-package'));
const dgeni = new Dgeni([angularDocsPackage]);
return dgeni.generate();
},
test: (gulp) => () => {
const execSync = require('child_process').execSync;
execSync(
'node ../dist/tools/cjs-jasmine/index-tools ../../transforms/**/*.spec.js',
{stdio: ['inherit', 'inherit', 'inherit']});
}
};

View File

@ -1,36 +0,0 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
'use strict';
// THIS CHECK SHOULD BE THE FIRST THING IN THIS FILE
// This is to ensure that we catch env issues before we error while requiring other dependencies.
// NOTE: we are getting the value from the parent `angular/angular` package.json not the `/aio` one.
const engines = require('../package.json').engines;
require('../tools/check-environment')({
requiredNodeVersion: engines.node,
requiredNpmVersion: engines.npm,
requiredYarnVersion: engines.yarn
});
const gulp = require('gulp');
// See `tools/gulp-tasks/README.md` for information about task loading.
function loadTask(fileName, taskName) {
const taskModule = require('./build/' + fileName);
const task = taskName ? taskModule[taskName] : taskModule;
return task(gulp);
}
gulp.task('docs', ['doc-gen', 'docs-app']);
gulp.task('doc-gen', loadTask('docs', 'generate'));
gulp.task('doc-gen-test', loadTask('docs', 'test'));
gulp.task('docs-app', loadTask('docs-app'));
gulp.task('docs-app-test', () => {});
gulp.task('docs-test', ['doc-gen-test', 'docs-app-test']);
gulp.task('check-env', () => { /* this is a noop because the env test ran already above */ });

View File

@ -7,17 +7,19 @@
"license": "MIT", "license": "MIT",
"angular-cli": {}, "angular-cli": {},
"scripts": { "scripts": {
"ng": "yarn run check-env && ng", "ng": "yarn check-env && ng",
"start": "yarn run check-env && ng serve", "start": "yarn check-env && ng serve",
"build": "yarn run check-env && ng build", "build": "yarn check-env && yarn docs && ng build -prod -sm",
"test": "yarn run check-env && ng test", "test": "yarn check-env && ng test",
"lint": "yarn run check-env && ng lint", "lint": "yarn check-env && ng lint",
"pree2e": "webdriver-manager update --standalone false --gecko false", "pree2e": "webdriver-manager update --standalone false --gecko false",
"e2e": "yarn run check-env && ng e2e --no-webdriver-update", "e2e": "yarn check-env && ng e2e --no-webdriver-update",
"deploy-staging": "firebase use staging --token \"$FIREBASE_TOKEN\" && yarn run ~~deploy", "deploy-staging": "firebase use staging --token \"$FIREBASE_TOKEN\" && yarn ~~deploy",
"pre~~deploy": "yarn run check-env && ng build --prod", "pre~~deploy": "yarn build",
"~~deploy": "firebase deploy --message \"Commit: $TRAVIS_COMMIT\" --non-interactive --token \"$FIREBASE_TOKEN\"", "~~deploy": "firebase deploy --message \"Commit: $TRAVIS_COMMIT\" --non-interactive --token \"$FIREBASE_TOKEN\"",
"check-env": "gulp check-env" "check-env": "node ../tools/check-environment.js",
"docs": "dgeni ./transforms/angular.io-package",
"docs-test": "node ../dist/tools/cjs-jasmine/index-tools ../../transforms/**/*.spec.js"
}, },
"private": true, "private": true,
"dependencies": { "dependencies": {

0
scripts/ci-lite/test_aio.sh Executable file
View File

0
scripts/ci-lite/test_docs.sh Executable file
View File

View File

@ -17,12 +17,6 @@ source ${thisDir}/_travis-fold.sh
yarn run lint yarn run lint
travisFoldEnd "test.aio.lint" travisFoldEnd "test.aio.lint"
# Generate docs files
# TODO(i): why is this in 'test' phase and not in the 'build' phase?
travisFoldStart "test.aio.doc-gen"
$(npm bin)/gulp docs
travisFoldEnd "test.aio.doc-gen"
# Start xvfb for local Chrome used for testing # Start xvfb for local Chrome used for testing
if [[ ${TRAVIS} ]]; then if [[ ${TRAVIS} ]]; then

View File

@ -10,6 +10,6 @@ source ${thisDir}/_travis-fold.sh
travisFoldStart "test.docs" travisFoldStart "test.docs"
( (
cd ${PROJECT_ROOT}/aio cd ${PROJECT_ROOT}/aio
$(npm bin)/gulp docs-test yarn docs-test
) )
travisFoldEnd "test.docs" travisFoldEnd "test.docs"