Skip to content

Commit

Permalink
Publish types in public-types with typesVersions
Browse files Browse the repository at this point in the history
Publish types to a `public-types` directory, in parallel to the
in-place Babel-powered emit for JS. In the future, we should probably
go ahead and remove the Babel emit and get this the rest of the way
into a v2 addon format with a single publish step. However, this
minimizes the delta introduced in this particular PR, and thus keeps
the risk lower.

This does *not* correctly publish types for `ember-test-helpers`.
However, there remains only one export from that package the
`has-ember-version` module and helper, which is also available from
`@ember/test-helpers`. Accordingly, we can simply ignore that (and plan
to go ahead and eventually remove it).
  • Loading branch information
chriskrycho committed Jul 21, 2022
1 parent 30e9c1f commit 16babd8
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -28,3 +28,4 @@
# tyescript related output files
addon-test-support/**/*.js
addon-test-support/**/*.d.ts
public-types
12 changes: 11 additions & 1 deletion package.json
Expand Up @@ -23,7 +23,10 @@
"test": "tests"
},
"scripts": {
"prepack": "yarn babel --extensions '.ts' --presets @babel/preset-typescript addon-test-support --out-dir addon-test-support/ --ignore '**/*.d.ts'",
"build:types": "tsc",
"build:js": "yarn babel --extensions '.ts' --presets @babel/preset-typescript addon-test-support --out-dir addon-test-support/ --ignore '**/*.d.ts'",
"build": "npm-run-all --parallel build:*",
"prepack": "yarn build",
"postpack": "rimraf addon-test-support/**/*.js",
"clean": "git clean -x -f",
"docs": "documentation build --document-exported \"addon-test-support/@ember/test-helpers/index.js\" --config documentation.yml --markdown-toc-max-depth 3 -f md -o API.md",
Expand Down Expand Up @@ -152,5 +155,12 @@
"volta": {
"node": "12.22.4",
"yarn": "1.22.4"
},
"typesVersions": {
"*": {
"*": [
"public-types/*"
]
}
}
}
5 changes: 5 additions & 0 deletions tsconfig.json
@@ -1,6 +1,11 @@
{
"extends": "@tsconfig/ember/tsconfig.json",
"compilerOptions": {
// Use TS to emit declarations
"noEmit": false,
"emitDeclarationOnly": true,
"outDir": "public-types",

"paths": {
"dummy/tests/*": ["./tests/*"],
"dummy/*": ["./tests/dummy/app/*", "./app/*"],
Expand Down

0 comments on commit 16babd8

Please sign in to comment.