From ab0db66bf7fbb582cb96a9960e9235b901493313 Mon Sep 17 00:00:00 2001 From: Peter Bacon Darwin Date: Fri, 3 Mar 2017 11:18:15 +0000 Subject: [PATCH] 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 --- aio/build/docs-app.js | 3 --- aio/build/docs.js | 24 ------------------------ aio/gulpfile.js | 36 ------------------------------------ aio/package.json | 20 +++++++++++--------- scripts/ci-lite/test_aio.sh | 0 scripts/ci-lite/test_docs.sh | 0 scripts/ci/test-aio.sh | 6 ------ scripts/ci/test-docs.sh | 2 +- 8 files changed, 12 insertions(+), 79 deletions(-) delete mode 100644 aio/build/docs-app.js delete mode 100644 aio/build/docs.js delete mode 100644 aio/gulpfile.js create mode 100755 scripts/ci-lite/test_aio.sh create mode 100755 scripts/ci-lite/test_docs.sh diff --git a/aio/build/docs-app.js b/aio/build/docs-app.js deleted file mode 100644 index d092bf7829..0000000000 --- a/aio/build/docs-app.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = (gulp) => () => { - // TODO:(petebd): hook up with whatever builds need doing for the webapp -}; diff --git a/aio/build/docs.js b/aio/build/docs.js deleted file mode 100644 index 8e6e042473..0000000000 --- a/aio/build/docs.js +++ /dev/null @@ -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']}); - } -}; diff --git a/aio/gulpfile.js b/aio/gulpfile.js deleted file mode 100644 index 7ea457f8f9..0000000000 --- a/aio/gulpfile.js +++ /dev/null @@ -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 */ }); diff --git a/aio/package.json b/aio/package.json index 6cb344c41a..b1d4db6cef 100644 --- a/aio/package.json +++ b/aio/package.json @@ -7,17 +7,19 @@ "license": "MIT", "angular-cli": {}, "scripts": { - "ng": "yarn run check-env && ng", - "start": "yarn run check-env && ng serve", - "build": "yarn run check-env && ng build", - "test": "yarn run check-env && ng test", - "lint": "yarn run check-env && ng lint", + "ng": "yarn check-env && ng", + "start": "yarn check-env && ng serve", + "build": "yarn check-env && yarn docs && ng build -prod -sm", + "test": "yarn check-env && ng test", + "lint": "yarn check-env && ng lint", "pree2e": "webdriver-manager update --standalone false --gecko false", - "e2e": "yarn run check-env && ng e2e --no-webdriver-update", - "deploy-staging": "firebase use staging --token \"$FIREBASE_TOKEN\" && yarn run ~~deploy", - "pre~~deploy": "yarn run check-env && ng build --prod", + "e2e": "yarn check-env && ng e2e --no-webdriver-update", + "deploy-staging": "firebase use staging --token \"$FIREBASE_TOKEN\" && yarn ~~deploy", + "pre~~deploy": "yarn build", "~~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, "dependencies": { diff --git a/scripts/ci-lite/test_aio.sh b/scripts/ci-lite/test_aio.sh new file mode 100755 index 0000000000..e69de29bb2 diff --git a/scripts/ci-lite/test_docs.sh b/scripts/ci-lite/test_docs.sh new file mode 100755 index 0000000000..e69de29bb2 diff --git a/scripts/ci/test-aio.sh b/scripts/ci/test-aio.sh index a15504465e..2a16433143 100755 --- a/scripts/ci/test-aio.sh +++ b/scripts/ci/test-aio.sh @@ -17,12 +17,6 @@ source ${thisDir}/_travis-fold.sh yarn run 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 if [[ ${TRAVIS} ]]; then diff --git a/scripts/ci/test-docs.sh b/scripts/ci/test-docs.sh index 9368d12898..74d8a90593 100755 --- a/scripts/ci/test-docs.sh +++ b/scripts/ci/test-docs.sh @@ -10,6 +10,6 @@ source ${thisDir}/_travis-fold.sh travisFoldStart "test.docs" ( cd ${PROJECT_ROOT}/aio - $(npm bin)/gulp docs-test + yarn docs-test ) travisFoldEnd "test.docs"