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

chore: Update JSII and TS #3819

Draft
wants to merge 37 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
05e3e1f
chore: Upgrade typescript to 5.4.5
mutahhir Feb 5, 2025
0338786
chore: Update jsii version and dockerfile
mutahhir Feb 5, 2025
e2d1879
chore: Update test yarn.lock
mutahhir Feb 6, 2025
511e135
chore: Ugrade eslint parser and plugins
mutahhir Feb 6, 2025
ec30005
chore: Bump ts version to 5.7.3
mutahhir Feb 6, 2025
7fb5f2c
chore: Update jsii to 5.7.3 as well
mutahhir Feb 6, 2025
9a60e7c
chore: Upgrade eslint, and align version requirements
mutahhir Feb 11, 2025
3daa603
chore: update lockfile
mutahhir Feb 11, 2025
ceca196
chore: Remove lines as recommended by husky warning
mutahhir Feb 11, 2025
f6e5ba6
chore: Add dependency types file
mutahhir Feb 11, 2025
99177fa
chore: add required copyright headers
hashicorp-copywrite[bot] Feb 11, 2025
0ce9089
chore: Update jsii-pacmak
mutahhir Feb 11, 2025
4f3df62
chore: Use yarn 2 cache folder cli command
mutahhir Feb 12, 2025
eb9aa91
chore: Check if build works with corepack enabled, and ignore .yarn f…
mutahhir Feb 12, 2025
6cfc13e
chore: Make package jsons more yarn 4 friendly
mutahhir Feb 12, 2025
ffe6b4a
fix: Premature shell expansion on yarn 4
mutahhir Feb 12, 2025
d9965cd
fix: unexpected react usage within function generator tool
mutahhir Feb 12, 2025
9a93791
fix: Errors building generate-function-bindings
mutahhir Feb 13, 2025
5d0b74f
fix: Lerna config no longer needs packages field and useWorkspaces
mutahhir Feb 13, 2025
470216f
chore: Enable yarn 2 for all CI jobs requiring the cache
mutahhir Feb 13, 2025
746de31
fix: Missing workflows that don't have Yarn 2 enabled
mutahhir Feb 13, 2025
1dba902
chore: Update test lockfile
mutahhir Feb 13, 2025
a3ace19
chore: Update lerna version to latest
mutahhir Feb 13, 2025
7bfbaec
fix: Remove @cdktf/cli-core imported as both dev and prod dependency …
mutahhir Feb 13, 2025
7f5f3e3
fix: Add typescript to generate-function-bindings tool
mutahhir Feb 13, 2025
e45ef9c
chore: Add files to eslingConfig
mutahhir Feb 13, 2025
ec2ee1d
chore: Remove --ext argument from eslint as it's deprecated
mutahhir Feb 13, 2025
168c46c
fix: Running integration tests on yarn 2 requires changes to config k…
mutahhir Feb 18, 2025
d692392
feat: Eslint 9 flat file support
mutahhir Feb 20, 2025
5c67928
chore: add required copyright headers
hashicorp-copywrite[bot] Feb 20, 2025
54b4d27
fix: Run prettier on missing files
mutahhir Feb 20, 2025
37053cb
fix: Prettier version, eslint config, run prettier, and solve errors
mutahhir Feb 20, 2025
0947d3b
fix: dependencies missing and extra
mutahhir Feb 20, 2025
e48efd2
fix: Use prettier 2 within hcl2cdk because prettier 3 uses promises
mutahhir Feb 21, 2025
f6f0005
fix: Install prettier and types for generate-function-bindings
mutahhir Feb 25, 2025
b98502a
test: See if jest likes importing with extension
mutahhir Feb 25, 2025
9371710
fix: Yarn 2 requires pre and post tasks to be explicitly called
mutahhir Feb 25, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 3 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@ jobs:
run: git config --global --add safe.directory /__w/terraform-cdk/terraform-cdk
- name: ensure correct user
run: chown -R root /__w/terraform-cdk
- name: Enable Yarn 2
run: corepack enable
# Setup caches for yarn, and go
- name: Get cache directory paths
id: global-cache-dir-path
run: |
echo "yarn=$(yarn cache dir)" >> $GITHUB_OUTPUT
echo "yarn=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
mkdir -p /usr/local/share/.cache/go
echo "go=/usr/local/share/.cache/go" >> $GITHUB_OUTPUT
- uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,13 @@ jobs:
run: git config --global --add safe.directory /__w/terraform-cdk/terraform-cdk
- name: ensure correct user
run: chown -R root /__w/terraform-cdk
- name: Enable Yarn 2
run: corepack enable
# Setup caches for yarn, terraform, and go
- name: Get cache directory paths
id: global-cache-dir-path
run: |
echo "yarn=$(yarn cache dir)" >> $GITHUB_OUTPUT
echo "yarn=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
mkdir -p /usr/local/share/.cache/terraform
echo "terraform=/usr/local/share/.cache/terraform" >> $GITHUB_OUTPUT
mkdir -p /usr/local/share/.cache/go
Expand All @@ -81,7 +83,7 @@ jobs:
go-${{ runner.os }}-
- name: installing dependencies
run: |
yarn install --frozen-lockfile --prefer-offline
yarn install --immutable
- name: lint
run: yarn lint:examples
- name: align version (Python only)
Expand Down
14 changes: 9 additions & 5 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,15 @@ jobs:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: "Add Git safe.directory" # Go 1.18+ started embedding repo info in the build and e.g. building @cdktf/hcl2json fails without this
run: git config --global --add safe.directory /__w/terraform-cdk/terraform-cdk
- name: Enable Yarn 2
run: corepack enable
- name: ensure correct user
run: chown -R root /__w/terraform-cdk
# Setup caches for yarn, and go
- name: Get cache directory paths
id: global-cache-dir-path
run: |
echo "yarn=$(yarn cache dir)" >> $GITHUB_OUTPUT
echo "yarn=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
mkdir -p /usr/local/share/.cache/go
echo "go=/usr/local/share/.cache/go" >> $GITHUB_OUTPUT
- uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
Expand All @@ -55,7 +57,7 @@ jobs:
go-${{ runner.os }}-${{ hashFiles('**/go.sum') }}-
go-${{ runner.os }}-
- name: install dependencies
run: yarn install --frozen-lockfile --prefer-offline
run: yarn install --immutable
- name: set version
if: ${{ !inputs.skip_setup }}
run: tools/align-version.sh "-dev.$GITHUB_RUN_ID"
Expand All @@ -81,7 +83,7 @@ jobs:
path: packages/@cdktf/provider-generator/edge-provider-bindings
- name: installing test dependencies
run: |
cd test && yarn install --frozen-lockfile --prefer-offline
cd test && yarn install --immutable
- id: build-test-matrix
run: |
./tools/build-test-matrix.sh
Expand All @@ -106,11 +108,13 @@ jobs:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: ensure correct user
run: chown -R root /__w/terraform-cdk
- name: Enable Yarn 2
run: corepack enable
# Setup caches for yarn, terraform, and go
- name: Get cache directory paths
id: global-cache-dir-path
run: |
echo "yarn=$(yarn cache dir)" >> $GITHUB_OUTPUT
echo "yarn=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
mkdir -p /usr/local/share/.cache/terraform
echo "terraform=/usr/local/share/.cache/terraform" >> $GITHUB_OUTPUT
mkdir -p /usr/local/share/.cache/go
Expand Down Expand Up @@ -182,7 +186,7 @@ jobs:
id: global-cache-dir-path
shell: bash
run: |
echo "yarn=$(yarn cache dir)" >> $GITHUB_OUTPUT
echo "yarn=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
mkdir -p /usr/local/share/.cache/terraform
echo "terraform=/usr/local/share/.cache/terraform" >> $GITHUB_OUTPUT
mkdir -p /usr/local/share/.cache/go
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@ jobs:
image: docker.mirror.hashicorp.services/hashicorp/jsii-terraform
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Enable Yarn 2
run: corepack enable
- name: installing dependencies
run: |
yarn install --frozen-lockfile
yarn install --immutable
- name: run prettier
run: |
yarn lint:prettier
Expand All @@ -34,9 +36,11 @@ jobs:
image: docker.mirror.hashicorp.services/hashicorp/jsii-terraform
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Enable Yarn 2
run: corepack enable
- name: installing dependencies
run: |
yarn install --frozen-lockfile
yarn install --immutable
- name: run workspace linting
run: |
yarn lint:workspace
10 changes: 6 additions & 4 deletions .github/workflows/provider-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,13 @@ jobs:
run: git config --global --add safe.directory /__w/terraform-cdk/terraform-cdk
- name: ensure correct user
run: chown -R root /__w/terraform-cdk
- name: Enable Yarn 2
run: corepack enable
# Setup caches for yarn, and go
- name: Get cache directory paths
id: global-cache-dir-path
run: |
echo "yarn=$(yarn cache dir)" >> $GITHUB_OUTPUT
echo "yarn=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
mkdir -p /usr/local/share/.cache/go
echo "go=/usr/local/share/.cache/go" >> $GITHUB_OUTPUT
- uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
Expand All @@ -62,7 +64,7 @@ jobs:
- name: installing dependencies and build
if: ${{ !inputs.skip_setup }}
run: |
yarn install --frozen-lockfile --prefer-offline
yarn install --immutable
tools/align-version.sh "-dev.$GITHUB_RUN_ID"
yarn build
yarn package
Expand Down Expand Up @@ -107,7 +109,7 @@ jobs:
- name: Get cache directory paths
id: global-cache-dir-path
run: |
echo "yarn=$(yarn cache dir)" >> $GITHUB_OUTPUT
echo "yarn=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
mkdir -p /usr/local/share/.cache/terraform
echo "terraform=/usr/local/share/.cache/terraform" >> $GITHUB_OUTPUT
# Only restoring yarn caches as the dependencies are not indiviual to each matrix job
Expand Down Expand Up @@ -168,7 +170,7 @@ jobs:
id: global-cache-dir-path
shell: bash
run: |
echo "yarn=$(yarn cache dir)" >> $GITHUB_OUTPUT
echo "yarn=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
mkdir -p /usr/local/share/.cache/terraform
echo "terraform=/usr/local/share/.cache/terraform" >> $GITHUB_OUTPUT
# Only restoring yarn caches to save available cache storage size
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ jobs:
run: git config --global --add safe.directory /__w/terraform-cdk/terraform-cdk
- name: ensure correct user
run: chown -R root /__w/terraform-cdk
- name: Enable Yarn 2
run: corepack enable
- name: version
id: get_version
run: |
Expand All @@ -54,7 +56,7 @@ jobs:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_TOKEN }}
- name: create bundle
run: |
yarn install --frozen-lockfile
yarn install --immutable
tools/align-version.sh
yarn build
yarn package
Expand Down Expand Up @@ -158,7 +160,7 @@ jobs:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: installing dependencies
run: |
yarn install --frozen-lockfile
yarn install --immutable
- name: Download build artifacts
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/release_next.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ jobs:
run: git config --global --add safe.directory /__w/terraform-cdk/terraform-cdk
- name: ensure correct user
run: chown -R root /__w/terraform-cdk
- name: Enable Yarn 2
run: corepack enable
- name: installing dependencies
run: yarn install --frozen-lockfile
run: yarn install --immutable
- name: Configure git user
run: |
git config user.name github-team-tf-cdk
Expand Down Expand Up @@ -61,7 +63,7 @@ jobs:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_TOKEN }}
- name: create bundle
run: |
yarn install --frozen-lockfile
yarn install --immutable
yarn build
yarn package
env:
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,14 @@ jobs:
run: git config --global --add safe.directory /__w/terraform-cdk/terraform-cdk
- name: ensure correct user
run: chown -R root /__w/terraform-cdk
- name: Enable Yarn 2
run: corepack enable

