From a6292faa97556fb85974e6066e947d4317c62ad5 Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Mon, 10 Aug 2020 13:48:41 +0200 Subject: [PATCH] docs: remove solution style tsconfig (#38394) Following the issues highlighted in https://docs.google.com/document/d/1eB6cGCG_2ircfS5GzpDC9dBgikeYYcMxghVH5sDESHw/edit?usp=sharing and discussions held with the TypeScript team. Together with the TypeScript team it was decided that the best course of action is to rollback this feature. In future, it is not excluded that solution style tsconfigs are re-introduced. See: https://github.com/angular/angular-cli/pull/18478 PR Close #38394 --- aio/content/guide/angular-compiler-options.md | 2 +- aio/content/guide/file-structure.md | 5 +- aio/content/guide/ivy-compatibility.md | 4 +- .../migration-solution-style-tsconfig.md | 55 ------------------- ...date-module-and-target-compiler-options.md | 2 +- aio/content/guide/typescript-configuration.md | 31 +---------- aio/content/guide/universal.md | 3 +- aio/content/guide/updating-to-version-10.md | 1 - aio/content/navigation.json | 5 -- 9 files changed, 10 insertions(+), 98 deletions(-) delete mode 100644 aio/content/guide/migration-solution-style-tsconfig.md diff --git a/aio/content/guide/angular-compiler-options.md b/aio/content/guide/angular-compiler-options.md index 90101d8eff..390147cc1d 100644 --- a/aio/content/guide/angular-compiler-options.md +++ b/aio/content/guide/angular-compiler-options.md @@ -31,7 +31,7 @@ For example: ```json { - "extends": "../tsconfig.base.json", + "extends": "../tsconfig.json", "compilerOptions": { "experimentalDecorators": true, ... diff --git a/aio/content/guide/file-structure.md b/aio/content/guide/file-structure.md index 5b63edcb8e..b78324814f 100644 --- a/aio/content/guide/file-structure.md +++ b/aio/content/guide/file-structure.md @@ -40,8 +40,7 @@ The top level of the workspace contains workspace-wide configuration files, conf | `package-lock.json` | Provides version information for all packages installed into `node_modules` by the npm client. See [npm documentation](https://docs.npmjs.com/files/package-lock.json) for details. If you use the yarn client, this file will be [yarn.lock](https://yarnpkg.com/lang/en/docs/yarn-lock/) instead. | | `src/` | Source files for the root-level application project. | | `node_modules/` | Provides [npm packages](guide/npm-packages) to the entire workspace. Workspace-wide `node_modules` dependencies are visible to all projects. | -| `tsconfig.json` | The `tsconfig.json` file is a ["Solution Style"](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-9.html#support-for-solution-style-tsconfigjson-files) TypeScript configuration file. Code editors and TypeScript’s language server use this file to improve development experience. Compilers do not use this file. | -| `tsconfig.base.json` | The base [TypeScript](https://www.typescriptlang.org/) configuration for projects in the workspace. All other configuration files inherit from this base file. For more information, see the [Configuration inheritance with extends](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html#configuration-inheritance-with-extends) section of the TypeScript documentation.| +| `tsconfig.json` | The base [TypeScript](https://www.typescriptlang.org/) configuration for projects in the workspace. All other configuration files inherit from this base file. For more information, see the [Configuration inheritance with extends](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html#configuration-inheritance-with-extends) section of the TypeScript documentation.| | `tslint.json` | Default [TSLint](https://palantir.github.io/tslint/) configuration for projects in the workspace. | @@ -103,7 +102,7 @@ Angular components, templates, and styles go here. The application-specific configuration files for the root application reside at the workspace root level. For a multi-project workspace, project-specific configuration files are in the project root, under `projects/project-name/`. -Project-specific [TypeScript](https://www.typescriptlang.org/) configuration files inherit from the workspace-wide `tsconfig.base.json`, and project-specific [TSLint](https://palantir.github.io/tslint/) configuration files inherit from the workspace-wide `tslint.json`. +Project-specific [TypeScript](https://www.typescriptlang.org/) configuration files inherit from the workspace-wide `tsconfig.json`, and project-specific [TSLint](https://palantir.github.io/tslint/) configuration files inherit from the workspace-wide `tslint.json`. | APPLICATION-SPECIFIC CONFIG FILES | PURPOSE | | :--------------------- | :------------------------------------------| diff --git a/aio/content/guide/ivy-compatibility.md b/aio/content/guide/ivy-compatibility.md index ee4632316d..025410c67f 100644 --- a/aio/content/guide/ivy-compatibility.md +++ b/aio/content/guide/ivy-compatibility.md @@ -11,11 +11,11 @@ That said, some applications will likely need to apply some manual updates. In version 10, [a few deprecated APIs have been removed](guide/updating-to-version-10#removals) and there are a [few breaking changes](guide/updating-to-version-10#breaking-changes) unrelated to Ivy. If you're seeing errors after updating to version 9, you'll first want to rule those changes out. -To do so, temporarily [turn off Ivy](guide/ivy#opting-out-of-angular-ivy) in your `tsconfig.base.json` and re-start your app. +To do so, temporarily [turn off Ivy](guide/ivy#opting-out-of-angular-ivy) in your `tsconfig.json` and re-start your app. If you're still seeing the errors, they are not specific to Ivy. In this case, you may want to consult the [general version 10 guide](guide/updating-to-version-10). If you've opted into any of the new, stricter type-checking settings, you may also want to check out the [template type-checking guide](guide/template-typecheck). -If the errors are gone, switch back to Ivy by removing the changes to the `tsconfig.base.json` and review the list of expected changes below. +If the errors are gone, switch back to Ivy by removing the changes to the `tsconfig.json` and review the list of expected changes below. {@a payload-size-debugging} ### Payload size debugging diff --git a/aio/content/guide/migration-solution-style-tsconfig.md b/aio/content/guide/migration-solution-style-tsconfig.md deleted file mode 100644 index 211ff5f986..0000000000 --- a/aio/content/guide/migration-solution-style-tsconfig.md +++ /dev/null @@ -1,55 +0,0 @@ -# Solution-style `tsconfig.json` migration - -## What does this migration do? - -This migration adds support to existing projects for TypeScript's new ["solution-style" tsconfig feature](https://devblogs.microsoft.com/typescript/announcing-typescript-3-9/#solution-style-tsconfig). - -Support is added by making two changes: - -1. Renaming the workspace-level `tsconfig.json` to `tsconfig.base.json`. -All project [TypeScript configuration files](guide/typescript-configuration) will extend from this base which contains the common options used throughout the workspace. - -2. Adding the solution `tsconfig.json` file at the root of the workspace. -This `tsconfig.json` file will only contain references to project-level TypeScript configuration files and is only used by editors/IDEs. - -As an example, the solution `tsconfig.json` for a new project is as follows: -```json -// This is a "Solution Style" tsconfig.json file, and is used by editors and TypeScript’s language server to improve development experience. -// It is not intended to be used to perform a compilation. -{ - "files": [], - "references": [ - { - "path": "./tsconfig.app.json" - }, - { - "path": "./tsconfig.spec.json" - }, - { - "path": "./e2e/tsconfig.json" - } - ] -} -``` - -## Why is this migration necessary? - -Solution-style `tsconfig.json` files provide an improved editing experience and fix several long-standing defects when editing files in an IDE. -IDEs that leverage the TypeScript language service (for example, [Visual Studio Code](https://code.visualstudio.com)), will only use TypeScript configuration files that are named `tsconfig.json`. -In complex projects, there may be more than one compilation unit and each of these units may have different settings and options. - -With the Angular CLI, a project will have application code that will target a browser. -It will also have unit tests that should not be included within the built application and that also need additional type information present (`jasmine` in this case). -Both parts of the project also share some but not all of the code within the project. -As a result, two separate TypeScript configuration files (`tsconfig.app.json` and `tsconfig.spec.json`) are needed to ensure that each part of the application is configured properly and that the right types are used for each part. -Also if web workers are used within a project, an additional tsconfig (`tsconfig.worker.json`) is needed. -Web workers use similar but incompatible types to the main browser application. -This requires the additional configuration file to ensure that the web worker files use the appropriate types and will build successfully. - -While the Angular build system knows about all of these TypeScript configuration files, an IDE using TypeScript's language service does not. -Because of this, an IDE will not be able to properly analyze the code from each part of the project and may generate false errors or make suggestions that are incorrect for certain files. -By leveraging the new solution-style tsconfig, the IDE can now be aware of the configuration of each part of a project. -This allows each file to be treated appropriately based on its tsconfig. -IDE features such as error/warning reporting and auto-suggestion will operate more effectively as well. - -The TypeScript 3.9 release [blog post](https://devblogs.microsoft.com/typescript/announcing-typescript-3-9/#solution-style-tsconfig) also contains some additional information regarding this new feature. diff --git a/aio/content/guide/migration-update-module-and-target-compiler-options.md b/aio/content/guide/migration-update-module-and-target-compiler-options.md index 259f85d93a..e5a2cd588b 100644 --- a/aio/content/guide/migration-update-module-and-target-compiler-options.md +++ b/aio/content/guide/migration-update-module-and-target-compiler-options.md @@ -9,7 +9,7 @@ This process helps ensure that intentional changes to the options are kept in pl TypeScript Configuration File(s) | Changed Property | Existing Value | New Value ------------- | ------------- | ------------- | ------------- | ------------- -`/tsconfig.base.json` | `"module"` | `"esnext"` | `"es2020"` +`/tsconfig.json` | `"module"` | `"esnext"` | `"es2020"` Used in `browser` builder options (`ng build` for applications) | `"module"` | `"esnext"` | `"es2020"` Used in `ng-packgr` builder options (`ng build` for libraries) | `"module"` | `"esnext"` | `"es2020"` Used in `karma` builder options (`ng test` for applications) | `"module"` | `"esnext"` | `"es2020"` diff --git a/aio/content/guide/typescript-configuration.md b/aio/content/guide/typescript-configuration.md index 3561008b20..1d058045c3 100644 --- a/aio/content/guide/typescript-configuration.md +++ b/aio/content/guide/typescript-configuration.md @@ -18,32 +18,7 @@ that are important to Angular developers, including details about the following ## Configuration files A given Angular workspace contains several TypeScript configuration files. -At the root level, there are two main TypeScript configuration files: a `tsconfig.json` file and a `tsconfig.base.json` file. - -The `tsconfig.json` file is a ["Solution Style"](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-9.html#support-for-solution-style-tsconfigjson-files) TypeScript configuration file. -Code editors and TypeScript’s language server use this file to improve development experience. -Compilers do not use this file. - -The `tsconfig.json` file contains a list of paths to the other TypeScript configuration files used in the workspace. - - -{ - "files": [], - "references": [ - { - "path": "./tsconfig.app.json" - }, - { - "path": "./tsconfig.spec.json" - }, - { - "path": "./projects/my-lib/tsconfig.lib.json" - } - ] -} - - -The `tsconfig.base.json` file specifies the base TypeScript and Angular compiler options that all projects in the workspace inherit. +At the root `tsconfig.json` file specifies the base TypeScript and Angular compiler options that all projects in the workspace inherit. The TypeScript and Angular have a wide range of options which can be used to configure type-checking features and generated output. For more information, see the [Configuration inheritance with extends](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html#configuration-inheritance-with-extends) section of the TypeScript documentation. @@ -55,9 +30,9 @@ For details about configuration inheritance, see the [Configuration inheritance -The initial `tsconfig.base.json` for an Angular workspace typically looks like the following example. +The initial `tsconfig.json` for an Angular workspace typically looks like the following example. - + { "compileOnSave": false, "compilerOptions": { diff --git a/aio/content/guide/universal.md b/aio/content/guide/universal.md index d9f1bea9df..a96a9788df 100644 --- a/aio/content/guide/universal.md +++ b/aio/content/guide/universal.md @@ -48,8 +48,7 @@ src/ app/ ... application code app.server.module.ts * server-side application module server.ts * express web server -tsconfig.json TypeScript solution style configuration -tsconfig.base.json TypeScript base configuration +tsconfig.json TypeScript base configuration tsconfig.app.json TypeScript browser application configuration tsconfig.server.json TypeScript server application configuration tsconfig.spec.json TypeScript tests configuration diff --git a/aio/content/guide/updating-to-version-10.md b/aio/content/guide/updating-to-version-10.md index 24abe1fa40..b7e56c6c4e 100644 --- a/aio/content/guide/updating-to-version-10.md +++ b/aio/content/guide/updating-to-version-10.md @@ -77,6 +77,5 @@ Read about the migrations the CLI handles for you automatically: * [Migrating missing `@Directive()`/`@Component()` decorators](guide/migration-undecorated-classes) * [Migrating `ModuleWithProviders`](guide/migration-module-with-providers) -* [Solution-style `tsconfig.json` migration](guide/migration-solution-style-tsconfig) * [`tslib` direct dependency migration](guide/migration-update-libraries-tslib) * [Update `module` and `target` compiler options migration](guide/migration-update-module-and-target-compiler-options) diff --git a/aio/content/navigation.json b/aio/content/navigation.json index 2f3e850f45..07007677ce 100644 --- a/aio/content/navigation.json +++ b/aio/content/navigation.json @@ -858,11 +858,6 @@ "title": "Missing @Injectable() Decorators", "tooltip": "Migration to add missing @Injectable() decorators and incomplete provider definitions." }, - { - "url": "guide/migration-solution-style-tsconfig", - "title": "Solution-style `tsconfig.json`", - "tooltip": "Migration to create a solution-style `tsconfig.json`." - }, { "url": "guide/migration-update-libraries-tslib", "title": "`tslib` direct dependency",