Skip to content

Commit

Permalink
chore: add upgrade prompt at load of jsii and jsii-rosetta 1.x (#4071)
Browse files Browse the repository at this point in the history
This is to strongly incitate customers upgrade their dependencies, while trying to avoid alarming (there is 18 months left before the End-of-Support is scheduled, which is PLENTY of time).



---

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
  • Loading branch information
RomainMuller authored Apr 26, 2023
1 parent ac72ee4 commit 2cb15f8
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/jsii-rosetta/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ export * from './rosetta-translator';
export * from './snippet';
export * from './markdown';
export * from './strict';

import './upgrade-prompt';
21 changes: 21 additions & 0 deletions packages/jsii-rosetta/lib/upgrade-prompt.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Note: intentionally using the same environment variable as the compiler here instead of customizing...
if (process.env.JSII_SUPPRESS_UPGRADE_PROMPT == null) {
console.error(
[
'#######################################################################################################',
'### You are currently using jsii-rosetta@1.x. We recommend upgrading to jsii-rosetta@5.0.x or ###',
'### later. This will allow you to use modern TypeScript syntax, and improves compatibility with ###',
'### many common dependencies. For example, recent versions of @types/node. ###',
'### ###',
'### 5.0.x and subsequent releases of jsii-rosetta use the same major.minor version as the ###',
'### TypeScript compiler they are built on. We recommend declaring a minor-pinned (also known as ###',
'### "tilde") dependency on jsii-rosetta (e.g: `"jsii-rosetta": "5.0.x"` or ###',
'### `"jsii-rosetta": "~5.0.7"`). ###',
'### ###',
'### For more information, see: https://aws.github.io/jsii/compiler-and-rosetta-maintenance/ ###',
'### ###',
'### This warning can be suppressed by setting the JSII_SUPPRESS_UPGRADE_PROMPT environment variable ###',
'#######################################################################################################',
].join('\n'),
);
}
2 changes: 2 additions & 0 deletions packages/jsii/lib/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import './upgrade-prompt';

export * from './jsii-diagnostic';
export * from './symbol-id';
export * from './helpers';
19 changes: 19 additions & 0 deletions packages/jsii/lib/upgrade-prompt.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
if (process.env.JSII_SUPPRESS_UPGRADE_PROMPT == null) {
console.error(
[
'#######################################################################################################',
'### You are currently using jsii@1.x. We recommend upgrading to jsii@5.0.x or later. This will ###',
'### allow you to use modern TypeScript syntax, and improves compatibility with many common ###',
'### dependencies. For example, recent versions of @types/node. ###',
'### ###',
'### 5.0.x and subsequent releases of jsii use the same major.minor version as the TypeScript ###',
'### compiler they are built on. We recommend declaring a minor-pinned (also known as "tilde") ###',
'### dependency on jsii (e.g: `"jsii": "5.0.x"` or `"jsii": "~5.0.7"`). ###',
'### ###',
'### For more information, see: https://aws.github.io/jsii/compiler-and-rosetta-maintenance/ ###',
'### ###',
'### This warning can be suppressed by setting the JSII_SUPPRESS_UPGRADE_PROMPT environment variable ###',
'#######################################################################################################',
].join('\n'),
);
}

0 comments on commit 2cb15f8

Please sign in to comment.