# Setup caches for yarn, terraform, go, and provider schema
- name: Get cache directory paths
id: global-cache-dir-path
run: |
echo "yarn=$(yarn cache dir)" >> $GITHUB_OUTPUT
echo "yarn=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
mkdir -p /usr/local/share/.cache/go
echo "go=/usr/local/share/.cache/go" >> $GITHUB_OUTPUT
mkdir -p /usr/local/share/.cache/providerSchema
Expand All @@ -63,7 +65,7 @@ jobs:

- name: installing dependencies
run: |
yarn install --frozen-lockfile --prefer-offline
yarn install --immutable
- name: compile
run: |
tools/align-version.sh
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/yarn-upgrade.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ jobs:
steps:
- name: Check Out
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Enable Yarn 2
run: corepack enable
- name: Get yarn cache directory path
id: global-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
path: ${{ steps.global-cache-dir-path.outputs.dir }}
Expand All @@ -54,7 +56,7 @@ jobs:

# This will ensure the current lockfile is up-to-date with the dependency specifications (necessary for "yarn upgrade" to run)
- name: Run "yarn install"
run: yarn install --prefer-offline
run: yarn install

# Next, create and upload the changes as a patch file. This will later be downloaded to create a pull request
# Creating a pull request requires write permissions and it's best to keep write privileges isolated.
Expand Down Expand Up @@ -151,7 +153,7 @@ jobs:
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Get yarn cache directory path
id: global-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
path: ${{ steps.global-cache-dir-path.outputs.dir }}
Expand Down Expand Up @@ -217,7 +219,7 @@ jobs:
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Get yarn cache directory path
id: global-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
path: ${{ steps.global-cache-dir-path.outputs.dir }}
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@ tsconfig.tsbuildinfo
examples/java/gradle-shared-module/.gradle/

.nx/
.yarn
3 changes: 0 additions & 3 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
4 changes: 4 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

nodeLinker: node-modules
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -1758,7 +1758,7 @@ const bucket = new s3.S3Bucket(this, "bucket");
const firstRuleStage = Fn.lookup(
bucket.lifecycleRule("0").tags,
"stage",
"no-stage"
"no-stage",
);
const firstRuleTags = bucket.lifecycleRule("0").tags;

Expand Down
58 changes: 58 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: MPL-2.0
*/

import monorepo from "eslint-plugin-monorepo";
import tsParser from "@typescript-eslint/parser";
import eslint from "@eslint/js";
import tseslint from "typescript-eslint";

export default [
{
ignores: [
"**/node_modules",
"**/dist",
"**/coverage",
"**/*.d.ts",
"**/*.js",
],
},
...tseslint.config(eslint.configs.recommended, tseslint.configs.recommended),
{
files: ["**/*.ts", "**/*.tsx"],

plugins: {
monorepo,
},

languageOptions: {
parser: tsParser,
},

rules: {
"monorepo/no-relative-import": "error",

"@typescript-eslint/no-explicit-any": 0,
"@typescript-eslint/explicit-function-return-type": 0,
"@typescript-eslint/no-use-before-define": 0,
"@typescript-eslint/explicit-module-boundary-types": 0,
"@typescript-eslint/no-var-requires": 0,
"@typescript-eslint/no-require-imports": "warn",
"@typescript-eslint/no-unused-vars": "warn",
"@typescript-eslint/no-unused-expressions": "warn",
"@typescript-eslint/no-empty-object-type": "warn",
"no-sequences": "error",
"no-unused-vars": "warn",
"prefer-const": "warn",
"no-useless-escape": "warn",

"no-irregular-whitespace": [
"error",
{
skipTemplates: true,
},
],
},
},
];
2 changes: 1 addition & 1 deletion examples/csharp/aws/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
"build": "cdktf get",
"synth": "cdktf synth"
}
}
}
2 changes: 1 addition & 1 deletion examples/csharp/azure/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
"build": "cdktf get",
"synth": "cdktf synth"
}
}
}
2 changes: 1 addition & 1 deletion examples/csharp/documentation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
"build": "cdktf get --parallelism 1 --show-performance-info",
"synth": "cdktf synth --show-performance-info"
}
}
}
2 changes: 1 addition & 1 deletion examples/csharp/google/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
"build": "cdktf get",
"synth": "cdktf synth"
}
}
}
2 changes: 1 addition & 1 deletion examples/csharp/ucloud/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
"build": "cdktf get",
"synth": "cdktf synth"
}
}
}
Loading
Loading