Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build:types script doesn't work #139

Closed
ijlee2 opened this issue Jul 5, 2023 · 3 comments
Closed

build:types script doesn't work #139

ijlee2 opened this issue Jul 5, 2023 · 3 comments

Comments

@ijlee2
Copy link
Contributor

ijlee2 commented Jul 5, 2023

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.

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/**/*"
  ]
}
@NullVoxPopuli
Copy link
Collaborator

NullVoxPopuli commented Jul 5, 2023

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
    image
  • 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
    because glint --declaration was ran
  • pnpm start
  • both dist and declarations exists

So, confirming the issue -- glint --declaration does not generate declarations, but glint --declaration --watch does

@ijlee2
Copy link
Contributor Author

ijlee2 commented Jul 5, 2023

@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:

  1. When we run glint --build as opposed to glint --declaration
  2. When we run glint --declaration --watch as opposed to just glint --declaration

@ijlee2
Copy link
Contributor Author

ijlee2 commented Jul 5, 2023

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants