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

Vendor TypeScript and ts-node #15622

Merged
merged 1 commit into from
Apr 10, 2024
Merged

Conversation

julienp
Copy link
Contributor

@julienp julienp commented Mar 7, 2024

Description

Fixes #15733

Historically these packages were direct dependencies of
@pulumi/pulumi. To decouple the node SDK from the precise version of
TypeScript, the packages are now declared as optional peer pependencies
of @pulumi/pulumi and customers can pick the versions they want.

The reason we mark the peer dependencies as optional is to prevent
package managers from automatically installing them. This avoids the
situation where the package manger would install a more recent version
of TypeScript without the user explictly opting in. Newer versions have
stricter type checks, and can thus stop existing programs from running
successfully.

When the peer dependencies are not present, we load the vendored
versions of the modules.

Checklist

  • I have run make tidy to update any new dependencies
  • I have run make lint to verify my code passes the lint check
    • I have formatted my code using gofumpt
  • I have added tests that prove my fix is effective or that my feature works
  • I have run make changelog and committed the changelog/pending/<file> documenting my change
  • Yes, there are changes in this PR that warrants bumping the Pulumi Cloud API version

@julienp julienp changed the title Make typescript & ts-node peer dependencies [WIP] Make typescript & ts-node peer dependencies Mar 7, 2024
@pulumi-bot
Copy link
Contributor

pulumi-bot commented Mar 7, 2024

Changelog

[uncommitted] (2024-04-09)

Features

  • [sdk/nodejs] Make TypeScript and ts-node optional peer dependencies to allow using user specified versions
    #15622

@julienp julienp force-pushed the julienp/typescript-peer-dependency branch 3 times, most recently from 94e8118 to 6cd4c67 Compare March 8, 2024 16:28
sdk/nodejs/vendor/README.md Outdated Show resolved Hide resolved
@julienp julienp force-pushed the julienp/typescript-peer-dependency branch from 6cd4c67 to d39079a Compare March 26, 2024 15:35
@julienp julienp added the ci/test Test CI pipelines on this PR label Mar 26, 2024
@julienp julienp force-pushed the julienp/typescript-peer-dependency branch from d39079a to 11c0cae Compare March 26, 2024 16:25
"sinon": "^14.0.0"
"sinon": "^14.0.0",
"ts-node": "^7.0.1",
"typescript": "~3.8.3"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Make ts-node and typescript devDependencies so they are available while working on this repo.

