Skip to content

Conversation

@ijlee2
Copy link
Owner

@ijlee2 ijlee2 commented Jul 5, 2023

@ijlee2 ijlee2 added the enhance: code Issue asks for new feature or refactor label Jul 5, 2023
@ijlee2 ijlee2 force-pushed the remove-rollup-plugin-ts branch 2 times, most recently from b90ddde to 9b38852 Compare July 5, 2023 12:30
@ijlee2 ijlee2 force-pushed the remove-rollup-plugin-ts branch from 9b38852 to 4be74fa Compare July 6, 2023 05:57
Comment on lines +4 to +7
"declaration": true,
"declarationDir": "declarations",
"emitDeclarationOnly": true,
"noEmit": false,
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

glint --declaration sets the compiler options declaration, emitDeclarationOnly, and noEmit (to true, true, and false, respectively) for the end-developer.

https://github.com/typed-ember/glint/blob/1.0.2/packages/core/src/cli/options.ts#L13-L16

For TS-only projects (i.e. without Glint), it is up to the end-developer to set these compiler options.

"lint:js": "eslint . --cache --ext=.js,.ts",
"lint:js:fix": "eslint . --fix",
"lint:types": "tsc --noEmit",
"lint:types": "tsc --emitDeclarationOnly false --noEmit",
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

End-developers can somewhat simplify the lint:types script if they have 2 TS configuration files, one for development and another for production.

/* package.json for projects without Glint */
"scripts": {
  "build:types": "tsc",
  "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/**/*"
  ]
}

Since it's not likely that a v1 addon had used a second configuration file such as tsconfig.development.json, I didn't think that the codemod should create this file for end-developers.

@ijlee2 ijlee2 marked this pull request as ready for review July 6, 2023 06:13
@ijlee2 ijlee2 merged commit 1f84bfe into main Jul 6, 2023
@ijlee2 ijlee2 deleted the remove-rollup-plugin-ts branch July 6, 2023 06:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhance: code Issue asks for new feature or refactor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant