diff --git a/.projen/deps.json b/.projen/deps.json index ee6311d..9655836 100644 --- a/.projen/deps.json +++ b/.projen/deps.json @@ -116,17 +116,17 @@ }, { "name": "@cdktf/provider-null", - "version": ">=9.0.0", + "version": ">=10.0.0", "type": "peer" }, { "name": "cdktf", - "version": ">=0.19.0", + "version": ">=0.20.0", "type": "peer" }, { "name": "constructs", - "version": "^10.0.25", + "version": ">=10.3.0", "type": "peer" } ], diff --git a/.projenrc.ts b/.projenrc.ts index c551e96..292f99b 100644 --- a/.projenrc.ts +++ b/.projenrc.ts @@ -28,6 +28,7 @@ const githubActionPinnedVersions = { "peter-evans/create-pull-request": "153407881ec5c347639a548ade7d8ad1d6740e38", // v5.0.2 }; +const constructsVersion = "10.3.0"; const project = new cdktf.ConstructLibraryCdktf({ name, description: "A projen template for CDKTF constructs authored by HashiCorp", @@ -75,16 +76,17 @@ const project = new cdktf.ConstructLibraryCdktf({ // moduleName: `github.com/cdktf/${shortName}-go`, // packageName: shortName.replace(/-/g, ""), // }, - cdktfVersion: "0.19.0", + cdktfVersion: "0.20.0", + constructsVersion, jsiiVersion: "~5.2.0", typescriptVersion: "~5.2.0", // should always be the same major/minor as JSII minNodeVersion: "18.12.0", }); project.addPeerDeps( - "cdktf@>=0.19.0", - "@cdktf/provider-null@>=9.0.0", - "constructs@^10.0.25" + "cdktf@>=0.20.0", + "@cdktf/provider-null@>=10.0.0", + "constructs@>=" + constructsVersion ); project.addDevDeps( "change-case", diff --git a/API.md b/API.md index 593a184..0d5d568 100644 --- a/API.md +++ b/API.md @@ -42,10 +42,12 @@ new NoopStack(scope: Construct, name: string) | dependsOn | *No description.* | | ensureBackendExists | *No description.* | | getLogicalId | *No description.* | +| hasResourceMove | *No description.* | | prepareStack | *No description.* | | registerIncomingCrossStackReference | *No description.* | | registerOutgoingCrossStackReference | *No description.* | | runAllValidations | Run all validations on the stack. | +| toHclTerraform | *No description.* | | toTerraform | *No description.* | --- @@ -124,6 +126,12 @@ public getLogicalId(tfElement: Node | TerraformElement): string --- +##### `hasResourceMove` + +```typescript +public hasResourceMove(): boolean +``` + ##### `prepareStack` ```typescript @@ -162,6 +170,12 @@ public runAllValidations(): void Run all validations on the stack. +##### `toHclTerraform` + +```typescript +public toHclTerraform(): {[ key: string ]: any} +``` + ##### `toTerraform` ```typescript @@ -178,7 +192,7 @@ public toTerraform(): any --- -##### ~~`isConstruct`~~ +##### `isConstruct` ```typescript import { NoopStack } from '@cdktf/construct-projen-template' @@ -188,6 +202,20 @@ NoopStack.isConstruct(x: any) Checks if `x` is a construct. +Use this method instead of `instanceof` to properly detect `Construct` +instances, even when the construct library is symlinked. + +Explanation: in JavaScript, multiple copies of the `constructs` library on +disk are seen as independent, completely different libraries. As a +consequence, the class `Construct` in each copy of the `constructs` library +is seen as a different class, and an instance of one class will not test as +`instanceof` the other class. `npm install` will not create installations +like this, but users may manually symlink construct libraries together or +use a monorepo tool: in those cases, multiple copies of the `constructs` +library can be accidentally installed, and `instanceof` will behave +unpredictably. It is safest to avoid using `instanceof`, and using +this type-testing method instead. + ###### `x`Required - *Type:* any diff --git a/README.md b/README.md index 45c3113..8ca7aac 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ A projen template for CDKTF constructs authored by HashiCorp (internal use only) ## Compatibility - `node` >= 18.12.0 -- `cdktf` >= 0.19.0 +- `cdktf` >= 0.20.0 - `constructs` >= 10.0.25 ## How to Use diff --git a/package.json b/package.json index 8f46f28..aad48f7 100644 --- a/package.json +++ b/package.json @@ -37,14 +37,14 @@ "devDependencies": { "@action-validator/cli": "^0.5.4", "@action-validator/core": "^0.5.4", - "@cdktf/provider-null": "9.0.0", + "@cdktf/provider-null": "10.0.0", "@types/jest": "^29.5.11", "@types/node": "^18", "@typescript-eslint/eslint-plugin": "^6", "@typescript-eslint/parser": "^6", - "cdktf": "0.19.0", + "cdktf": "0.20.0", "change-case": "^4.1.2", - "constructs": "10.0.25", + "constructs": "10.3.0", "eslint": "^8", "eslint-config-prettier": "^8.10.0", "eslint-import-resolver-typescript": "^3.6.1", @@ -65,9 +65,9 @@ "typescript": "~5.2.0" }, "peerDependencies": { - "@cdktf/provider-null": ">=9.0.0", - "cdktf": ">=0.19.0", - "constructs": "^10.0.25" + "@cdktf/provider-null": ">=10.0.0", + "cdktf": ">=0.20.0", + "constructs": ">=10.3.0" }, "keywords": [ "cdk", diff --git a/test/index.spec.ts b/test/index.spec.ts index e1d7fd3..fb5bc4a 100644 --- a/test/index.spec.ts +++ b/test/index.spec.ts @@ -33,7 +33,7 @@ test("synthesizes the null provider", () => { "required_providers": { "null": { "source": "null", - "version": "3.2.1" + "version": "3.2.2" } } } diff --git a/yarn.lock b/yarn.lock index 0162699..e88f629 100644 --- a/yarn.lock +++ b/yarn.lock @@ -314,10 +314,10 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@cdktf/provider-null@9.0.0": - version "9.0.0" - resolved "https://registry.yarnpkg.com/@cdktf/provider-null/-/provider-null-9.0.0.tgz#ee33adc837076ce9f9a54252c846a6344c5abedb" - integrity sha512-5osel2UvwtB2RaOHECFvane43E4RbhOLzhrRUGJjoPCpb2E7LT8vrq4r9nA098BQvxGHPWtE+YR5OsvWUH5ouA== +"@cdktf/provider-null@10.0.0": + version "10.0.0" + resolved "https://registry.yarnpkg.com/@cdktf/provider-null/-/provider-null-10.0.0.tgz#ad045643fbbfbc5cc8566a2bdf37279e5d8ca4f2" + integrity sha512-r/2z3N4Z1ADjh4hu3BOyKRcXr0OE1f/b5kh+IdC2BF2dhHVaXGHw2Cvogd+R73PjgBNBv/pZa+wOY16tlgNpaQ== "@cspotcode/source-map-support@^0.8.0": version "0.8.1" @@ -1090,16 +1090,16 @@ archiver-utils@^3.0.4: normalize-path "^3.0.0" readable-stream "^3.6.0" -archiver@5.3.1: - version "5.3.1" - resolved "https://registry.yarnpkg.com/archiver/-/archiver-5.3.1.tgz#21e92811d6f09ecfce649fbefefe8c79e57cbbb6" - integrity sha512-8KyabkmbYrH+9ibcTScQ1xCJC/CGcugdVIwB+53f5sZziXgwUh3iXlAlANMxcZyDEfTHMe6+Z5FofV8nopXP7w== +archiver@5.3.2: + version "5.3.2" + resolved "https://registry.yarnpkg.com/archiver/-/archiver-5.3.2.tgz#99991d5957e53bd0303a392979276ac4ddccf3b0" + integrity sha512-+25nxyyznAXF7Nef3y0EbBeqmGZgeN/BxHX29Rs39djAfaFalmQ89SE6CWyDCHzGL0yt/ycBtNOmGTW0FyGWNw== dependencies: archiver-utils "^2.1.0" - async "^3.2.3" + async "^3.2.4" buffer-crc32 "^0.2.1" readable-stream "^3.6.0" - readdir-glob "^1.0.0" + readdir-glob "^1.1.2" tar-stream "^2.2.0" zip-stream "^4.1.0" @@ -1203,7 +1203,7 @@ arrify@^1.0.1: resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" integrity sha512-3CYzex9M9FGQjCGMGyi6/31c8GJbgb0qGyrx5HWxPd0aCwh4cB2YjMb2Xf9UuoogrMrlO9cTqnB5rI5GHZTcUA== -async@^3.2.3: +async@^3.2.4: version "3.2.5" resolved "https://registry.yarnpkg.com/async/-/async-3.2.5.tgz#ebd52a8fdaf7a2289a24df399f8d8485c8a46b66" integrity sha512-baNZyqaaLhyLVKm/DlvdW051MSgO6b8eVfIezl9E5PqWxFgzLm/wQntEW4zOytVburDEr0JlALEpdOFwvErLsg== @@ -1416,14 +1416,14 @@ case@^1.6.3: resolved "https://registry.yarnpkg.com/case/-/case-1.6.3.tgz#0a4386e3e9825351ca2e6216c60467ff5f1ea1c9" integrity sha512-mzDSXIPaFwVDvZAHqZ9VlbyF4yyXRuX6IvB06WvPYkqJVO24kX1PPhv9bfpKNFZyxYFmmgo03HUiD8iklmJYRQ== -cdktf@0.19.0: - version "0.19.0" - resolved "https://registry.yarnpkg.com/cdktf/-/cdktf-0.19.0.tgz#097a3241b95e77eeab8ae1f7a714bf45dc6ca55b" - integrity sha512-5tcNhvrvsE9WawC5cPwV7B9ATQ5lWNjyCJN7EnMofxTtkBEdnnGx0esC+vpNO4Fs0LhmV37qCUlm+K6anZaPYw== +cdktf@0.20.0: + version "0.20.0" + resolved "https://registry.yarnpkg.com/cdktf/-/cdktf-0.20.0.tgz#fae129c9431350ebbf02a95129db6687ee323e43" + integrity sha512-4bCG1/7cYYGyiC++zxJ5wPUZVuxeXvZLY2BqE9heTV/PZtlcwUrV6wfUMtQFbYTCssCEJDnGrOe7Rw1Jf0Sf2w== dependencies: - archiver "5.3.1" - json-stable-stringify "^1.0.2" - semver "^7.5.3" + archiver "5.3.2" + json-stable-stringify "1.1.0" + semver "7.5.4" chalk@5.2.0: version "5.2.0" @@ -1609,12 +1609,7 @@ constant-case@^3.0.4: tslib "^2.0.3" upper-case "^2.0.2" -constructs@10.0.25: - version "10.0.25" - resolved "https://registry.yarnpkg.com/constructs/-/constructs-10.0.25.tgz#c2f03fb4da134105fdf5382f4c1557b89d90aeeb" - integrity sha512-QxY4A7caIW1tI5ztbdZHKU/nWXiqluujmEVj5xCVhFhoBgOqU4ja3z3zXY4DUn2nf+PLxCjulf+viQ/h9RXB8A== - -constructs@^10.0.0: +constructs@10.3.0, constructs@^10.0.0: version "10.3.0" resolved "https://registry.yarnpkg.com/constructs/-/constructs-10.3.0.tgz#4c246fce9cf8e77711ad45944e9fbd41f1501965" integrity sha512-vbK8i3rIb/xwZxSpTjz3SagHn1qq9BChLEfy5Hf6fB3/2eFbrwt2n9kHwQcS0CPTRBesreeAcsJfMq2229FnbQ== @@ -3643,7 +3638,7 @@ json-stable-stringify-without-jsonify@^1.0.1: resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" integrity sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw== -json-stable-stringify@^1.0.2: +json-stable-stringify@1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/json-stable-stringify/-/json-stable-stringify-1.1.0.tgz#43d39c7c8da34bfaf785a61a56808b0def9f747d" integrity sha512-zfA+5SuwYN2VWqN1/5HZaDzQKLJHaBVMZIIM+wuYjdptkaQsqzDdqjqf+lZZJUuJq1aanHiY8LhH8LmH+qBYJA== @@ -4452,7 +4447,7 @@ readable-stream@^2.0.0, readable-stream@^2.0.5, readable-stream@~2.3.6: string_decoder "~1.1.1" util-deprecate "~1.0.1" -readdir-glob@^1.0.0: +readdir-glob@^1.1.2: version "1.1.3" resolved "https://registry.yarnpkg.com/readdir-glob/-/readdir-glob-1.1.3.tgz#c3d831f51f5e7bfa62fa2ffbe4b508c640f09584" integrity sha512-v05I2k7xN8zXvPD9N+z/uhXPaj0sUFCe2rcWZIpBsqxfP7xXFQ0tipAd/wjj1YxWyWtUS5IDJpOG82JKt2EAVA== @@ -4599,18 +4594,18 @@ semver-intersect@^1.4.0, semver-intersect@^1.5.0: resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.2.tgz#48d55db737c3287cd4835e17fa13feace1c41ef8" integrity sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g== -semver@^6.0.0, semver@^6.3.0, semver@^6.3.1: - version "6.3.1" - resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" - integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== - -semver@^7.1.1, semver@^7.3.2, semver@^7.3.4, semver@^7.5.3, semver@^7.5.4: +semver@7.5.4, semver@^7.1.1, semver@^7.3.2, semver@^7.3.4, semver@^7.5.3, semver@^7.5.4: version "7.5.4" resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.4.tgz#483986ec4ed38e1c6c48c34894a9182dbff68a6e" integrity sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA== dependencies: lru-cache "^6.0.0" +semver@^6.0.0, semver@^6.3.0, semver@^6.3.1: + version "6.3.1" + resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" + integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== + sentence-case@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/sentence-case/-/sentence-case-3.0.4.tgz#3645a7b8c117c787fde8702056225bb62a45131f"