Is there any way to specify a default folder name in a configuration file like angular.json
, so that all developers running the cli-command ng g c MyComponent --skipTests
without folder name will create components in this preconfigured folder (e.g. MyFolder
) by default?
This query holds the knowledge of How to generate components in a specific folder with angular-cli?
It is not a duplicate because the above question only answers how to specify the target folder in the command line call, and not how to preconfigure a default folder.
Suppose there are several developers, and all create a lot of components that should all be placed in one specific folder.
Instead of typing the folder every time in the commandline call, angular should use a default even if no folder is specified during the commandline call. That way, the developers do not need to remember to provide the MyFolder
name all the time.
For example
ng g c MyFolder/MyComponent1 --skipTests
ng g c MyFolder/MyComponent2 --skipTests
ng g c MyFolder/MyComponent3 --skipTests
ng g c MyFolder/MyComponent4 --skipTests
ng g c MyFolder/MyComponent5 --skipTests
ng g c MyFolder/MyComponent6 --skipTests
ng g c MyFolder/MyComponent7 --skipTests
they should just be allowed to type:
ng g c MyComponent1 --skipTests
ng g c MyComponent2 --skipTests
ng g c MyComponent3 --skipTests
ng g c MyComponent4 --skipTests
ng g c MyComponent5 --skipTests
ng g c MyComponent6 --skipTests
ng g c MyComponent7 --skipTests
but the components should still be generated in MyFolder
folder.