-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Closed as not planned
Closed as not planned
Copy link
Labels
needs: more infoReporter must clarify the issueReporter must clarify the issue
Description
🐞 Bug report
Command
- new
- build
- serve
- test
- e2e
- generate
- add
- update
- lint
- extract-i18n
- run
- config
- help
- version
- doc
Is this a regression?
No
Description
When you call the method updateTsConfig and you already has this short import in paths.
🔥 Exception or Error
Duplicate Object key
Proposed solution
export function updateTsConfig(packageName: string, ...paths: string[]) {
return (host: Tree) => {
if (!host.exists("tsconfig.json")) {
return host;
}
const file = new JSONFile(host, "tsconfig.json");
const jsonPath = ["compilerOptions", "paths", packageName.toLowerCase()];
const value: string[] | undefined = file.get(jsonPath) as string[];
let pathsFiltered: string[] = [];
if (value) {
pathsFiltered = paths?.filter((item) => !value!.some((path) => path === item));
}
file.modify(jsonPath, Array.isArray(value) ? [...value, ...pathsFiltered] : paths);
};
}
Metadata
Metadata
Assignees
Labels
needs: more infoReporter must clarify the issueReporter must clarify the issue