Skip to content

Commit 40bba8d

Browse files
clydinhansl
authored andcommitted
fix(@angular/cli): support eject with latest application schematic
1 parent 87a5682 commit 40bba8d

File tree

1 file changed

+29
-25
lines changed

1 file changed

+29
-25
lines changed

packages/@angular/cli/tasks/eject.ts

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -505,31 +505,35 @@ export default Task.extend({
505505
.then((packageJson: string) => JSON.parse(packageJson))
506506
.then((packageJson: any) => {
507507
const scripts = packageJson['scripts'];
508-
if (scripts['build'] && scripts['build'] !== 'ng build' && !force) {
509-
throw new SilentError(oneLine`
510-
Your package.json scripts must not contain a build script as it will be overwritten.
511-
`);
512-
}
513-
if (scripts['start'] && scripts['start'] !== 'ng serve' && !force) {
514-
throw new SilentError(oneLine`
515-
Your package.json scripts must not contain a start script as it will be overwritten.
516-
`);
517-
}
518-
if (scripts['pree2e'] && scripts['pree2e'] !== pree2eNpmScript && !force) {
519-
throw new SilentError(oneLine`
520-
Your package.json scripts must not contain a pree2e script as it will be
521-
overwritten.
522-
`);
523-
}
524-
if (scripts['e2e'] && scripts['e2e'] !== 'ng e2e' && !force) {
525-
throw new SilentError(oneLine`
526-
Your package.json scripts must not contain a e2e script as it will be overwritten.
527-
`);
528-
}
529-
if (scripts['test'] && scripts['test'] !== 'ng test' && !force) {
530-
throw new SilentError(oneLine`
531-
Your package.json scripts must not contain a test script as it will be overwritten.
532-
`);
508+
if (!force) {
509+
if (scripts['build']
510+
&& scripts['build'] != 'ng build'
511+
&& scripts['build'] != 'ng build --prod') {
512+
throw new SilentError(oneLine`
513+
Your package.json scripts must not contain a build script as it will be overwritten.
514+
`);
515+
}
516+
if (scripts['start'] && scripts['start'] !== 'ng serve') {
517+
throw new SilentError(oneLine`
518+
Your package.json scripts must not contain a start script as it will be overwritten.
519+
`);
520+
}
521+
if (scripts['pree2e'] && scripts['pree2e'] !== pree2eNpmScript) {
522+
throw new SilentError(oneLine`
523+
Your package.json scripts must not contain a pree2e script as it will be
524+
overwritten.
525+
`);
526+
}
527+
if (scripts['e2e'] && scripts['e2e'] !== 'ng e2e') {
528+
throw new SilentError(oneLine`
529+
Your package.json scripts must not contain a e2e script as it will be overwritten.
530+
`);
531+
}
532+
if (scripts['test'] && scripts['test'] !== 'ng test') {
533+
throw new SilentError(oneLine`
534+
Your package.json scripts must not contain a test script as it will be overwritten.
535+
`);
536+
}
533537
}
534538

535539
packageJson['scripts']['build'] = 'webpack';

0 commit comments

Comments
 (0)