Skip to content

Commit

Permalink
feat(ngcc): expose --create-ivy-entry-points option on ivy-ngcc (#3…
Browse files Browse the repository at this point in the history
…3049)

This allows a postinstall hook to generate the same
output as the CLI integration does.

See #32999 (comment)

PR Close #33049
  • Loading branch information
petebacondarwin authored and alxhub committed Oct 9, 2019
1 parent 9f0c549 commit b2b917d
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 48 deletions.
3 changes: 2 additions & 1 deletion integration/cli-hello-world-ivy-compat/package.json
Expand Up @@ -7,7 +7,8 @@
"e2e": "ng e2e --webdriver-update=false",
"lint": "ng lint",
"ng": "ng",
"postinstall": "webdriver-manager update --gecko=false --standalone=false $CI_CHROMEDRIVER_VERSION_ARG",
"postinstall": "yarn update-webdriver && yarn ivy-ngcc --properties es2015 --create-ivy-entry-points",
"update-webdriver": "webdriver-manager update --gecko=false --standalone=false $CI_CHROMEDRIVER_VERSION_ARG",
"start": "ng serve",
"pretest": "ng version",
"test": "ng test --progress=false --watch=false && yarn e2e --configuration=ci && yarn e2e --configuration=ci-production"
Expand Down
88 changes: 41 additions & 47 deletions integration/cli-hello-world-ivy-compat/yarn.lock
Expand Up @@ -124,7 +124,7 @@
rxjs "6.4.0"

"@angular/animations@file:../../dist/packages-dist/animations":
version "8.0.0-rc.0"
version "9.0.0-next.9"
dependencies:
tslib "^1.9.0"

Expand All @@ -149,12 +149,12 @@
uuid "^3.3.2"

"@angular/common@file:../../dist/packages-dist/common":
version "8.0.0-rc.0"
version "0.0.0"
dependencies:
tslib "^1.9.0"

"@angular/compiler-cli@file:../../dist/packages-dist/compiler-cli":
version "8.0.0-rc.0"
version "9.0.0-next.9"
dependencies:
canonical-path "1.0.0"
chokidar "^2.1.1"
Expand All @@ -163,41 +163,40 @@
magic-string "^0.25.0"
minimist "^1.2.0"
reflect-metadata "^0.1.2"
shelljs "^0.8.1"
source-map "^0.6.1"
tslib "^1.9.0"
yargs "13.1.0"

"@angular/compiler@file:../../dist/packages-dist/compiler":
version "8.0.0-rc.0"
version "9.0.0-next.9"
dependencies:
tslib "^1.9.0"

"@angular/core@file:../../dist/packages-dist/core":
version "8.0.0-rc.0"
version "0.0.0"
dependencies:
tslib "^1.9.0"

"@angular/forms@file:../../dist/packages-dist/forms":
version "8.0.0-rc.0"
version "9.0.0-next.9"
dependencies:
tslib "^1.9.0"

"@angular/language-service@file:../../dist/packages-dist/language-service":
version "8.0.0-rc.0"
version "9.0.0-next.9"

"@angular/platform-browser-dynamic@file:../../dist/packages-dist/platform-browser-dynamic":
version "8.0.0-rc.0"
version "9.0.0-next.9"
dependencies:
tslib "^1.9.0"

"@angular/platform-browser@file:../../dist/packages-dist/platform-browser":
version "8.0.0-rc.0"
version "9.0.0-next.9"
dependencies:
tslib "^1.9.0"

"@angular/router@file:../../dist/packages-dist/router":
version "8.0.0-rc.0"
version "9.0.0-next.9"
dependencies:
tslib "^1.9.0"

Expand Down Expand Up @@ -899,7 +898,7 @@ aws4@^1.8.0:
resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.8.0.tgz#f0e003d9ca9e7f59c7a508945d7b2ef9a04a542f"
integrity sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==

babel-code-frame@^6.22.0, babel-code-frame@^6.26.0:
babel-code-frame@^6.26.0:
version "6.26.0"
resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b"
integrity sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=
Expand Down Expand Up @@ -2830,7 +2829,7 @@ glob@7.0.x:
once "^1.3.0"
path-is-absolute "^1.0.0"

