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

fix: typescript-app template broken for npm > 7 #362

Merged
merged 13 commits into from
Jun 29, 2022

Conversation

iliapolo
Copy link
Member

@iliapolo iliapolo commented Jun 28, 2022

The typescript-app template has a few npm scripts in its package.json that run tsc.

By default, the tsc command resolves to ./node_modules/.bin/tsc. This used to be ok, until a change made it so this bin script gets overridden by a different typescript version than the one declared in the template. A fix has already been merged, which should take of this issue. However, we can also fix it in our template by having the scripts point to the expected tsc path.

When investigating this issue, it also struck me as weird this wasn't detected in the cli init templates tests.
This is because up until now, our init template were using the source code of the CLI to run against, instead of the tarball.
In addition, we did not have any tests executed against newer versions of node, where npm got a major version bump and underwent some substantial behavior changes.

So, this PR also adds the following:

  • Treat init template tests as integration tests that are executed against the packaged tarball.
  • Run all init templates tests in parallel of build on node 14 in a dedicated workflow
  • Run only typescript-app template in parallel of build on node 16 and node 18 in a dedicated workflow

Also, switch to typescript for projen file.

Fixes #363

iliapolo added 8 commits June 28, 2022 16:18
Signed-off-by: iliapolo <epolon@amazon.com>
Signed-off-by: iliapolo <epolon@amazon.com>
Signed-off-by: iliapolo <epolon@amazon.com>
Signed-off-by: iliapolo <epolon@amazon.com>
Signed-off-by: iliapolo <epolon@amazon.com>
Signed-off-by: iliapolo <epolon@amazon.com>
Signed-off-by: iliapolo <epolon@amazon.com>
Signed-off-by: iliapolo <epolon@amazon.com>
name: 'cdk8s-cli',
description: 'This is the command line tool for Cloud Development Kit (CDK) for Kubernetes (cdk8s).',
repositoryUrl: 'https://github.com/cdk8s-team/cdk8s-cli.git',
projenUpgradeSecret: 'PROJEN_GITHUB_TOKEN',
authorName: 'Amazon Web Services',
authorUrl: 'https://aws.amazon.com',
minNodeVersion: '14.17.0',
defaultReleaseBranch: 'main',
Copy link
Member Author

Choose a reason for hiding this comment

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

Leftover from before we had a branch per major version

@@ -62,11 +63,12 @@ const project = new typescript.TypeScriptProject({
'typescript-json-schema',
],

// we need the compiled .js files for the init tests (we run the cli in there)
compileBeforeTest: true,
Copy link
Member Author

Choose a reason for hiding this comment

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

Not necessary anymore since init templates are not part of the test command anymore

iliapolo added 2 commits June 28, 2022 17:41
Signed-off-by: iliapolo <epolon@amazon.com>
Signed-off-by: iliapolo <epolon@amazon.com>
@iliapolo iliapolo requested a review from a team June 28, 2022 14:44
@iliapolo iliapolo marked this pull request as ready for review June 28, 2022 14:45
Signed-off-by: iliapolo <epolon@amazon.com>
@iliapolo iliapolo changed the title chore: init templates as integration tests on multiple node versions fix: typescript-app template broken for npm > 7 Jun 28, 2022
@iliapolo iliapolo requested a review from RomainMuller June 28, 2022 20:18
@iliapolo iliapolo merged commit 77bc7b3 into 2.x Jun 29, 2022
@iliapolo iliapolo deleted the epolon/init-test-from-package branch June 29, 2022 19:14
@cdk8s-automation
Copy link
Contributor

⚪ Backport skipped

The pull request was not backported as there were no branches to backport to. If this is a mistake, please apply the desired version labels or run the backport tool manually.

Manual backport

To create the backport manually run:

backport --pr 362

Questions ?

Please refer to the Backport tool documentation

iliapolo added a commit that referenced this pull request Jun 29, 2022
(cherry picked from commit 77bc7b3)
Signed-off-by: Eli Polonsky <epolon@amazon.com>
@iliapolo
Copy link
Member Author

💚 All backports created successfully

Status Branch Result
1.x

Questions ?

Please refer to the Backport tool documentation

mergify bot pushed a commit that referenced this pull request Jul 6, 2022
# Backport

This will backport the following commits from `2.x` to `1.x`:
 - [fix: typescript-app template broken for npm > 7 (#362)](#362)



### Questions ?
Please refer to the [Backport tool documentation](https://github.com/sqren/backport)
RomainMuller added a commit that referenced this pull request Jul 27, 2022
#362 made the `compile` and `watch` scripts of the
`typescript-app` template use a relative path to the `tsc` compiler,
however such a form does not work as intended on Windows...

Instead of doing this, explicitly declare a `devDependency` on the
`typescript` compiler and return to using just `tsc`. Also, pass the
`--build` argument, which speeds up incremental builds considerably.
RomainMuller added a commit that referenced this pull request Jul 27, 2022
#362 made the `compile` and `watch` scripts of the
`typescript-app` template use a relative path to the `tsc` compiler,
however such a form does not work as intended on Windows...

Instead of doing this, explicitly declare a `devDependency` on the
`typescript` compiler and return to using just `tsc`. Also, pass the
`--build` argument, which speeds up incremental builds considerably.

Signed-off-by: 🧑🏻‍💻 Romain Marcadier <rmuller@amazon.com>
mergify bot pushed a commit that referenced this pull request Aug 28, 2022
#362 made the `compile` and `watch` scripts of the
`typescript-app` template use a relative path to the `tsc` compiler,
however such a form does not work as intended on Windows...

Instead of doing this, explicitly declare a `devDependency` on the
`typescript` compiler and return to using just `tsc`. Also, pass the
`--build` argument, which speeds up incremental builds considerably.
cdk8s-automation pushed a commit that referenced this pull request Aug 28, 2022
#362 made the `compile` and `watch` scripts of the
`typescript-app` template use a relative path to the `tsc` compiler,
however such a form does not work as intended on Windows...

Instead of doing this, explicitly declare a `devDependency` on the
`typescript` compiler and return to using just `tsc`. Also, pass the
`--build` argument, which speeds up incremental builds considerably.

(cherry picked from commit 43d9db1)
Signed-off-by: Romain Marcadier <rmuller@amazon.com>
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

Successfully merging this pull request may close these issues.

"error TS2315: Type 'IsTuple' is not generic" and others when compiling
3 participants