Closed
Description
🚀 Feature request
Command (mark with an x
)
- new
- build
- serve
- test
- e2e
- generate
- add
- update
- lint
- xi18n
- run
- config
- help
- version
- doc
Description
When creating angular application with strict
flag on, user still needs to update config files to strictest settings.
Here is a list of steps:
> npx @angular/[email protected] new ui-applications --createApplication=false --strict=true
> cd ui-applications
> yarn ng generate application admin-console --defaults=true
Post actions after app is created
- Edit
angular.json
and addOnPush
as the default change detection strategy"@schematics/angular:component": { "changeDetection": "OnPush" }
- Edit
angular.json
and update budgets{ "type": "initial", "maximumWarning": "500kb", "maximumError": "600kb" }
- Edit
tsconfig.json
and setstrict
flag to true{ "compilerOptions": { "strictNullChecks": true, "strict": true } }
- Edit
tsconfig.json
and setstrictTemplates
flag to true"angularCompilerOptions": { "strictTemplates": true }
- Edit
tslint.json
and add accessibility rules from https://web.dev/accessible-angular-with-codelyzer/"template-accessibility-alt-text": true, "template-accessibility-elements-content": true, "template-accessibility-label-for": true, "template-accessibility-tabindex-no-positive": true, "template-accessibility-table-scope": true, "template-accessibility-valid-aria": true, "template-click-events-have-key-events": true, "template-mouse-events-have-key-events": true, "template-no-autofocus": true, "template-no-distracting-elements": true
- Edit
projects/admin-console/.browserslistrc
and target modern browserslast 2 Edge versions last 2 Chrome versions last 2 Firefox versions last 2 Safari versions
- Edit
package.json
add lint, test and build scripts foradmin-console
project"test:admin-console": "ng test --project admin-console", "lint:admin-console": "ng lint --project admin-console", "build:admin-console": "ng build --prod --project admin-console"
I ran yarn lint:admin-console
and yarn build:admin-console
after making these changes(also, deleted contents of app.component.html
) and I had no issues.
Describe the solution you'd like
If angular-cli could expose a modern
(or something alike) flag, that would save developer time. It becomes very tedious to introduce these flags at a later stage when the team of developers is actively working on projects.
> npx @angular/[email protected] new ui-applications --createApplication=false --strict=true --modern=true
Describe alternatives you've considered
I manually update config files for now