Skip to content

Commit

Permalink
fix(parsing): json parsing fixed for commented json files
Browse files Browse the repository at this point in the history
  • Loading branch information
yigitkurtcu committed May 20, 2023
1 parent e685ae3 commit 8ef1604
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 17 deletions.
75 changes: 60 additions & 15 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Expand Up @@ -43,6 +43,7 @@
"dependencies": {
"@angular-devkit/core": "16.0.1",
"@angular-devkit/schematics": "16.0.1",
"comment-json": "^4.2.3",
"jsonc-parser": "3.2.0",
"pluralize": "8.0.0"
},
Expand Down
4 changes: 2 additions & 2 deletions src/lib/sub-app/sub-app.factory.ts
Expand Up @@ -15,7 +15,7 @@ import {
url,
} from '@angular-devkit/schematics';
import { existsSync, readFileSync } from 'fs';
import { parse } from 'jsonc-parser';
import { parse, stringify } from 'comment-json';
import { normalizeToKebabOrSnakeCase } from '../../utils/formatting';
import {
DEFAULT_APPS_PATH,
Expand Down Expand Up @@ -127,7 +127,7 @@ function updateJsonFile<T>(
const sourceText = source.toString('utf-8');
const json = parse(sourceText);
callback(json as unknown as T);
host.overwrite(path, JSON.stringify(json, null, 2));
host.overwrite(path, stringify(json, null, 2));
}
return host;
}
Expand Down

0 comments on commit 8ef1604

Please sign in to comment.