Skip to content

Commit f84abfc

Browse files
Alan Agiusmgechev
authored andcommitted
feat(@schematics/angular): remove ivy-ngcc postinstall script from new application
1 parent 888bb27 commit f84abfc

File tree

2 files changed

+0
-41
lines changed

2 files changed

+0
-41
lines changed

packages/schematics/angular/application/index.ts

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -175,40 +175,6 @@ function mergeWithRootTsLint(parentHost: Tree) {
175175
};
176176
}
177177

178-
function addPostInstallScript() {
179-
return (host: Tree) => {
180-
const pkgJsonPath = '/package.json';
181-
const buffer = host.read(pkgJsonPath);
182-
if (!buffer) {
183-
throw new SchematicsException('Could not read package.json.');
184-
}
185-
186-
const packageJsonAst = parseJsonAst(buffer.toString(), JsonParseMode.Strict);
187-
if (packageJsonAst.kind !== 'object') {
188-
throw new SchematicsException('Invalid package.json. Was expecting an object.');
189-
}
190-
191-
const scriptsNode = findPropertyInAstObject(packageJsonAst, 'scripts');
192-
if (scriptsNode && scriptsNode.kind === 'object') {
193-
const recorder = host.beginUpdate(pkgJsonPath);
194-
const postInstall = findPropertyInAstObject(scriptsNode, 'postinstall');
195-
196-
if (!postInstall) {
197-
// postinstall script not found, add it.
198-
insertPropertyInAstObjectInOrder(
199-
recorder,
200-
scriptsNode,
201-
'postinstall',
202-
'ivy-ngcc',
203-
4,
204-
);
205-
}
206-
207-
host.commitUpdate(recorder);
208-
}
209-
};
210-
}
211-
212178
function addAppToWorkspaceFile(options: ApplicationOptions, workspace: WorkspaceSchema): Rule {
213179
// TODO: use JsonAST
214180
// const workspacePath = '/angular.json';
@@ -453,7 +419,6 @@ export default function (options: ApplicationOptions): Rule {
453419
move(sourceDir),
454420
]), MergeStrategy.Overwrite),
455421
options.minimal ? noop() : schematic('e2e', e2eOptions),
456-
options.enableIvy ? addPostInstallScript() : noop(),
457422
options.skipPackageJson ? noop() : addDependenciesToPackageJson(options),
458423
options.lintFix ? applyLintFix(appDir) : noop(),
459424
]);

packages/schematics/angular/application/index_spec.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -217,12 +217,6 @@ describe('Application Schematic', () => {
217217
expect(pkg.devDependencies['typescript']).toEqual(latestVersions.TypeScript);
218218
});
219219

220-
it(`should add a postinstall in package.json when 'enableIvy'`, () => {
221-
const tree = schematicRunner.runSchematic('application', { ...defaultOptions, enableIvy: true }, workspaceTree);
222-
const pkg = JSON.parse(tree.readContent('/package.json'));
223-
expect(pkg.scripts.postinstall).toEqual('ivy-ngcc');
224-
});
225-
226220
it(`should not override existing users dependencies`, () => {
227221
const oldPackageJson = workspaceTree.readContent('package.json');
228222
workspaceTree.overwrite('package.json', oldPackageJson.replace(

0 commit comments

Comments
 (0)