@julienp julienp changed the title [WIP] Make typescript & ts-node peer dependencies Vendor TypeScript and ts-node Mar 26, 2024
@julienp julienp force-pushed the julienp/typescript-peer-dependency branch 3 times, most recently from fb8f025 to 913a457 Compare March 26, 2024 17:42
@julienp julienp force-pushed the julienp/typescript-peer-dependency branch 4 times, most recently from 3c2bb44 to 19b9ea3 Compare March 27, 2024 16:03
compilerOptions: {
strict: true,
target: "es2016",
module: "commonjs",
Copy link
Contributor Author

@julienp julienp Mar 28, 2024

Choose a reason for hiding this comment

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

It might be interesting to have an option here in the future for node16 to emit ESM.

@julienp julienp force-pushed the julienp/typescript-peer-dependency branch from 19b9ea3 to 328d7d5 Compare March 28, 2024 14:25
@julienp julienp marked this pull request as ready for review March 29, 2024 09:50
@julienp julienp requested a review from a team as a code owner March 29, 2024 09:50
Copy link
Member

@justinvp justinvp left a comment

Choose a reason for hiding this comment

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

Some minor things, but otherwise LGTM

Do we need to make any other changes elsewhere before merging this? Like updating templates? Should we give the providers team a heads-up that they can't rely on @pulumi/pulumi for pulling-in tsc to compile the provider SDK (I believe many (most?) providers are already specifying their own TS dependency).

sdk/nodejs/tests/runtime/pack.ts Show resolved Hide resolved
sdk/nodejs/tsconfig.json Outdated Show resolved Hide resolved
sdk/nodejs/tsutils.ts Show resolved Hide resolved
sdk/nodejs/runtime/closure/utils.ts Outdated Show resolved Hide resolved
sdk/nodejs/runtime/closure/rewriteSuper.ts Outdated Show resolved Hide resolved
sdk/nodejs/cmd/run-policy-pack/run.ts Outdated Show resolved Hide resolved
sdk/nodejs/cmd/run/run.ts Outdated Show resolved Hide resolved
sdk/nodejs/runtime/closure/parseFunction.ts Outdated Show resolved Hide resolved
Vendor TypeScript and ts-node.

Historically these packages were direct dependencies of
`@pulumi/pulumi`. To decouple the node SDK from the precise version of
TypeScript, the packages are now declared as optional peer pependencies
of `@pulumi/pulumi` and customers can pick the versions they want.

The reason we mark the peer dependencies as *optional* is to prevent
package managers from automatically installing them. This avoids the
situation where the package manger would install a more recent version
of TypeScript without the user explictly opting in. Newer versions have
stricter type checks, and can thus stop existing programs from running
successfully.

When the peer dependencies are not present, we load the vendored
versions of the modules.
@julienp julienp force-pushed the julienp/typescript-peer-dependency branch from 328d7d5 to 924aae8 Compare April 9, 2024 08:36
@julienp
Copy link
Contributor Author

julienp commented Apr 9, 2024

Some minor things, but otherwise LGTM

Do we need to make any other changes elsewhere before merging this? Like updating templates? Should we give the providers team a heads-up that they can't rely on @pulumi/pulumi for pulling-in tsc to compile the provider SDK (I believe many (most?) providers are already specifying their own TS dependency).

Templates should be updated after this is released. It's only after we release this that it's safe to use different TypeScript versions.

@julienp julienp added this pull request to the merge queue Apr 10, 2024
Merged via the queue into master with commit fa2a196 Apr 10, 2024
91 checks passed
@julienp julienp deleted the julienp/typescript-peer-dependency branch April 10, 2024 16:33
github-merge-queue bot pushed a commit that referenced this pull request Apr 11, 2024
Tentative changelog:


### Features

- [cli] Support always fully qualifying stack names in CLI output
  [#15857](#15857)

- [cli] Add --no-plugins and --no-dependencies to `pulumi install`
  [#15910](#15910)

- [docs] Implement Java constructor syntax examples
  [#15805](#15805)

- [sdk/nodejs] Make TypeScript and ts-node optional peer dependencies to
allow using user specified versions
  [#15622](#15622)

- [sdk/{nodejs,python}] Allow apply to have unknown values during
updates
  [#15898](#15898)

- [sdk/python] Adds 'typeChecker' runtime option to the Python language
host
  [#15725](#15725)


### Bug Fixes

- [auto] Tolerate missing stack and bookkeeping files in ProgramTest.
  [#15863](#15863)

- [cli] Fix a panic when user's home directory could not be looked up
  [#15872](#15872)

- [cli] Fix some commands that didn't respect
`--disable-integrity-checking`

- [programgen/dotnet] Removes trailing whitespace from emitted DependsOn
resource option expressions
  [#15892](#15892)

- [auto/go] Avoid flakyness when reading the event log from pulumi
commands
  [#15856](#15856)

- [sdk/go] Fix Provider and Providers options in Go transform functions
  [#15885](#15885)

- [sdk/nodejs] Handle serialization of aliases for well known native
functions
  [#15873](#15873)

- [sdk/nodejs] Correctly serialise functions whose code would make use
of reserved identifiers
  [#15879](#15879)

- [sdk/nodejs] Serialize function values obtained from Function.bind
  [#15887](#15887)

- [sdk/python] Improve types of getters in Python SDK
  [#15865](#15865)

- [sdkgen/{dotnet,go}] Fixes SDK-generation when referencing shared
types in config variables
  [#15772](#15772)


### Miscellaneous

- [sdk/nodejs] Update builtin module list for function serialization
  [#15830](#15830)

- [sdk/nodejs] Set package.json engines to node >= 18
  [#15845](#15845)
@justinvp justinvp mentioned this pull request Apr 11, 2024
github-merge-queue bot pushed a commit that referenced this pull request Apr 12, 2024
### Features

- [cli] Support always fully qualifying stack names in CLI output
  [#15857](#15857)

- [cli] Add --no-plugins and --no-dependencies to `pulumi install`
  [#15910](#15910)

- [docs] Implement Java constructor syntax examples
  [#15805](#15805)

- [sdk/nodejs] Make TypeScript and ts-node optional peer dependencies to
allow using user specified versions
  [#15622](#15622)

- [sdk/{nodejs,python}] Allow apply to have unknown values during
updates
  [#15898](#15898)

- [sdk/python] Adds 'typeChecker' runtime option to the Python language
host
  [#15725](#15725)


### Bug Fixes

- [auto] Tolerate missing stack and bookkeeping files in ProgramTest.
  [#15863](#15863)

- [cli] Fix a panic when user's home directory could not be looked up
  [#15872](#15872)

- [cli] Fix some commands that didn't respect
`--disable-integrity-checking`
  [#15911](#15911)

- [programgen/dotnet] Removes trailing whitespace from emitted DependsOn
resource option expressions
  [#15892](#15892)

- [auto/go] Avoid flakyness when reading the event log from pulumi
commands
  [#15856](#15856)

- [sdk/go] Fix Provider and Providers options in Go transform functions
  [#15885](#15885)

- [sdk/nodejs] Handle serialization of aliases for well known native
functions
  [#15873](#15873)

- [sdk/nodejs] Correctly serialise functions whose code would make use
of reserved identifiers
  [#15879](#15879)

- [sdk/nodejs] Serialize function values obtained from Function.bind
  [#15887](#15887)

- [sdk/python] Improve types of getters in Python SDK
  [#15865](#15865)

- [sdkgen/{dotnet,go}] Fixes SDK-generation when referencing shared
types in config variables
  [#15772](#15772)


### Miscellaneous

- [sdk/nodejs] Update builtin module list for function serialization
  [#15830](#15830)

- [sdk/nodejs] Set package.json engines to node >= 18
  [#15845](#15845)
@justinvp justinvp mentioned this pull request Apr 12, 2024
github-merge-queue bot pushed a commit that referenced this pull request Apr 15, 2024
### Features

- [auto/{go,nodejs,python}] Add support for continue-on-error parameter
of the destroy command to the Automation API
  [#15921](#15921)

- [cli] Support always fully qualifying stack names in CLI output
  [#15857](#15857)

- [cli] Add --no-plugins and --no-dependencies to `pulumi install`
  [#15910](#15910)

- [docs] Implement Java constructor syntax examples
  [#15805](#15805)

- [sdk/nodejs] Make TypeScript and ts-node optional peer dependencies to
allow using user specified versions
  [#15622](#15622)

- [sdk/{nodejs,python}] Allow apply to have unknown values during
updates
  [#15898](#15898)

- [sdk/python] Add 'typeChecker' runtime option to the Python language
host
  [#15922](#15922)
  [#15725](#15725)


### Bug Fixes

- [auto] Tolerate missing stack and bookkeeping files in ProgramTest
  [#15922](#15922)
  [#15863](#15863)

- [cli] Fix a panic when user's home directory could not be looked up
  [#15872](#15872)

- [cli] Fix some commands that didn't respect
`--disable-integrity-checking`
  [#15911](#15911)

- [programgen/dotnet] Remove trailing whitespace from emitted DependsOn
resource option expressions
  [#15922](#15922)
  [#15892](#15892)

- [auto/go] Avoid flakyness when reading the event log from pulumi
commands
  [#15856](#15856)

- [sdk/go] Fix Provider and Providers options in Go transform functions
  [#15885](#15885)

- [sdk/nodejs] Handle serialization of aliases for well known native
functions
  [#15873](#15873)

- [sdk/nodejs] Correctly serialise functions whose code would make use
of reserved identifiers
  [#15879](#15879)

- [sdk/nodejs] Serialize function values obtained from Function.bind
  [#15887](#15887)

- [sdk/python] Improve types of getters in Python SDK
  [#15865](#15865)

- [sdkgen/{dotnet,go}] Fix SDK-generation when referencing shared types
in config variables
  [#15772](#15772)
  [#15922](#15922)


### Miscellaneous

- [sdk/nodejs] Update builtin module list for function serialization
  [#15830](#15830)

- [sdk/nodejs] Set package.json engines to node >= 18
  [#15845](#15845)
@Shyam-Chen Shyam-Chen mentioned this pull request Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci/test Test CI pipelines on this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bundle ts-node and typescript to prevent errors when peer deps are not automatically installed
4 participants