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

feat: Add CDKTF Helpers pkg #357

Merged
merged 1 commit into from
Dec 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,30 @@ on:

jobs:
test:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Run tests
run: make test-ci
test-cdktf:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
# pnpm required for setup-node cache support
# ref: https://github.com/actions/setup-node/blob/main/docs/advanced-usage.md#caching-packages-data
- name: Setup pnpm from .packageManager
with:
run_install: false
uses: pnpm/action-setup@v4
- name: Use Node.js from .nvmrc
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: "pnpm"
- name: Run pnpm test
run: |
pnpm install --frozen-lockfile
pnpm run test
2 changes: 1 addition & 1 deletion .github/workflows/conventional_commits_title.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:

jobs:
conventional_commit_title:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
# source https://github.com/chanzuckerberg/github-actions/blob/cac0ba177b109becac01bc340a3a1547feb40fe5/.github/actions/conventional-commits/action.yml
- uses: actions/github-script@v7
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dependabot_automerge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ concurrency:
cancel-in-progress: true
jobs:
dependabot:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- name: Dependabot metadata
Expand Down
40 changes: 39 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,14 @@ on:
- feat-multi-module-components

name: release-please
env:
CI: true
jobs:
release-please:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
permissions:
contents: read
packages: write
steps:
- name: release please
uses: google-github-actions/[email protected]
Expand All @@ -15,6 +20,8 @@ jobs:
# https://github.com/google-github-actions/release-please-action#github-credentials
token: ${{ secrets.VINCENT_PAT }}

## publish Go release

- uses: actions/checkout@v4
# we need to fetch all history and tags
# so we build the proper version
Expand All @@ -35,3 +42,34 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.VINCENT_PAT }}
if: ${{ steps.release.outputs.release_created }}

## publish CDKTF pkg

# pnpm required for setup-node cache support
# ref:
# - https://github.com/actions/setup-node/blob/main/docs/advanced-usage.md#caching-packages-data
# - https://docs.github.com/en/actions/use-cases-and-examples/publishing-packages/publishing-nodejs-packages#publishing-packages-to-github-packages
# - https://pnpm.io/using-changesets#publishing
- name: Setup pnpm from .packageManager
uses: pnpm/action-setup@v4
with:
run_install: false
if: ${{ steps.release.outputs.release_created }}
- name: Use Node.js from .nvmrc
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: "pnpm"
registry-url: "https://npm.pkg.github.com"
if: ${{ steps.release.outputs.release_created }}
- name: Run pnpm Build
run: |
pnpm install --frozen-lockfile
pnpm run build
if: ${{ steps.release.outputs.release_created }}
- name: Run pnpm Publish
run: pnpm ci:publish
env:
# setup-node action sets up .npmrc for NODE_AUTH_TOKEN
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: ${{ steps.release.outputs.release_created }}
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
fogg
coverage.out
dist
.vscode
!templates/templates/turbo/root/.vscode
!testdata/**/.vscode

coverage.txt

bin
node_modules/
package-lock.json