glob@7.1.3, glob@^7.0.0, glob@^7.0.3, glob@^7.0.5, glob@^7.0.6, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3:
glob@7.1.3, glob@^7.0.3, glob@^7.0.5, glob@^7.0.6, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3:
version "7.1.3"
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.3.tgz#3960832d3f1574108342dafd3a67b332c0969df1"
integrity sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==
Expand Down Expand Up @@ -3235,11 +3234,6 @@ internal-ip@^4.2.0:
default-gateway "^4.2.0"
ipaddr.js "^1.9.0"

interpret@^1.0.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.1.0.tgz#7ed1b1410c6a0e0f78cf95d3b8440c63f78b8614"
integrity sha1-ftGxQQxqDg94z5XTuEQMY/eLhhQ=

invariant@^2.2.2:
version "2.2.4"
resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.4.tgz#610f3c92c9359ce1db616e538008d23ff35158e6"
Expand Down Expand Up @@ -3662,14 +3656,22 @@ js-tokens@^3.0.2:
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b"
integrity sha1-mGbfOVECEw449/mWvOtlRDIJwls=

js-yaml@^3.12.0, js-yaml@^3.7.0, js-yaml@^3.9.0:
js-yaml@^3.12.0, js-yaml@^3.9.0:
version "3.12.0"
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.12.0.tgz#eaed656ec8344f10f527c6bfa1b6e2244de167d1"
integrity sha512-PIt2cnwmPfL4hKNwqeiuz4bKfnzHTBv6HyVgjahA6mPLwPDzjDWrplJBMjHUFxku/N3FlmrbyPclad+I+4mJ3A==
dependencies:
argparse "^1.0.7"
esprima "^4.0.0"

js-yaml@^3.13.1:
version "3.13.1"
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.13.1.tgz#aff151b30bfdfa8e49e05da22e7415e9dfa37847"
integrity sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==
dependencies:
argparse "^1.0.7"
esprima "^4.0.0"

jsbn@~0.1.0:
version "0.1.1"
resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513"
Expand Down Expand Up @@ -5309,13 +5311,6 @@ readdirp@^2.0.0, readdirp@^2.2.1:
micromatch "^3.1.10"
readable-stream "^2.0.2"

rechoir@^0.6.2:
version "0.6.2"
resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.6.2.tgz#85204b54dba82d5742e28c96756ef43af50e3384"
integrity sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q=
dependencies:
resolve "^1.1.6"

reflect-metadata@^0.1.2:
version "0.1.12"
resolved "https://registry.yarnpkg.com/reflect-metadata/-/reflect-metadata-0.1.12.tgz#311bf0c6b63cd782f228a81abe146a2bfa9c56f2"
Expand Down Expand Up @@ -5455,7 +5450,7 @@ resolve-url@^0.2.1:
resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a"
integrity sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=

resolve@^1.1.6, resolve@^1.1.7, resolve@^1.3.2:
resolve@^1.1.7, resolve@^1.3.2:
version "1.9.0"
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.9.0.tgz#a14c6fdfa8f92a7df1d996cb7105fa744658ea06"
integrity sha512-TZNye00tI67lwYvzxCxHGjwTNlUV70io54/Ed4j6PscB8xVfuBJpRenI/o6dVk0cY0PYTY27AgCoGGxRnYuItQ==
Expand Down Expand Up @@ -5521,8 +5516,10 @@ run-queue@^1.0.0, run-queue@^1.0.3:
dependencies:
aproba "^1.1.1"

rxjs@6.4.0, "rxjs@file:../../node_modules/rxjs":
rxjs@6.4.0:
version "6.4.0"
resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.4.0.tgz#f3bb0fe7bda7fb69deac0c16f17b50b0b8790504"
integrity sha512-Z9Yfa11F6B9Sg/BK9MnqnQ+aQYicPLtilXBp2yUtDt2JRCE0h26d33EnfO3ZxoNxG0T92OUucP3Ct7cpfkdFfw==
dependencies:
tslib "^1.9.0"

Expand All @@ -5533,6 +5530,11 @@ rxjs@^6.4.0:
dependencies:
tslib "^1.9.0"

"rxjs@file:../../node_modules/rxjs":
version "6.5.3"
dependencies:
tslib "^1.9.0"

safe-buffer@5.1.2, safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@~5.1.0, safe-buffer@~5.1.1:
version "5.1.2"
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d"
Expand Down Expand Up @@ -5759,15 +5761,6 @@ shebang-regex@^1.0.0:
resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3"
integrity sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=

shelljs@^0.8.1:
version "0.8.3"
resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.8.3.tgz#a7f3319520ebf09ee81275b2368adb286659b097"
integrity sha512-fc0BKlAWiLpwZljmOvAOTE/gXawtCoNrP5oaY7KIaQbbyHeQVg01pSEuEGvGh3HEdBU4baCD7wQBwADmM/7f7A==
dependencies:
glob "^7.0.0"
interpret "^1.0.0"
rechoir "^0.6.2"

signal-exit@^3.0.0, signal-exit@^3.0.2:
version "3.0.2"
resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d"
Expand Down Expand Up @@ -6496,25 +6489,26 @@ tslib@^1.8.0, tslib@^1.8.1, tslib@^1.9.0, tslib@^1.9.3:
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.3.tgz#d7e4dd79245d85428c4d7e4822a79917954ca286"
integrity sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ==

tslint@~5.11.0:
version "5.11.0"
resolved "https://registry.yarnpkg.com/tslint/-/tslint-5.11.0.tgz#98f30c02eae3cde7006201e4c33cb08b48581eed"
integrity sha1-mPMMAurjzecAYgHkwzywi0hYHu0=
tslint@~5.18.0:
version "5.18.0"
resolved "https://registry.yarnpkg.com/tslint/-/tslint-5.18.0.tgz#f61a6ddcf372344ac5e41708095bbf043a147ac6"
integrity sha512-Q3kXkuDEijQ37nXZZLKErssQVnwCV/+23gFEMROi8IlbaBG6tXqLPQJ5Wjcyt/yHPKBC+hD5SzuGaMora+ZS6w==
dependencies:
babel-code-frame "^6.22.0"
"@babel/code-frame" "^7.0.0"
builtin-modules "^1.1.1"
chalk "^2.3.0"
commander "^2.12.1"
diff "^3.2.0"
glob "^7.1.1"
js-yaml "^3.7.0"
js-yaml "^3.13.1"
minimatch "^3.0.4"
mkdirp "^0.5.1"
resolve "^1.3.2"
semver "^5.3.0"
tslib "^1.8.0"
tsutils "^2.27.2"
tsutils "^2.29.0"

tsutils@^2.27.2:
tsutils@^2.29.0:
version "2.29.0"
resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-2.29.0.tgz#32b488501467acbedd4b85498673a0812aca0b99"
integrity sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA==
Expand Down Expand Up @@ -6557,7 +6551,7 @@ typescript@3.4.4:
integrity sha512-xt5RsIRCEaf6+j9AyOBgvVuAec0i92rgCaS3S+UVf5Z/vF2Hvtsw08wtUTJqp4djwznoAgjSxeCcU4r+CcDBJA==

"typescript@file:../../node_modules/typescript":
version "3.4.2"
version "3.5.3"

uglify-js@^3.1.4:
version "3.4.9"
Expand Down Expand Up @@ -7072,4 +7066,4 @@ yn@^2.0.0:
integrity sha1-5a2ryKz0CPY4X8dklWhMiOavaJo=

"zone.js@file:../../node_modules/zone.js":
version "0.9.0"
version "0.10.2"
9 changes: 9 additions & 0 deletions packages/compiler-cli/ngcc/main-ngcc.ts
Expand Up @@ -45,6 +45,13 @@ if (require.main === module) {
'If specified then only the first matching package.json property will be compiled.',
type: 'boolean'
})
.option('create-ivy-entry-points', {
describe:
'If specified then new `*_ivy_ngcc` entry-points will be added to package.json rather than modifying the ones in-place.\n' +
'For this to work you need to have custom resolution set up (e.g. in webpack) to look for these new entry-points.\n' +
'The Angular CLI does this already, so it is safe to use this option if the project is being built via the CLI.',
type: 'boolean'
})
.option('l', {
alias: 'loglevel',
describe: 'The lowest severity logging message that should be output.',
Expand All @@ -65,6 +72,7 @@ if (require.main === module) {
const propertiesToConsider: string[] = options['p'];
const targetEntryPointPath = options['t'] ? options['t'] : undefined;
const compileAllFormats = !options['first-only'];
const createNewEntryPointFormats = options['create-ivy-entry-points'];
const logLevel = options['l'] as keyof typeof LogLevel | undefined;

(async() => {
Expand All @@ -76,6 +84,7 @@ if (require.main === module) {
propertiesToConsider,
targetEntryPointPath,
compileAllFormats,
createNewEntryPointFormats,
logger,
async: true,
});
Expand Down

0 comments on commit b2b917d

Please sign in to comment.