feat(ngcc): expose --create-ivy-entry-points option on ivy-ngcc (#33049)

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

See https://github.com/angular/angular/pull/32999#issuecomment-539937368

PR Close #33049
This commit is contained in:
Pete Bacon Darwin
2019-10-09 11:36:50 +01:00
committed by Alex Rickabaugh
parent 9f0c549bc8
commit b2b917d2d8
3 changed files with 52 additions and 48 deletions

View File

@ -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.',
@ -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() => {
@ -76,6 +84,7 @@ if (require.main === module) {
propertiesToConsider,
targetEntryPointPath,
compileAllFormats,
createNewEntryPointFormats,
logger,
async: true,
});