From 3ca3e39d5939850c21a266b73e29c0233de29c2f Mon Sep 17 00:00:00 2001 From: Paul Gschwendtner Date: Tue, 23 Oct 2018 21:00:11 +0200 Subject: [PATCH] build: update dgeni-packages version (#13772) * Updates to the latest `dgeni-packages` version that includes: https://github.com/angular/dgeni-packages/commit/5d90fd9f31541f380a62a52fd31493b232b9585c. This allows us to remove a workaround. * Removes the closure testing stuff that hasn't been used for months. In case we want to reintroduce testing w/ Google Closure, we should consider using Bazel or something (AFAIK there are Bazel rules for closure) --- package.json | 3 +- scripts/ci/sources/mode.sh | 4 - scripts/ci/travis-testing.sh | 2 - .../closure-compiler/build-devapp-bundle.sh | 104 ------------------ scripts/closure-compiler/tsconfig-rxjs.json | 17 --- tools/dgeni/index.ts | 9 +- .../processors/no-truncate-const-type.ts | 41 ------- yarn.lock | 65 ++--------- 8 files changed, 16 insertions(+), 229 deletions(-) delete mode 100755 scripts/closure-compiler/build-devapp-bundle.sh delete mode 100644 scripts/closure-compiler/tsconfig-rxjs.json delete mode 100644 tools/dgeni/processors/no-truncate-const-type.ts diff --git a/package.json b/package.json index 5ab880a10cf..faf08cecbf7 100644 --- a/package.json +++ b/package.json @@ -79,14 +79,13 @@ "chalk": "^1.1.3", "codelyzer": "^4.3.0", "dgeni": "^0.4.10", - "dgeni-packages": "^0.26.9", + "dgeni-packages": "^0.26.11", "firebase": "^5.5.2", "firebase-admin": "^5.0.0", "firebase-tools": "^4.1.0", "fs-extra": "^3.0.1", "git-semver-tags": "^2.0.0", "glob": "^7.1.2", - "google-closure-compiler": "20170409.0.0", "gulp": "^3.9.1", "gulp-clean": "^0.3.2", "gulp-clean-css": "^3.3.1", diff --git a/scripts/ci/sources/mode.sh b/scripts/ci/sources/mode.sh index 6b40a7f5e68..8b1b178da6a 100644 --- a/scripts/ci/sources/mode.sh +++ b/scripts/ci/sources/mode.sh @@ -13,10 +13,6 @@ is_aot() { [[ "${MODE}" = aot ]] } -is_closure_compiler() { - [[ "${MODE}" = closure-compiler ]] -} - is_payload() { [[ "${MODE}" = payload ]] } diff --git a/scripts/ci/travis-testing.sh b/scripts/ci/travis-testing.sh index e81143ebe62..f70b9bb2a47 100755 --- a/scripts/ci/travis-testing.sh +++ b/scripts/ci/travis-testing.sh @@ -41,8 +41,6 @@ elif is_aot; then $(npm bin)/gulp ci:aot elif is_payload; then $(npm bin)/gulp ci:payload -elif is_closure_compiler; then - ./scripts/closure-compiler/build-devapp-bundle.sh elif is_unit; then $(npm bin)/gulp ci:test elif is_prerender; then diff --git a/scripts/closure-compiler/build-devapp-bundle.sh b/scripts/closure-compiler/build-devapp-bundle.sh deleted file mode 100755 index 1f1bd536316..00000000000 --- a/scripts/closure-compiler/build-devapp-bundle.sh +++ /dev/null @@ -1,104 +0,0 @@ -#!/bin/bash - -# Script that bundles the dev-app using the Google Closure compiler. -# This is script is used to verify closure-compatibility of all Material components. - -set -e -o pipefail - -# Go to the project root directory -cd $(dirname $0)/../.. - -# Build a release of material, material-moment-adapter, and cdk packages. -$(npm bin)/gulp material:build-release:clean -$(npm bin)/gulp cdk:build-release -$(npm bin)/gulp material-moment-adapter:build-release - -# Build demo-app with ES2015 modules. Closure compiler is then able to parse imports. -$(npm bin)/gulp :build:devapp:assets :build:devapp:scss -$(npm bin)/tsc -p src/demo-app/tsconfig-build.json --target ES2015 --module ES2015 - -# Create a list of all RxJS source files. -rxjsSourceFiles=$(find node_modules/rxjs/ -name '*.js'); - -# List of entry points in the CDK package. Exclude "testing" since it's not an entry point. -cdkEntryPoints=($(find src/cdk -maxdepth 1 -mindepth 1 -type d -not -name testing -exec basename {} \;)) - -OPTS=( - "--language_in=ES6_STRICT" - "--language_out=ES5" - "--compilation_level=ADVANCED_OPTIMIZATIONS" - "--js_output_file=dist/closure/closure-bundle.js" - "--variable_renaming_report=dist/closure/variable_renaming_report" - "--property_renaming_report=dist/closure/property_renaming_report" - "--warning_level=QUIET" - "--rewrite_polyfills=false" - "--module_resolution=node" - "--process_common_js_modules" - - # List of path prefixes to be removed from ES6 & CommonJS modules. - "--js_module_root=dist/packages" - "--js_module_root=dist/releases/material" - "--js_module_root=dist/releases/cdk" - "--js_module_root=dist/releases/material-moment-adapter" - "--js_module_root=node_modules/@angular/core" - "--js_module_root=node_modules/@angular/common" - "--js_module_root=node_modules/@angular/common/http" - "--js_module_root=node_modules/@angular/compiler" - "--js_module_root=node_modules/@angular/forms" - "--js_module_root=node_modules/@angular/router" - "--js_module_root=node_modules/@angular/platform-browser" - "--js_module_root=node_modules/@angular/platform-browser/animations" - "--js_module_root=node_modules/@angular/platform-browser-dynamic" - "--js_module_root=node_modules/@angular/animations" - "--js_module_root=node_modules/@angular/animations/browser" - "--js_module_root=node_modules/moment" - - # Flags to simplify debugging. - "--formatting=PRETTY_PRINT" - "--debug" - - # Include the Material and CDK FESM bundles - dist/releases/material/esm2015/material.js - dist/releases/cdk/esm2015/cdk.js - dist/releases/material-moment-adapter/esm2015/material-moment-adapter.js - - # Include all Angular FESM bundles. - node_modules/@angular/core/esm5/index.js - node_modules/@angular/common/esm5/index.js - node_modules/@angular/common/esm5/http.js - node_modules/@angular/compiler/esm5/index.js - node_modules/@angular/forms/esm5/index.js - node_modules/@angular/http/esm5/index.js - node_modules/@angular/router/esm5/index.js - node_modules/@angular/platform-browser/esm5/index.js - node_modules/@angular/platform-browser/esm5/animations/index.js - node_modules/@angular/platform-browser-dynamic/esm5/index.js - node_modules/@angular/animations/esm5/index.js - node_modules/@angular/animations/esm5/browser/index.js - - # Include other dependencies like Zone.js, Moment.js, and RxJS - node_modules/zone.js/dist/zone.js - node_modules/moment/moment.js - $rxjsSourceFiles - - # Include all files from the demo-app package. - $(find dist/packages/demo-app -name '*.js') - - "--entry_point=./dist/packages/demo-app/main.js" - "--dependency_mode=STRICT" -) - -# Walk through every entry-point of the CDK and add it to closure options. -for i in "${cdkEntryPoints[@]}"; do - OPTS+=("--js_module_root=dist/releases/cdk/${i}") - OPTS+=("dist/releases/cdk/esm2015/${i}.js") -done - -# Write closure flags to a closure flagfile. -closureFlags=$(mktemp) -echo ${OPTS[*]} > $closureFlags - -# Run the Google Closure compiler java runnable. -java -jar node_modules/google-closure-compiler/compiler.jar --flagfile $closureFlags - -echo "Finished bundling the dev-app using Google Closure Compiler." diff --git a/scripts/closure-compiler/tsconfig-rxjs.json b/scripts/closure-compiler/tsconfig-rxjs.json deleted file mode 100644 index 032d77f6d02..00000000000 --- a/scripts/closure-compiler/tsconfig-rxjs.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "compilerOptions": { - "module": "es2015", - "outDir": "../../dist/packages/rxjs", - "target": "es5", - "lib": ["es2015", "dom"], - "types": [] - }, - "files": [ - "../../node_modules/rxjs/src/Rx.ts" - ], - "angularCompilerOptions": { - "annotateForClosureCompiler": true, - "skipMetadataEmit": true, - "skipTemplateCodegen": true - } -} diff --git a/tools/dgeni/index.ts b/tools/dgeni/index.ts index bbafc1feafb..d0518fe15da 100644 --- a/tools/dgeni/index.ts +++ b/tools/dgeni/index.ts @@ -9,9 +9,9 @@ import {MergeInheritedProperties} from './processors/merge-inherited-properties' import {EntryPointGrouper} from './processors/entry-point-grouper'; import {ReadTypeScriptModules} from 'dgeni-packages/typescript/processors/readTypeScriptModules'; import {TsParser} from 'dgeni-packages/typescript/services/TsParser'; +import {TypeFormatFlags} from 'dgeni-packages/node_modules/typescript'; import {sync as globSync} from 'glob'; import * as path from 'path'; -import {NoTruncateConstTypeProcessor} from './processors/no-truncate-const-type'; // Dgeni packages that the Material docs package depends on. const jsdocPackage = require('dgeni-packages/jsdoc'); @@ -52,9 +52,6 @@ export const apiDocsPackage = new Package('material2-api-docs', [ typescriptPackage, ]); -// Processor that ensures that Dgeni const docs don't truncate the resolved type string. -apiDocsPackage.processor(new NoTruncateConstTypeProcessor()); - // Processor that filters out duplicate exports that should not be shown in the docs. apiDocsPackage.processor(new FilterDuplicateExports()); @@ -138,6 +135,10 @@ apiDocsPackage.config((tsHost: Host) => { // should only use the first leading comment, we need to disable comment concatenation. // See for example: src/cdk/coercion/boolean-property.ts tsHost.concatMultipleLeadingComments = false; + + // Explicitly disable truncation for types that will be displayed as strings. Otherwise + // TypeScript by default truncates long types and causes misleading API documentation. + tsHost.typeFormatFlags = TypeFormatFlags.NoTruncation; }); // Configure processor for finding nunjucks templates. diff --git a/tools/dgeni/processors/no-truncate-const-type.ts b/tools/dgeni/processors/no-truncate-const-type.ts deleted file mode 100644 index e0637b13d00..00000000000 --- a/tools/dgeni/processors/no-truncate-const-type.ts +++ /dev/null @@ -1,41 +0,0 @@ -import {DocCollection, Processor} from 'dgeni'; -import {Type, TypeChecker, TypeFormatFlags} from 'dgeni-packages/node_modules/typescript'; -import {ConstExportDoc} from 'dgeni-packages/typescript/api-doc-types/ConstExportDoc'; - -/** - * Processor that works around a Dgeni TypeScript package issue where the type of a constant export - * is automatically truncated. - * - * Truncation of the type strings is causing unexpected results and also results in - * misleading documentation. See https://github.com/angular/dgeni-packages/issues/276 - */ -export class NoTruncateConstTypeProcessor implements Processor { - name = 'no-truncate-const-type'; - $runBefore = ['categorizer']; - - $process(docs: DocCollection) { - return docs - .filter(doc => doc.docType === 'const') - .forEach(doc => doc.type && this.refreshResolvedTypeString(doc)); - } - - /** Refreshes the determined type string of the specified export const document. */ - private refreshResolvedTypeString(doc: ConstExportDoc) { - const {variableDeclaration, typeChecker} = doc; - - // Logic is aligned with the actual logic from the ConstExportDoc. - // dgeni-packages#typescript/src/api-doc-types/ConstExportDoc.ts#L22 - if (variableDeclaration.type) { - doc.type = this.typeToString( - typeChecker, typeChecker.getTypeFromTypeNode(variableDeclaration.type)); - } else if (variableDeclaration.initializer) { - doc.type = this.typeToString( - typeChecker, typeChecker.getTypeAtLocation(variableDeclaration.initializer)); - } - } - - /** Converts the specified type to a string that represents the type declaration. */ - private typeToString(typeChecker: TypeChecker, type: Type): string { - return typeChecker.typeToString(type, undefined, TypeFormatFlags.NoTruncation); - } -} diff --git a/yarn.lock b/yarn.lock index 47bda0c7d45..da4757d12d2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2398,11 +2398,6 @@ cliui@^4.0.0: strip-ansi "^4.0.0" wrap-ansi "^2.0.0" -clone-buffer@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/clone-buffer/-/clone-buffer-1.0.0.tgz#e3e25b207ac4e701af721e2cb5a16792cac3dc58" - integrity sha1-4+JbIHrE5wGvch4staFnksrD3Fg= - clone-regexp@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/clone-regexp/-/clone-regexp-1.0.1.tgz#051805cd33173375d82118fc0918606da39fd60f" @@ -2423,11 +2418,6 @@ clone-stats@^0.0.1, clone-stats@~0.0.1: resolved "https://registry.yarnpkg.com/clone-stats/-/clone-stats-0.0.1.tgz#b88f94a82cf38b8791d58046ea4029ad88ca99d1" integrity sha1-uI+UqCzzi4eR1YBG6kAprYjKmdE= -clone-stats@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/clone-stats/-/clone-stats-1.0.0.tgz#b3782dff8bb5474e18b9b6bf0fdfe782f8777680" - integrity sha1-s3gt/4u1R04Yuba/D9/ngvh3doA= - clone@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/clone/-/clone-0.2.0.tgz#c6126a90ad4f72dbf5acdb243cc37724fe93fc1f" @@ -2438,20 +2428,6 @@ clone@^1.0.0, clone@^1.0.2: resolved "https://registry.yarnpkg.com/clone/-/clone-1.0.4.tgz#da309cc263df15994c688ca902179ca3c7cd7c7e" integrity sha1-2jCcwmPfFZlMaIypAheco8fNfH4= -clone@^2.1.1: - version "2.1.2" - resolved "https://registry.yarnpkg.com/clone/-/clone-2.1.2.tgz#1b7f4b9f591f1e8f83670401600345a02887435f" - integrity sha1-G39Ln1kfHo+DZwQBYANFoCiHQ18= - -cloneable-readable@^1.0.0: - version "1.1.2" - resolved "https://registry.yarnpkg.com/cloneable-readable/-/cloneable-readable-1.1.2.tgz#d591dee4a8f8bc15da43ce97dceeba13d43e2a65" - integrity sha512-Bq6+4t+lbM8vhTs/Bef5c5AdEMtapp/iFb6+s4/Hh9MVTt8OLKH7ZOOZSCT+Ys7hsHvqv0GuMPJ1lnQJVHvxpg== - dependencies: - inherits "^2.0.1" - process-nextick-args "^2.0.0" - readable-stream "^2.3.5" - co@^4.6.0: version "4.6.0" resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" @@ -3297,10 +3273,10 @@ detect-libc@^1.0.2: resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-1.0.3.tgz#fa137c4bd698edf55cd5cd02ac559f91a4c4ba9b" integrity sha1-+hN8S9aY7fVc1c0CrFWfkaTEups= -dgeni-packages@^0.26.9: - version "0.26.10" - resolved "https://registry.yarnpkg.com/dgeni-packages/-/dgeni-packages-0.26.10.tgz#d16d7b4e1f47d89c29e737c729e3e4b8d8b03085" - integrity sha512-8ZXS6ltUitJhK/q/jX+vRJjSSiYC3DsezjH3WRNPM5dmkSP3sCe0nh8xxKv82TPA+lcgQSZwMH8w+13ErE7ikw== +dgeni-packages@^0.26.11: + version "0.26.11" + resolved "https://registry.yarnpkg.com/dgeni-packages/-/dgeni-packages-0.26.11.tgz#88659a36d99d1ac69e33e7d09eaab5df2028b0e9" + integrity sha512-9b8WBQLX3szU7PFOnefbIBG2JRCwaysTK0xpR/zJWXnI+t41roQn2923q/fmnFFQ014d4AK/X482ihVnZ/VWJQ== dependencies: canonical-path "0.0.2" catharsis "^0.8.1" @@ -4957,15 +4933,6 @@ google-auto-auth@^0.7.2: google-auth-library "^0.10.0" request "^2.79.0" -google-closure-compiler@20170409.0.0: - version "20170409.0.0" - resolved "https://registry.yarnpkg.com/google-closure-compiler/-/google-closure-compiler-20170409.0.0.tgz#dc1be29a9f7eef8611364533b271b9fac757c970" - integrity sha1-3Bvimp9+74YRNkUzsnG5+sdXyXA= - dependencies: - chalk "^1.0.0" - vinyl "^2.0.1" - vinyl-sourcemaps-apply "^0.2.0" - google-gax@^0.17.1: version "0.17.1" resolved "https://registry.yarnpkg.com/google-gax/-/google-gax-0.17.1.tgz#825ead4ab68f1cb3a702ed0a6c64d7ac9b882747" @@ -9114,16 +9081,16 @@ pretty-hrtime@^1.0.0: resolved "https://registry.yarnpkg.com/pretty-hrtime/-/pretty-hrtime-1.0.3.tgz#b7e3ea42435a4c9b2759d99e0f201eb195802ee1" integrity sha1-t+PqQkNaTJsnWdmeDyAesZWALuE= -process-nextick-args@^2.0.0, process-nextick-args@~2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.0.tgz#a37d732f4271b4ab1ad070d35508e8290788ffaa" - integrity sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw== - process-nextick-args@~1.0.6: version "1.0.7" resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-1.0.7.tgz#150e20b756590ad3f91093f25a4f2ad8bff30ba3" integrity sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M= +process-nextick-args@~2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.0.tgz#a37d732f4271b4ab1ad070d35508e8290788ffaa" + integrity sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw== + progress@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.0.tgz#8a1be366bf8fc23db2bd23f10c6fe920b4389d1f" @@ -9717,7 +9684,7 @@ replace-ext@0.0.1: resolved "https://registry.yarnpkg.com/replace-ext/-/replace-ext-0.0.1.tgz#29bbd92078a739f0bcce2b4ee41e837953522924" integrity sha1-KbvZIHinOfC8zitO5B6DeVNSKSQ= -replace-ext@1.0.0, replace-ext@^1.0.0: +replace-ext@1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/replace-ext/-/replace-ext-1.0.0.tgz#de63128373fcbf7c3ccfa4de5a480c45a67958eb" integrity sha1-3mMSg3P8v3w8z6TeWkgMRaZ5WOs= @@ -12109,18 +12076,6 @@ vinyl@^0.5.0: clone-stats "^0.0.1" replace-ext "0.0.1" -vinyl@^2.0.1: - version "2.2.0" - resolved "https://registry.yarnpkg.com/vinyl/-/vinyl-2.2.0.tgz#d85b07da96e458d25b2ffe19fece9f2caa13ed86" - integrity sha512-MBH+yP0kC/GQ5GwBqrTPTzEfiiLjta7hTtvQtbxBgTeSXsmKQRQecjibMbxIXzVT3Y9KJK+drOz1/k+vsu8Nkg== - dependencies: - clone "^2.1.1" - clone-buffer "^1.0.0" - clone-stats "^1.0.0" - cloneable-readable "^1.0.0" - remove-trailing-separator "^1.0.1" - replace-ext "^1.0.0" - vlq@^0.2.2: version "0.2.3" resolved "https://registry.yarnpkg.com/vlq/-/vlq-0.2.3.tgz#8f3e4328cf63b1540c0d67e1b2778386f8975b26"