Skip to content

Commit 17c56f7

Browse files
committed
fix(plugin): use tree.write instead because save() ain't enough
1 parent 51fc21c commit 17c56f7

File tree

1 file changed

+7
-4
lines changed
  • libs/plugin/src/generators/init

1 file changed

+7
-4
lines changed

libs/plugin/src/generators/init/init.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import {
2121
SyntaxKind,
2222
} from 'ts-morph';
2323
import { addMetadataJson } from '../../utils';
24-
import { NGXTENSION_VERSION, THREE_TYPE_VERSION, THREE_VERSION } from '../../versions';
24+
import { ANGULAR_THREE_VERSION, NGXTENSION_VERSION, THREE_TYPE_VERSION, THREE_VERSION } from '../../versions';
2525
import { finishSetup, handleAppConfig, stopSetup } from './utils';
2626

2727
export interface InitGeneratorSchema {
@@ -43,7 +43,7 @@ export async function initGenerator(tree: Tree, options: InitGeneratorSchema) {
4343

4444
addDependenciesToPackageJson(
4545
tree,
46-
{ 'angular-three': version, three: THREE_VERSION, ngxtension: NGXTENSION_VERSION },
46+
{ 'angular-three': ANGULAR_THREE_VERSION, three: THREE_VERSION, ngxtension: NGXTENSION_VERSION },
4747
{ '@types/three': THREE_TYPE_VERSION },
4848
);
4949

@@ -69,9 +69,9 @@ export async function initGenerator(tree: Tree, options: InitGeneratorSchema) {
6969
const projects = getProjects(tree);
7070
const applications: Record<string, ProjectConfiguration> = {};
7171

72-
for (const project of projects.values()) {
72+
for (const [projectName, project] of projects.entries()) {
7373
if (!project.sourceRoot || project.projectType !== 'application') continue;
74-
applications[project.name] = project;
74+
applications[project.name || projectName] = project;
7575
}
7676

7777
const { appName } = await prompt<{ appName: string }>({
@@ -177,13 +177,15 @@ export async function initGenerator(tree: Tree, options: InitGeneratorSchema) {
177177
if (endSetup) {
178178
return await endSetup();
179179
}
180+
tree.write(appConfigPath, appConfigSourceFile.print());
180181
}
181182

182183
if (Node.isObjectLiteralExpression(configArgument)) {
183184
const endSetup = await handleAppConfig(tree, configArgument, mainSourceFile);
184185
if (endSetup) {
185186
return await endSetup();
186187
}
188+
tree.write(mainTsPath, mainSourceFile.print());
187189
}
188190

189191
if (options.sceneGraph === 'none') {
@@ -311,6 +313,7 @@ export async function initGenerator(tree: Tree, options: InitGeneratorSchema) {
311313
}
312314

313315
await componentSourceFile.save();
316+
tree.write(componentPath, componentSourceFile.print());
314317
return await finishSetup(tree);
315318
}
316319

0 commit comments

Comments
 (0)