Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit dcbda79

Browse files
Chau TranChau Tran
Chau Tran
authored and
Chau Tran
committed
fix: adjust ng add generator
1 parent e76cc6b commit dcbda79

File tree

1 file changed

+13
-2
lines changed
  • libs/plugin/src/generators/init

1 file changed

+13
-2
lines changed

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

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1-
import { addDependenciesToPackageJson, installPackagesTask, logger, readJson, Tree, updateJson } from '@nx/devkit';
1+
import {
2+
addDependenciesToPackageJson,
3+
installPackagesTask,
4+
logger,
5+
readJson,
6+
Tree,
7+
updateJson,
8+
writeJson,
9+
} from '@nx/devkit';
210

311
export const ANGULAR_THREE_VERSION = '^1.0.0';
412
export const THREE_VERSION = '^0.152.0';
@@ -37,8 +45,11 @@ export default async function (tree: Tree) {
3745

3846
// add metadata.json to vscode settings if exists
3947
const vscodeSettingsPath = '.vscode/settings.json';
40-
if (tree.exists('.vscode') || tree.exists(vscodeSettingsPath)) {
48+
if (tree.exists('.vscode')) {
4149
logger.info('Enabling typings support for VSCode...');
50+
if (!tree.exists(vscodeSettingsPath)) {
51+
writeJson(tree, vscodeSettingsPath, {});
52+
}
4253
updateJson(tree, vscodeSettingsPath, (json) => {
4354
if (json['html.customData'] && Array.isArray(json['html.customData'])) {
4455
json['html.customData'].push('./node_modules/angular-three/metadata.json');

0 commit comments

Comments
 (0)