diff --git a/.github/workflows/pr-checks.yaml b/.github/workflows/pr-checks.yaml new file mode 100644 index 0000000..b72d32c --- /dev/null +++ b/.github/workflows/pr-checks.yaml @@ -0,0 +1,21 @@ +name: PR Checks (npm) + +on: + push: + branches: [main] + pull_request: + types: [opened, synchronize, reopened, ready_for_review] + workflow_dispatch: + +jobs: + check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: "20" + - run: npm ci + - run: npm run lint + - run: npm run build + - run: npm run test diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index aef5c48..cbe9b46 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,7 +1,7 @@ name: Publish package to NPM on: release: - types: [ published ] + types: [published] jobs: build: runs-on: ubuntu-latest @@ -14,7 +14,7 @@ jobs: - uses: actions/setup-node@v4 with: node-version: "20.x" - registry-url: 'https://registry.npmjs.org' + registry-url: "https://registry.npmjs.org" - run: npm ci - run: npm run build - run: npm run test diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index cc441aa..f84ddf7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,7 +2,7 @@ name: Build and test on: push: - branches: [ main ] + branches: [main] jobs: build: @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node-version: [ 20.x ] + node-version: [20.x] steps: - uses: actions/checkout@v4 @@ -19,7 +19,7 @@ jobs: uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} - registry-url: 'https://registry.npmjs.org' + registry-url: "https://registry.npmjs.org" - run: npm ci - run: npm run build - run: npm run test diff --git a/jest.config.js b/jest.config.js index 08263b8..a8f075a 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,8 +1,8 @@ module.exports = { - testEnvironment: 'node', - roots: ['/test'], - testMatch: ['**/*.test.ts'], + testEnvironment: "node", + roots: ["/test"], + testMatch: ["**/*.test.ts"], transform: { - '^.+\\.tsx?$': 'ts-jest' - } + "^.+\\.tsx?$": "ts-jest", + }, }; diff --git a/package-lock.json b/package-lock.json index b2ed8d3..bdf5ae3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,12 +8,6 @@ "name": "@restatedev/restate-cdk", "version": "1.0.1", "license": "MIT", - "workspaces": [ - "test/handlers" - ], - "dependencies": { - "tsx": "^4.17.0" - }, "devDependencies": { "@types/aws-lambda": "^8.10.143", "@types/jest": "^29.5.12", @@ -1311,13 +1305,6 @@ "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", "dev": true }, - "node_modules/@bufbuild/protobuf": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/@bufbuild/protobuf/-/protobuf-1.10.0.tgz", - "integrity": "sha512-QDdVFLoN93Zjg36NoQPZfsVH9tZew7wKDKyV5qRdj8ntT4wQCOradQjRaTdwMhWUYsgKsvCINKKm87FdEk96Ag==", - "dev": true, - "license": "(Apache-2.0 AND BSD-3-Clause)" - }, "node_modules/@cspotcode/source-map-support": { "version": "0.8.1", "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", @@ -1351,6 +1338,7 @@ "cpu": [ "ppc64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1367,6 +1355,7 @@ "cpu": [ "arm" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1383,6 +1372,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1399,6 +1389,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1415,6 +1406,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1431,6 +1423,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1447,6 +1440,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1463,6 +1457,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1479,6 +1474,7 @@ "cpu": [ "arm" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1495,6 +1491,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1511,6 +1508,7 @@ "cpu": [ "ia32" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1527,6 +1525,7 @@ "cpu": [ "loong64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1543,6 +1542,7 @@ "cpu": [ "mips64el" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1559,6 +1559,7 @@ "cpu": [ "ppc64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1575,6 +1576,7 @@ "cpu": [ "riscv64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1591,6 +1593,7 @@ "cpu": [ "s390x" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1607,6 +1610,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1623,6 +1627,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1639,6 +1644,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1655,6 +1661,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1671,6 +1678,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1687,6 +1695,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1703,6 +1712,7 @@ "cpu": [ "ia32" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1719,6 +1729,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2079,30 +2090,6 @@ "@jridgewell/sourcemap-codec": "^1.4.14" } }, - "node_modules/@restatedev/restate-sdk": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@restatedev/restate-sdk/-/restate-sdk-1.2.0.tgz", - "integrity": "sha512-NCfp5qg7hNzS4jSUHCii1wq8UaiBr50rhfFXh86SX1acQYSb3rCZLZOVx/FMOelLjqTzPdoaY5h5RP8H35918g==", - "dev": true, - "license": "MIT", - "dependencies": { - "@bufbuild/protobuf": "^1.8.0", - "@restatedev/restate-sdk-core": "^1.2.0" - }, - "engines": { - "node": ">= 18" - } - }, - "node_modules/@restatedev/restate-sdk-core": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@restatedev/restate-sdk-core/-/restate-sdk-core-1.2.0.tgz", - "integrity": "sha512-mKiX8iQWHqY+B+rAJIvhniIIND3p33LKSLfiF12NsDgsxnIjc6wUOj4oja9v+p9E7SuXkH/M6L2qKpKntT/bmw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 18" - } - }, "node_modules/@sinclair/typebox": { "version": "0.27.8", "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", @@ -2841,10 +2828,11 @@ "dev": true }, "node_modules/acorn": { - "version": "8.11.3", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz", - "integrity": "sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==", + "version": "8.12.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.12.1.tgz", + "integrity": "sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg==", "dev": true, + "license": "MIT", "optional": true, "peer": true, "bin": { @@ -3862,6 +3850,7 @@ "version": "0.23.0", "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.23.0.tgz", "integrity": "sha512-1lvV17H2bMYda/WaFb2jLPeHU3zml2k4/yagNMG8Q/YtfMjCwEUZa2eXXMgZTVSL5q1n4H7sQ0X6CdJDqqeCFA==", + "dev": true, "hasInstallScript": true, "license": "MIT", "bin": { @@ -4173,18 +4162,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/get-tsconfig": { - "version": "4.7.6", - "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.7.6.tgz", - "integrity": "sha512-ZAqrLlu18NbDdRaHq+AKXzAmqIUPswPWKUchfytdAjiRFnCe5ojG2bstg6mRiZabkKfCoL/e98pbBELIV/YCeA==", - "license": "MIT", - "dependencies": { - "resolve-pkg-maps": "^1.0.0" - }, - "funding": { - "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1" - } - }, "node_modules/glob": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", @@ -4220,10 +4197,6 @@ "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", "dev": true }, - "node_modules/handlers": { - "resolved": "test/handlers", - "link": true - }, "node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -5672,15 +5645,6 @@ "node": ">=8" } }, - "node_modules/resolve-pkg-maps": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", - "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", - "license": "MIT", - "funding": { - "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" - } - }, "node_modules/resolve.exports": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/resolve.exports/-/resolve.exports-2.0.2.tgz", @@ -6051,39 +6015,6 @@ "integrity": "sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ==", "peer": true }, - "node_modules/tsx": { - "version": "4.17.0", - "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.17.0.tgz", - "integrity": "sha512-eN4mnDA5UMKDt4YZixo9tBioibaMBpoxBkD+rIPAjVmYERSG0/dWEY1CEFuV89CgASlKL499q8AhmkMnnjtOJg==", - "license": "MIT", - "dependencies": { - "esbuild": "~0.23.0", - "get-tsconfig": "^4.7.5" - }, - "bin": { - "tsx": "dist/cli.mjs" - }, - "engines": { - "node": ">=18.0.0" - }, - "optionalDependencies": { - "fsevents": "~2.3.3" - } - }, - "node_modules/tsx/node_modules/fsevents": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", - "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", - "hasInstallScript": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, "node_modules/type-detect": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", @@ -6326,6 +6257,7 @@ } }, "test/handlers": { + "extraneous": true, "license": "ISC", "devDependencies": { "@restatedev/restate-sdk": "^1.2.0", diff --git a/package.json b/package.json index 180a0a7..cec9a34 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "postbundle": "cd dist && zip -r index.zip index.js*", "watch": "tsc -w", "test": "jest", + "lint": "npx prettier --check .", "cdk": "cdk" }, "devDependencies": { diff --git a/tsconfig.json b/tsconfig.json index 6f03ece..269b82f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,10 +2,7 @@ "compilerOptions": { "target": "ES2020", "module": "commonjs", - "lib": [ - "es2020", - "dom" - ], + "lib": ["es2020", "dom"], "declaration": true, "strict": true, "noImplicitAny": true, @@ -20,17 +17,10 @@ "inlineSources": true, "experimentalDecorators": true, "strictPropertyInitialization": false, - "typeRoots": [ - "./node_modules/@types" - ], + "typeRoots": ["./node_modules/@types"], "esModuleInterop": true, "outDir": "dist" }, - "include": [ - "lib/**/*" - ], - "exclude": [ - "node_modules", - "cdk.out" - ] + "include": ["lib/**/*"], + "exclude": ["node_modules", "cdk.out"] }