**/coverage/**
.turbo
node_modules
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@vincenthsh:registry=https://npm.pkg.github.com
auto-install-peers = true
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v18
3 changes: 3 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["biomejs.biome", "dbaeumer.vscode-eslint"]
}
20 changes: 20 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// Ref: https://vitest.dev/guide/debugging#vs-code
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Debug Current Test File",
"autoAttachChildProcesses": true,
"skipFiles": ["<node_internals>/**", "**/node_modules/**"],
"program": "${workspaceRoot}/node_modules/vitest/vitest.mjs",
"args": ["run", "${relativeFile}", "--update"],
"smartStep": true,
"console": "integratedTerminal"
}
]
}
15 changes: 15 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"eslint.workingDirectories": [
{
"mode": "auto"
}
],
"[javascript]": {
"editor.defaultFormatter": "biomejs.biome"
},
"editor.codeActionsOnSave": {
"quickfix.biome": "explicit",
"source.organizeImports.biome": "explicit"
},
"editor.formatOnSave": true
}
155 changes: 155 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
{
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
"vcs": { "enabled": true, "clientKind": "git", "useIgnoreFile": true },
"files": { "ignoreUnknown": false, "ignore": ["*.generated.ts"] },
"formatter": {
"enabled": true,
"useEditorconfig": true,
"formatWithErrors": false,
"indentStyle": "space",
"indentWidth": 2,
"lineEnding": "lf",
"lineWidth": 80,
"attributePosition": "auto",
"bracketSpacing": true
},
"organizeImports": { "enabled": true },
"linter": {
"enabled": true,
"rules": {
"recommended": false,
"complexity": {
"noBannedTypes": "off",
"noExtraBooleanCast": "error",
"noMultipleSpacesInRegularExpressionLiterals": "error",
"noUselessCatch": "error",
"noUselessTypeConstraint": "error",
"noWith": "error"
},
"correctness": {
"noConstAssign": "error",
"noConstantCondition": "error",
"noEmptyCharacterClassInRegex": "error",
"noEmptyPattern": "error",
"noGlobalObjectCalls": "error",
"noInvalidBuiltinInstantiation": "error",
"noInvalidConstructorSuper": "error",
"noNonoctalDecimalEscape": "error",
"noPrecisionLoss": "error",
"noSelfAssign": "error",
"noSetterReturn": "error",
"noSwitchDeclarations": "error",
"noUndeclaredVariables": "error",
"noUnreachable": "error",
"noUnreachableSuper": "error",
"noUnsafeFinally": "error",
"noUnsafeOptionalChaining": "error",
"noUnusedLabels": "error",
"noUnusedPrivateClassMembers": "error",
"noUnusedVariables": "error",
"useArrayLiterals": "off",
"useIsNan": "error",
"useValidForDirection": "error",
"useYield": "error"
},
"style": {
"noInferrableTypes": "off",
"noNamespace": "error",
"useAsConstAssertion": "error",
"useBlockStatements": "off"
},
"suspicious": {
"noAsyncPromiseExecutor": "error",
"noCatchAssign": "error",
"noClassAssign": "error",
"noCompareNegZero": "error",
"noConsole": "off",
"noControlCharactersInRegex": "error",
"noDebugger": "error",
"noDuplicateCase": "error",
"noDuplicateClassMembers": "error",
"noDuplicateObjectKeys": "error",
"noDuplicateParameters": "error",
"noEmptyBlockStatements": "error",
"noExplicitAny": "warn",
"noExtraNonNullAssertion": "error",
"noFallthroughSwitchClause": "error",
"noFunctionAssign": "error",
"noGlobalAssign": "error",
"noImportAssign": "error",
"noMisleadingCharacterClass": "error",
"noMisleadingInstantiator": "error",
"noPrototypeBuiltins": "error",
"noRedeclare": "error",
"noShadowRestrictedNames": "error",
"noSparseArray": "error",
"noUnsafeDeclarationMerging": "error",
"noUnsafeNegation": "error",
"useGetterReturn": "error",
"useNamespaceKeyword": "error",
"useValidTypeof": "error"
}
},
"ignore": [
".*.?(c)js",
"*.config*.?(c|m)js",
".*.ts",
"*.config*.ts",
"*.d.ts",
"dist",
".git",
"node_modules",
"coverage"
]
},
"javascript": {
"formatter": {
"jsxQuoteStyle": "double",
"quoteProperties": "asNeeded",
"trailingCommas": "all",
"semicolons": "asNeeded",
"arrowParentheses": "always",
"bracketSameLine": false,
"quoteStyle": "single",
"attributePosition": "auto",
"bracketSpacing": true
},
"globals": ["exports"]
},
"overrides": [
{
"include": ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts"],
"linter": {
"rules": {
"correctness": {
"noConstAssign": "off",
"noGlobalObjectCalls": "off",
"noInvalidBuiltinInstantiation": "off",
"noInvalidConstructorSuper": "off",
"noNewSymbol": "off",
"noSetterReturn": "off",
"noUndeclaredVariables": "off",
"noUnreachable": "off",
"noUnreachableSuper": "off"
},
"style": {
"noArguments": "error",
"noVar": "error",
"useConst": "error"
},
"suspicious": {
"noClassAssign": "off",
"noDuplicateClassMembers": "off",
"noDuplicateObjectKeys": "off",
"noDuplicateParameters": "off",
"noFunctionAssign": "off",
"noImportAssign": "off",
"noRedeclare": "off",
"noUnsafeNegation": "off",
"useGetterReturn": "off"
}
}
}
}
]
}
28 changes: 28 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "fogg-npm-monorepo",
"description": "Monorepo for Fogg npm packages",
"private": true,
"scripts": {
"type-check": "turbo type-check",
"test": "turbo test",
"build": "turbo run build",
"lint": "turbo run lint",
"format": "turbo run prettier",
"repo-lint": "sherif",
"clean": "turbo clean && rm -rf node_modules",
"ci:publish": "pnpm publish -r"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"@biomejs/biome": "1.9.4",
"sherif": "^1.0.2",
"turbo": "^2.3.3",
"vitest": "^2.1.6"
},
"packageManager": "[email protected]",
"engines": {
"node": ">=18.20.5"
}
}
3 changes: 3 additions & 0 deletions packages/cdktf-fogg-constructs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
cdktf.log
tsconfig.tsbuildinfo
7 changes: 7 additions & 0 deletions packages/cdktf-fogg-constructs/.hack/fogg-types/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Typescriptify Fogg structs

Generates TS Interface from Fogg golang structs

```bash
pnpm run go:generate
```
Loading
Loading