npx gts init breaks Angular 9 project
- Dominant language
- TypeScript
- Stars
- 5.3k
- Forks
- 212
- PR merge metrics
- No merged PRs in 30d
Description
Background:
An existing Angular 9 Project, with following basic stack:
Angular CLI: 9.1.1
Node: 12.6.0
OS: linux x64
Angular: 9.1.1
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Ivy Workspace: Yes
Package Version
------------------------------------------------------------
@angular-devkit/architect 0.901.1
@angular-devkit/build-angular 0.901.1
@angular-devkit/build-optimizer 0.901.1
@angular-devkit/build-webpack 0.901.1
@angular-devkit/core 9.1.1
@angular-devkit/schematics 9.1.1
@angular/cdk 9.2.0
@angular/flex-layout 9.0.0-beta.29
@angular/material 9.2.0
@angular/material-moment-adapter 9.2.0
@ngtools/webpack 9.1.1
@schematics/angular 9.1.1
@schematics/update 0.901.1
rxjs 6.5.5
typescript 3.8.3
webpack 4.42.1
Steps taken per installation of gts:
0. Backed Up the following: package.json, tsconfig.json and tslint.json
1. Per prescriptions provided within the readme.md file of the gts repo-
a. Ran : npx gts init within the Angular 9 project directory
b. Chose “N” not to overwrite version 3.8.3 to 3.8.0 of TypeScript
c. Chose "N" not to overwrite Node version 13.11.1 to 10.0.3
d. Chose “y” to overwrite tsconfig.json
it in turn ran its course adding 192 packages.
Pre installation of gts the project's tsconfig.json was as such below:
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"downlevelIteration": true,
"experimentalDecorators": true,
"module": "esnext",
"moduleResolution": "node",
"importHelpers": true,
"target": "es2015",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2018",
"dom"
]
},
"angularCompilerOptions": {
"fullTemplateTypeCheck": true,
"strictInjectionParameters": true
}
}
Post the installation of gts the tsconfig.json file was now as such below:
{
"extends": "./node_modules/gts/tsconfig-google.json",
"compilerOptions": {
"rootDir": ".",
"outDir": "build"
},
"include": [
"src/**/*.ts",
"test/**/*.ts"
]
}
Knowing it was going to need a "target" and "library" properties, I updated to the following (A merge of the gts created tsconfig.json file and the original Angular 9 project tsconfig.json files:
{
"extends": "./node_modules/gts/tsconfig-google.json",
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"downlevelIteration": true,
"experimentalDecorators": true,
"module": "esnext",
"moduleResolution": "node",
"importHelpers": true,
"target": "es2015",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2018",
"dom"
]
},
"include": [
"src/**/*.ts",
"test/**/*.ts"
],
"angularCompilerOptions": {
"fullTemplateTypeCheck": true,
"strictInjectionParameters": true
}
}
Serving the Application, by running : ng serve --port 4201 , presents a broken project which prior to the install, will render the application locally @ port 4201
When I issue the following gts command: gts check *.ts i get the following:
Command 'gts' not found, but there are 17 similar ones.
NB: I am using the Windows Subsystem Linux (Ubuntu) as my development environment.
Can you please help point in the right direction or resolve this issue if it seems to be an incompatibility with Angular 9 projects??
Looking forward to your response.
Contributor guide
Assessment
This issue has not been assessed yet.