build:types script doesn't work
ijlee2 opened this issue · 3 comments
The build:types
script from #136 (i.e. glint --declaration
) did not work for ember-container-query
. I noticed that the declarations
folder is missing entirely.
- ijlee2/ember-container-query@ccc9fe0
- https://github.com/ijlee2/ember-container-query/actions/runs/5466350803/jobs/9951143396
I looked into what the scripts should be, so that they work for both tsc
and glint
cases:
/* package.json for projects with Glint */
"scripts": {
"build:types": "glint --build",
"lint:types": "glint --project tsconfig.development.json",
"start:types": "glint --declaration --watch", // ideally, we can run just `glint --watch`
}
/* package.json for projects without Glint */
"scripts": {
"build:types": "tsc --build",
"lint:types": "tsc --project tsconfig.development.json",
"start:types": "tsc --watch"
}
/* tsconfig.json */
{
"extends": "@tsconfig/ember/tsconfig.json",
"compilerOptions": {
"declaration": true,
"declarationDir": "declarations",
"emitDeclarationOnly": true,
"noEmit": false
},
"include": [
"src/**/*",
"unpublished-development-types/**/*"
]
}
/* tsconfig.development.json */
{
"extends": "@tsconfig/ember/tsconfig.json",
"compilerOptions": {
"declaration": true,
"declarationDir": "declarations"
},
"include": [
"src/**/*",
"unpublished-development-types/**/*"
]
}
Here is what I did, please let me know if I got something wrong:
using --build
git clone git@github.com:ijlee2/ember-container-query.git
cd ember-container-query
git checkout remove-rollup-plugin-ts
pnpm install
cd ember-container-query
pnpm build
I see dist and declarations
rm -rf declarations/ dist/
pnpm start
- I once again see dist and declarations
using --declaration
- I drop the most recent 2 commits
pnpm install
rm -rf declarations/ dist/
pnpm build
dist
exsits but no declarations <-------------------- the bug is here, expected that declarations would exist
becauseglint --declaration
was ranpnpm start
- both
dist
anddeclarations
exists
So, confirming the issue -- glint --declaration
does not generate declarations, but glint --declaration --watch
does
@NullVoxPopuli The list of steps and observations that you gave is perfect.
Yes, to confirm: The start
command, which ran glint --declaration --watch
, did create the declarations
folder, but the build
command, which ran glint --declaration
, did not.
By adding console.log()
's, I checked that glint --declaration
results in determineOptionsToExtend()
correctly setting options.{noEmit,declaration,emitDeclarationOnly}
(to false
, true
, and true
, respectively).
I'm guessing that something different happens:
- When we run
glint --build
as opposed toglint --declaration
- When we run
glint --declaration --watch
as opposed to justglint --declaration
@dfreeman Thanks again for spending extra time looking into the problem and solution. I checked that, by removing the @glint-ignore
comment, the build
script's glint --declaration
creates the declarations
folder.
I can help file a bug report in the glint
repo tomorrow.