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

ability to override default settings of generated tsconfig.json #2071

Closed
1 of 6 tasks
skarode96 opened this issue Oct 2, 2020 · 7 comments · Fixed by aws/jsii-compiler#931
Closed
1 of 6 tasks

ability to override default settings of generated tsconfig.json #2071

skarode96 opened this issue Oct 2, 2020 · 7 comments · Fixed by aws/jsii-compiler#931
Assignees
Labels
effort/medium Medium work item – a couple days of effort feature-request A feature should be added or improved. language/typescript Related to Typescript code p2

Comments

@skarode96
Copy link

🚀 Feature Request

Affected Languages

  • TypeScript or Javascript
  • Python
  • Java
  • .NET (C#, F#, ...)

General Information

  • **JSII Version: *1.13.0 (build 385c325), typescript 3.9.7
  • **Platform:Mac Os
  • I may be able to implement this feature request
  • This feature might incur a breaking change

Description

Currently Jsii only allows outDir and rootDir fields to be modified in jsii.tsc section, it should consider additional fields which can be configured. I am running into few issues which are caused due to default settings of tsconfig. It should take additional fields into consideration as well

Proposed Solution

@skarode96 skarode96 added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Oct 2, 2020
@SomayaB SomayaB added the language/typescript Related to Typescript code label Oct 3, 2020
@RomainMuller
Copy link
Contributor

I have this idea where I'd like to allow folks to own their tsconfig.json and basically only have jsii enforce the configuration remains within certain boundaries (to ensure correct inter-operability). I reckon this would effectively solve your problem?

@RomainMuller
Copy link
Contributor

Also see #1644

@RomainMuller RomainMuller added p2 effort/medium Medium work item – a couple days of effort labels Oct 7, 2020
@SomayaB SomayaB removed the needs-triage This issue or PR still needs to be triaged. label Oct 19, 2020
@RomainMuller RomainMuller removed their assignment Jun 24, 2021
@markusl
Copy link

markusl commented Jul 7, 2021

We'd like to see this implemented to be able to resolve the referenced issue in the 'projen' project.

@Hi-Fi
Copy link

Hi-Fi commented Nov 4, 2021

Currently there's need to include (quite ugly) script to beginning of projens compile (and watch) task to allow compilation:
replace-in-file "lib: ['lib.es2019.d.ts']" "lib: ['lib.es2019.d.ts','lib.dom.d.ts']" node_modules/jsii/lib/compiler.js. So some configuration offering would be quite nice.

@iliapolo iliapolo assigned iliapolo and unassigned iliapolo Feb 22, 2024
@mrgrain mrgrain changed the title ability to override default settings of generated tsconfig .json ability to override default settings of generated tsconfig.json Apr 10, 2024
github-merge-queue bot pushed a commit to aws/jsii-compiler that referenced this issue May 14, 2024
This PR introduces support for user-provided TypeScript configs through
new options to the CLI, the programmatic API and the `jsii` config
section in `package.json` respectively:

| CLI | package.json | Programmatic API | Description |
|-----|--------------|-------------------|-------------|
| `-c`, `--tsconfig` | `jsii.tsconfig` | `typeScriptConfig` | Use this
typescript configuration file to compile the jsii project. |
| `--validate-tsconfig` | `jsii.validateTsConfig` |
`validateTypeScriptConfig` | Validate the provided typescript
configuration file against a set of rules.|

The following validation rule sets are available:

| Rule set | Description |
|---------|-------------|
| **strict** ⭐ | Validates the provided config against a strict rule set
designed for maximum backwards-compatibility. |
| **generated** | Enforces a config as created by `--generate-tsconfig`.
Use this to stay compatible with the generated config, but have full
ownership over the file. |
| **minimal** | Only enforce options that are known to be incompatible
with jsii. This rule set is likely to be incomplete and new rules will
be added without notice as incompatibilities emerge. |
| **off** 🧪 | Disables all config validation, including options that are
known to be incompatible with jsii. Intended for experimentation only.
Use at your own risk. |

Resolves aws/jsii#2071

---

## Refactors

Mostly changed the compiler by moving some code around or into new
locations to be reused. Specifically the generated config was created in
multiple places without re-use. With this PR, loading or building the
tsconfig now happens once in the constructor and this config is used
through out.


## Testing strategy

Compiler changes are covered by existing test cases.
Added property-based tests for the new config validator.

---

By submitting this pull request, I confirm that my contribution is made
under the terms of the [Apache 2.0 license].

[Apache 2.0 license]: https://www.apache.org/licenses/LICENSE-2.0
Copy link
Contributor

This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.

@mrgrain
Copy link
Contributor

mrgrain commented May 14, 2024

This feature is no available as preview in jsii@5.4.16-dev.3
For now please refer to the PR aws/jsii-compiler#931 for documentation.

Pending beta testing, I expect this to be released next week and backported to all currently supported version lines (5.3.x and 5.2.x). Documentation and website updates are also underway.

aws-cdk-automation pushed a commit to aws/jsii-compiler that referenced this issue May 16, 2024
This PR introduces support for user-provided TypeScript configs through
new options to the CLI, the programmatic API and the `jsii` config
section in `package.json` respectively:

| CLI | package.json | Programmatic API | Description |
|-----|--------------|-------------------|-------------|
| `-c`, `--tsconfig` | `jsii.tsconfig` | `typeScriptConfig` | Use this
typescript configuration file to compile the jsii project. |
| `--validate-tsconfig` | `jsii.validateTsConfig` |
`validateTypeScriptConfig` | Validate the provided typescript
configuration file against a set of rules.|

The following validation rule sets are available:

| Rule set | Description |
|---------|-------------|
| **strict** ⭐ | Validates the provided config against a strict rule set
designed for maximum backwards-compatibility. |
| **generated** | Enforces a config as created by `--generate-tsconfig`.
Use this to stay compatible with the generated config, but have full
ownership over the file. |
| **minimal** | Only enforce options that are known to be incompatible
with jsii. This rule set is likely to be incomplete and new rules will
be added without notice as incompatibilities emerge. |
| **off** 🧪 | Disables all config validation, including options that are
known to be incompatible with jsii. Intended for experimentation only.
Use at your own risk. |

Resolves aws/jsii#2071

---

## Refactors

Mostly changed the compiler by moving some code around or into new
locations to be reused. Specifically the generated config was created in
multiple places without re-use. With this PR, loading or building the
tsconfig now happens once in the constructor and this config is used
through out.

## Testing strategy

Compiler changes are covered by existing test cases.
Added property-based tests for the new config validator.

---

By submitting this pull request, I confirm that my contribution is made
under the terms of the [Apache 2.0 license].

[Apache 2.0 license]: https://www.apache.org/licenses/LICENSE-2.0

(cherry picked from commit 14a51b9)
aws-cdk-automation pushed a commit to aws/jsii-compiler that referenced this issue May 16, 2024
This PR introduces support for user-provided TypeScript configs through
new options to the CLI, the programmatic API and the `jsii` config
section in `package.json` respectively:

| CLI | package.json | Programmatic API | Description |
|-----|--------------|-------------------|-------------|
| `-c`, `--tsconfig` | `jsii.tsconfig` | `typeScriptConfig` | Use this
typescript configuration file to compile the jsii project. |
| `--validate-tsconfig` | `jsii.validateTsConfig` |
`validateTypeScriptConfig` | Validate the provided typescript
configuration file against a set of rules.|

The following validation rule sets are available:

| Rule set | Description |
|---------|-------------|
| **strict** ⭐ | Validates the provided config against a strict rule set
designed for maximum backwards-compatibility. |
| **generated** | Enforces a config as created by `--generate-tsconfig`.
Use this to stay compatible with the generated config, but have full
ownership over the file. |
| **minimal** | Only enforce options that are known to be incompatible
with jsii. This rule set is likely to be incomplete and new rules will
be added without notice as incompatibilities emerge. |
| **off** 🧪 | Disables all config validation, including options that are
known to be incompatible with jsii. Intended for experimentation only.
Use at your own risk. |

Resolves aws/jsii#2071

---

## Refactors

Mostly changed the compiler by moving some code around or into new
locations to be reused. Specifically the generated config was created in
multiple places without re-use. With this PR, loading or building the
tsconfig now happens once in the constructor and this config is used
through out.

## Testing strategy

Compiler changes are covered by existing test cases.
Added property-based tests for the new config validator.

---

By submitting this pull request, I confirm that my contribution is made
under the terms of the [Apache 2.0 license].

[Apache 2.0 license]: https://www.apache.org/licenses/LICENSE-2.0

(cherry picked from commit 14a51b9)
aws-cdk-automation pushed a commit to aws/jsii-compiler that referenced this issue May 16, 2024
This PR introduces support for user-provided TypeScript configs through
new options to the CLI, the programmatic API and the `jsii` config
section in `package.json` respectively:

| CLI | package.json | Programmatic API | Description |
|-----|--------------|-------------------|-------------|
| `-c`, `--tsconfig` | `jsii.tsconfig` | `typeScriptConfig` | Use this
typescript configuration file to compile the jsii project. |
| `--validate-tsconfig` | `jsii.validateTsConfig` |
`validateTypeScriptConfig` | Validate the provided typescript
configuration file against a set of rules.|

The following validation rule sets are available:

| Rule set | Description |
|---------|-------------|
| **strict** ⭐ | Validates the provided config against a strict rule set
designed for maximum backwards-compatibility. |
| **generated** | Enforces a config as created by `--generate-tsconfig`.
Use this to stay compatible with the generated config, but have full
ownership over the file. |
| **minimal** | Only enforce options that are known to be incompatible
with jsii. This rule set is likely to be incomplete and new rules will
be added without notice as incompatibilities emerge. |
| **off** 🧪 | Disables all config validation, including options that are
known to be incompatible with jsii. Intended for experimentation only.
Use at your own risk. |

Resolves aws/jsii#2071

---

## Refactors

Mostly changed the compiler by moving some code around or into new
locations to be reused. Specifically the generated config was created in
multiple places without re-use. With this PR, loading or building the
tsconfig now happens once in the constructor and this config is used
through out.

## Testing strategy

Compiler changes are covered by existing test cases.
Added property-based tests for the new config validator.

---

By submitting this pull request, I confirm that my contribution is made
under the terms of the [Apache 2.0 license].

[Apache 2.0 license]: https://www.apache.org/licenses/LICENSE-2.0

(cherry picked from commit 14a51b9)
@mrgrain
Copy link
Contributor

mrgrain commented May 21, 2024

This is now releases as an experimental feature on jsii >= 5.2

Documentation:
https://aws.github.io/jsii/user-guides/lib-author/configuration/#typescript-configuration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort/medium Medium work item – a couple days of effort feature-request A feature should be added or improved. language/typescript Related to Typescript code p2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants