From 6c6a7a358a3e5ee86c3ac25b51c929e54a4630ef Mon Sep 17 00:00:00 2001 From: NullVoxPopuli <199018+NullVoxPopuli@users.noreply.github.com> Date: Wed, 6 Dec 2023 14:55:05 -0500 Subject: [PATCH 1/4] Update README.md --- README.md | 139 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 139 insertions(+) diff --git a/README.md b/README.md index 07be24135..1b9631611 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,142 @@ +# MAINTENANCE MODE + +ember-cli-typescript will no logner be updated unless necesary - ec-ts is no longer needed and all available features are configurable in userland. + +See the official TypeScript docs on the ember guides website here: https://guides.emberjs.com/release/typescript/ +This section of the docs has details for getting started with TypeScript, beyond what is laid out here. + +With every release, we output the `--typescript` output of new ember apps to this StackBlitz: https://stackblitz.com/github/ember-cli/editor-output/tree/stackblitz-app-output-typescript + +## How to use TypeScript without `ember-cli-typescript`? + +In the [ember-cli-babel](https://github.com/emberjs/ember-cli-babel#enabling-typescript-transpilation) docs, it mention that in your `ember-cli-build.js`, you can specify: +```js +'ember-cli-babel': { + enableTypeScriptTransform: true, +}, +``` + +For v1 addons, this would be specified in the node-land `index.js`: +```js +module.exports = { + name: require('package').name, + options: { + 'ember-cli-babel': { + enableTypeScriptTransform: true + } + } +} +``` + +## What about for v2 addons? + +The [V2 Addon Blueprint](https://github.com/embroider-build/addon-blueprint) does not use nor need ember-cli-typescript, nor any of its features. + +## What tsconfig.json should be used? + +The official blueprints for apps and v1 addons (as of 2023-12-06) specifies: + +<details><summary>for apps</summary> + +```jsonc +{ + "extends": "@tsconfig/ember/tsconfig.json", + "compilerOptions": { + // The combination of `baseUrl` with `paths` allows Ember's classic package + // layout, which is not resolvable with the Node resolution algorithm, to + // work with TypeScript. + "baseUrl": ".", + "paths": { + "<%= name %>/tests/*": ["tests/*"], + "<%= name %>/*": ["app/*"], + "*": ["types/*"] + } + } +} +``` + + + +</details> + +<details><summary>For v1 addons</summary> + +```jsonc +{ + "extends": "@tsconfig/ember/tsconfig.json", + "compilerOptions": { + // The combination of `baseUrl` with `paths` allows Ember's classic package + // layout, which is not resolvable with the Node resolution algorithm, to + // work with TypeScript. + "baseUrl": ".", + "paths": { + "dummy/tests/*": ["tests/*"], + "dummy/*": ["tests/dummy/app/*", "app/*"], + "<%= addonName %>": ["addon"], + "<%= addonName %>/*": ["addon/*"], + "<%= addonName %>/test-support": ["addon-test-support"], + "<%= addonName %>/test-support/*": ["addon-test-support/*"], + "*": ["types/*"] + } + } +} +``` + +</details> + +## What `@types/*` packages do I install? + +<details><summary>if you're using ember-data</summary> + +``` +"@types/ember": "^4.0.8", +"@types/ember-data": "^4.4.13", +"@types/ember-data__adapter": "^4.0.4", +"@types/ember-data__model": "^4.0.3", +"@types/ember-data__serializer": "^4.0.4", +"@types/ember-data__store": "^4.0.5", +"@types/ember__application": "^4.0.9", +"@types/ember__array": "^4.0.7", +"@types/ember__component": "^4.0.19", +"@types/ember__controller": "^4.0.9", +"@types/ember__debug": "^4.0.6", +"@types/ember__destroyable": "^4.0.3", +"@types/ember__engine": "^4.0.8", +"@types/ember__error": "^4.0.4", +"@types/ember__helper": "^4.0.4", +"@types/ember__modifier": "^4.0.7", +"@types/ember__object": "^4.0.9", +"@types/ember__owner": "^4.0.7", +"@types/ember__polyfills": "^4.0.4", +"@types/ember__routing": "^4.0.17", +"@types/ember__runloop": "^4.0.7", +"@types/ember__service": "^4.0.6", +"@types/ember__string": "^3.16.3", +"@types/ember__template": "^4.0.4", +"@types/ember__test": "^4.0.4", +"@types/ember__utils": "^4.0.5", +"@types/qunit": "^2.19.7", +"@types/rsvp": "^4.0.6", +``` + +</details> + +<details><summary>if you're not using ember-data</summary> + +You can use ember's built in types, so you only need the following: + +``` +"@types/qunit": "^2.19.7", +"@types/rsvp": "^4.0.6", +``` + +Note that ember-data will eventually ship their own types, and allow _everyone_ to remove all the DT types. + +</details> + + +----------------------------- + <center><h1>ember-cli-typescript</h1></center> <center>Use TypeScript in your Ember 2.x and 3.x apps!</center> From 1c92d9ac3f1e6d6be0a37e49ff55a1e6b60334be Mon Sep 17 00:00:00 2001 From: NullVoxPopuli <199018+NullVoxPopuli@users.noreply.github.com> Date: Wed, 6 Dec 2023 15:07:39 -0500 Subject: [PATCH 2/4] Update README.md Co-authored-by: Adrian Bettridge-Wiese <adrian@op74.net> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1b9631611..3de3d029b 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # MAINTENANCE MODE -ember-cli-typescript will no logner be updated unless necesary - ec-ts is no longer needed and all available features are configurable in userland. +ember-cli-typescript will no longer be updated unless necessary - ec-ts is no longer needed and all available features are configurable in userland. See the official TypeScript docs on the ember guides website here: https://guides.emberjs.com/release/typescript/ This section of the docs has details for getting started with TypeScript, beyond what is laid out here. From b952c4c0f90876b513e8c35a98d6b8795c62873b Mon Sep 17 00:00:00 2001 From: Chris Krycho <hello@chriskrycho.com> Date: Thu, 7 Dec 2023 09:35:08 -0700 Subject: [PATCH 3/4] Clarify app/addon/v2 addon and type checking in README --- README.md | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 3de3d029b..46da2cf45 100644 --- a/README.md +++ b/README.md @@ -9,26 +9,17 @@ With every release, we output the `--typescript` output of new ember apps to thi ## How to use TypeScript without `ember-cli-typescript`? -In the [ember-cli-babel](https://github.com/emberjs/ember-cli-babel#enabling-typescript-transpilation) docs, it mention that in your `ember-cli-build.js`, you can specify: + +Apps and v1 addons need to configure Babel to compile TypeScript files via the `ember-cli-babel` config, as described in the [ember-cli-babel](https://github.com/emberjs/ember-cli-babel#enabling-typescript-transpilation). + +Additionally, you will need the `tsconfig.json` generated by the Ember TypeScript blueprint (see above), and then can run [`glint`](https://typed-ember.gitbook.io/glint) or `tsc` directly on the CLI. (Again, see the official docs for details!) + +### Apps + ```js 'ember-cli-babel': { enableTypeScriptTransform: true, }, -``` - -For v1 addons, this would be specified in the node-land `index.js`: -```js -module.exports = { - name: require('package').name, - options: { - 'ember-cli-babel': { - enableTypeScriptTransform: true - } - } -} -``` - -## What about for v2 addons? The [V2 Addon Blueprint](https://github.com/embroider-build/addon-blueprint) does not use nor need ember-cli-typescript, nor any of its features. From 0cda33bd39731b38f8ea13825c10f8487de31c41 Mon Sep 17 00:00:00 2001 From: Chris Krycho <hello@chriskrycho.com> Date: Thu, 7 Dec 2023 09:37:35 -0700 Subject: [PATCH 4/4] Fix description of v1/v2 add-ons The previous suggested change was supposed to include this, but missed it because of nested code blocks inside the suggested change. Whoops! --- README.md | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 46da2cf45..49da79d84 100644 --- a/README.md +++ b/README.md @@ -9,10 +9,9 @@ With every release, we output the `--typescript` output of new ember apps to thi ## How to use TypeScript without `ember-cli-typescript`? - Apps and v1 addons need to configure Babel to compile TypeScript files via the `ember-cli-babel` config, as described in the [ember-cli-babel](https://github.com/emberjs/ember-cli-babel#enabling-typescript-transpilation). -Additionally, you will need the `tsconfig.json` generated by the Ember TypeScript blueprint (see above), and then can run [`glint`](https://typed-ember.gitbook.io/glint) or `tsc` directly on the CLI. (Again, see the official docs for details!) +Additionally, you will need the `tsconfig.json` generated by the Ember TypeScript blueprint (see below for details), and then can run [`glint`](https://typed-ember.gitbook.io/glint) or `tsc` directly on the CLI. (Again, see the official docs for details!) ### Apps @@ -20,6 +19,24 @@ Additionally, you will need the `tsconfig.json` generated by the Ember TypeScrip 'ember-cli-babel': { enableTypeScriptTransform: true, }, +``` + +### v1 addons + +Configure this in the addon's `index.js` in the root of the project: + +```js +module.exports = { + name: require('package').name, + options: { + 'ember-cli-babel': { + enableTypeScriptTransform: true + } + } +} +``` + +### v2 addons The [V2 Addon Blueprint](https://github.com/embroider-build/addon-blueprint) does not use nor need ember-cli-typescript, nor any of its features.