Angular CLI support with Devkit #6955
Replies: 2 comments 2 replies
-
I see what you mean. The best way to avoid this is by running the For instance, here's a hypothetical generator that adds a import {
formatFiles, getProjects, Tree, updateProjectConfiguration
} from '@nrwl/devkit';
export default async function (tree: Tree, schema: any) {
// add a "jest" target to each project
const projects = getProjects(tree);
projects.forEach((projectConfig, name) => {
projectConfig.targets['jest'] = {
executor: '@nrwl/jest:jest',
outputs: ['coverage/apps/demo'],
options: {
jestConfig: 'apps/demo/jest.config.js',
passWithNoTests: true
}
};
updateProjectConfiguration(tree, name, projectConfig);
});
await formatFiles(tree); // <<<--- this one here
} If I would not have the I can totally see how this might not be really intuitive. I'll have a look whether we can detect the final out put before generating it, which should be possible. |
Beta Was this translation helpful? Give feedback.
-
We've found a similar issue. After running |
Beta Was this translation helpful? Give feedback.
-
Hi,
I'm using the devkit to create my generators and I would like to know how I can support the Angular CLI.
I'm using the function
updateProjectConfiguration
to update theworkspace.json
orangular.json
and add a target to a project, my problem is that theprojectConfiguration
argument only matches the Nx workspace definition format:This results in the following definition:
It incorrectly updates the
angular.json
and uses the Nx definition instead of the regular Angular CLI definition:Due to this issue, Devkit generators cannot support Angular CLI. Furthermore, if I run this generator in an Nx workspace using the old
angular.json
notation, then it will also corrupt the file. The perfect solution would be that Devkit functions support both workspace definition formats transparently.What do you think?
Beta Was this translation helpful? Give feedback.
All reactions