From dcfee74050bda7f9f7e7c97fad577cedf40f55f0 Mon Sep 17 00:00:00 2001 From: Jack Williams Date: Fri, 17 Nov 2023 16:21:55 +0000 Subject: [PATCH 1/7] Add `middleware-e2e-encryption` middleware example (#402) ## Summary Adds an example middleware, [`middleware-e2e-encryption`](https://github.com/inngest/inngest-js/tree/middleware-encryption-example/examples/middleware-e2e-encryption). ## Checklist - [ ] ~~Added a [docs PR](https://github.com/inngest/website) that references this PR~~ N/A - [ ] ~~Added unit/integration tests~~ N/A - [x] Added changesets if applicable --- .github/workflows/pr.yml | 2 +- examples/middleware-e2e-encryption/README.md | 37 ++++++++ .../fullEncryptionMiddlware.ts | 86 +++++++++++++++++++ .../middleware-e2e-encryption/package.json | 18 ++++ .../stepEncryptionMiddleware.ts | 74 ++++++++++++++++ packages/inngest/CONTRIBUTING.md | 3 +- packages/inngest/scripts/runExample.ts | 2 +- 7 files changed, 219 insertions(+), 3 deletions(-) create mode 100644 examples/middleware-e2e-encryption/README.md create mode 100644 examples/middleware-e2e-encryption/fullEncryptionMiddlware.ts create mode 100644 examples/middleware-e2e-encryption/package.json create mode 100644 examples/middleware-e2e-encryption/stepEncryptionMiddleware.ts diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index abf0d584a..f62d4ba54 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -112,7 +112,7 @@ jobs: - id: matrix run: | blocklist=$(grep -v '^#' examples/.inngestignore | jq -R . | jq -s .) - echo "matrix=$(find examples -mindepth 1 -maxdepth 1 -type d | grep -v -f <(echo $blocklist | jq -r '.[]') | xargs -n 1 basename | jq -R -s -c 'split("\n")[:-1]')" >> $GITHUB_OUTPUT + echo "matrix=$(find examples -mindepth 1 -maxdepth 1 -type d -name 'framework-*' | grep -v -f <(echo $blocklist | jq -r '.[]') | xargs -n 1 basename | jq -R -s -c 'split("\n")[:-1]')" >> $GITHUB_OUTPUT examples: name: Test examples diff --git a/examples/middleware-e2e-encryption/README.md b/examples/middleware-e2e-encryption/README.md new file mode 100644 index 000000000..7fe908531 --- /dev/null +++ b/examples/middleware-e2e-encryption/README.md @@ -0,0 +1,37 @@ +# E2E Encryption + +We can use middleware to encrypt data before it's shipped to Inngest and decrypt it as it comes back in to functions. + +In [`stepEncryptionMiddleware.ts`](./stepEncryptionMiddleware.ts), we provide an example of encrypting and decrypting all step state as it is passed to and from Inngest. This example's "encryption" is just stringifying and reversing the value - in practice you'll want to replace this with your own method using something like [`node:crypto`](https://nodejs.org/api/crypto.html). + +> [!WARNING] +> If you encrypt your step data and lose your encryption key, you'll lose access to all encrypted state. Be careful! In addition, seeing step results in the Inngest dashboard will no longer be possible. + +```ts +const inngest = new Inngest({ + id: "my-app", + middleware: [stepEncryptionMiddleware()], +}); + +inngest.createFunction( + { id: "example-function" }, + { event: "app/user.created" }, + async ({ event, step }) => { + /** + * The return value of `db.get()` - and therefore the value of `user` is now + * silently encrypted and decrypted by the middleware; no plain-text step + * data leaves your server or is stored in Inngest Cloud. + */ + const user = await step.run("get-user", () => + db.get("user", event.data.userId) + ); + } +); +``` + +It's also easily possible to also encrypt all event data, too, with [`fullEncryptionMiddleware.ts`](./fullEncryptionMiddlware.ts). + +> [!WARNING] +> Encrypting event data means that using features of Inngest such as `step.waitForEvent()` with expressions and browsing event data in the dashboard are no longer possible. + +Be aware that, unlike step data, event data is much more commonly shared between systems; think about if you need to also encrypt your event data before doing so. diff --git a/examples/middleware-e2e-encryption/fullEncryptionMiddlware.ts b/examples/middleware-e2e-encryption/fullEncryptionMiddlware.ts new file mode 100644 index 000000000..bbca94a42 --- /dev/null +++ b/examples/middleware-e2e-encryption/fullEncryptionMiddlware.ts @@ -0,0 +1,86 @@ +import { InngestMiddleware } from "inngest"; + +const encryptionMarker = "__ENCRYPTED__"; +type EncryptedValue = { [encryptionMarker]: true; data: string }; + +export const encryptionMiddleware = ( + key: string = process.env.INNGEST_ENCRYPTION_KEY as string +) => { + if (!key) { + throw new Error("Missing INNGEST_ENCRYPTION_KEY environment variable"); + } + + // Some internal functions that we'll use to encrypt and decrypt values. + // In practice, you'll want to use the `key` passed in to handle encryption + // properly. + const isEncryptedValue = (value: unknown): value is EncryptedValue => { + return ( + typeof value === "object" && + value !== null && + encryptionMarker in value && + value[encryptionMarker] === true && + "data" in value && + typeof value["data"] === "string" + ); + }; + + const encrypt = (value: unknown): EncryptedValue => { + return { + [encryptionMarker]: true, + data: JSON.stringify(value).split("").reverse().join(""), + }; + }; + + const decrypt = (value: T): T => { + if (isEncryptedValue(value)) { + return JSON.parse(value.data.split("").reverse().join("")) as T; + } + + return value; + }; + + return new InngestMiddleware({ + name: "Full Encryption Middleware", + init: () => ({ + onSendEvent: () => ({ + transformInput: ({ payloads }) => ({ + payloads: payloads.map((payload) => ({ + ...payload, + data: payload.data && encrypt(payload.data), + })), + }), + }), + onFunctionRun: () => ({ + transformInput: ({ ctx, steps }) => ({ + steps: steps.map((step) => ({ + ...step, + data: step.data && decrypt(step.data), + })), + ctx: { + event: ctx.event && { + ...ctx.event, + data: ctx.event.data && decrypt(ctx.event.data), + }, + events: + ctx.events && + ctx.events?.map((event) => ({ + ...event, + data: event.data && decrypt(event.data), + })), + } as {}, + }), + transformOutput: (ctx) => { + if (!ctx.step) { + return; + } + + return { + result: { + data: ctx.result.data && encrypt(ctx.result.data), + }, + }; + }, + }), + }), + }); +}; diff --git a/examples/middleware-e2e-encryption/package.json b/examples/middleware-e2e-encryption/package.json new file mode 100644 index 000000000..92d1adba0 --- /dev/null +++ b/examples/middleware-e2e-encryption/package.json @@ -0,0 +1,18 @@ +{ + "name": "middleware-e2e-encryption", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [], + "author": "", + "license": "ISC", + "dependencies": { + "inngest": "^3.0.0" + }, + "devDependencies": { + "@types/node": "^20.9.1" + } +} diff --git a/examples/middleware-e2e-encryption/stepEncryptionMiddleware.ts b/examples/middleware-e2e-encryption/stepEncryptionMiddleware.ts new file mode 100644 index 000000000..bba97c453 --- /dev/null +++ b/examples/middleware-e2e-encryption/stepEncryptionMiddleware.ts @@ -0,0 +1,74 @@ +import { InngestMiddleware } from "inngest"; + +const encryptionMarker = "__ENCRYPTED__"; +type EncryptedValue = { [encryptionMarker]: true; data: string }; + +export const encryptionMiddleware = ( + key: string = process.env.INNGEST_ENCRYPTION_KEY as string +) => { + if (!key) { + throw new Error("Missing INNGEST_ENCRYPTION_KEY environment variable"); + } + + // Some internal functions that we'll use to encrypt and decrypt values. + // In practice, you'll want to use the `key` passed in to handle encryption + // properly. + const isEncryptedValue = (value: unknown): value is EncryptedValue => { + return ( + typeof value === "object" && + value !== null && + encryptionMarker in value && + value[encryptionMarker] === true && + "data" in value && + typeof value["data"] === "string" + ); + }; + + const encrypt = (value: unknown): EncryptedValue => { + return { + [encryptionMarker]: true, + data: JSON.stringify(value).split("").reverse().join(""), + }; + }; + + const decrypt = (value: T): T => { + if (isEncryptedValue(value)) { + return JSON.parse(value.data.split("").reverse().join("")) as T; + } + + return value; + }; + + return new InngestMiddleware({ + name: "Step Encryption Middleware", + init: () => ({ + onSendEvent: () => ({ + transformInput: ({ payloads }) => ({ + payloads: payloads.map((payload) => ({ + ...payload, + data: payload.data && encrypt(payload.data), + })), + }), + }), + onFunctionRun: () => ({ + transformInput: ({ ctx, steps }) => ({ + steps: steps.map((step) => ({ + ...step, + data: step.data && decrypt(step.data), + })), + }), + transformOutput: (ctx) => { + if (!ctx.step) { + return; + } + + return { + result: { + data: ctx.result.data && encrypt(ctx.result.data), + }, + }; + }, + }), + }), + }); +}; diff --git a/packages/inngest/CONTRIBUTING.md b/packages/inngest/CONTRIBUTING.md index ec37bd26a..b8ce282df 100644 --- a/packages/inngest/CONTRIBUTING.md +++ b/packages/inngest/CONTRIBUTING.md @@ -83,9 +83,10 @@ We can create new examples using the following formula: 1. Clone or create a new example in [examples/](../../examples/) using one of the following naming conventions: - `framework-` - bare-bones framework example - `with-` - using another library or service + - `middleware-` - a single-file example of middleware - `-` - e.g. `email-drip-campaign` - `-` - e.g. `fan-out-weekly-digest`, `parallel-` -2. Run the example using `pnpm dev:example` and confirm it works +2. If it's a runnable example, run the example using `pnpm dev:example` and confirm it works 3. Ensure the `inngest` version in `package.json` is set to the latest major version, e.g. `^3.0.0` 4. Remove all lock files, e.g. `package-lock.json` 5. Adapt a `README.md` from an existing example, which should include: diff --git a/packages/inngest/scripts/runExample.ts b/packages/inngest/scripts/runExample.ts index dbee01991..9ec230f68 100644 --- a/packages/inngest/scripts/runExample.ts +++ b/packages/inngest/scripts/runExample.ts @@ -25,7 +25,7 @@ const examplesPath = path.join(__dirname, "..", "..", "..", "examples"); const examples: string[] = fs .readdirSync(examplesPath, { withFileTypes: true }) - .filter((file) => file.isDirectory()) + .filter((file) => file.isDirectory() && file.name.startsWith("framework-")) .map((file) => file.name); const exampleFromFlag: string = (argv.example as string) ?? ""; From 996e3b7296505714104d15e7d1eebaeee2445b21 Mon Sep 17 00:00:00 2001 From: Jack Williams Date: Fri, 17 Nov 2023 18:55:35 +0000 Subject: [PATCH 2/7] Add `@inngest/eslint-plugin` package (#377) ## Summary Adds a new [`@inngest/eslint-plugin`](https://www.npmjs.com/package/@inngest/eslint-plugin/v/0.0.1-pr-377.2) package to help guard against common mistakes. ## Checklist - [ ] ~~Added a [docs PR](https://github.com/inngest/website) that references this PR~~ N/A Releasing later - [x] Added unit/integration tests - [x] Added changesets if applicable ## Related - INN-815 --- .changeset/mighty-lamps-greet.md | 5 + .github/actions/setup-and-build/action.yml | 5 + .github/workflows/pr.yml | 37 +++-- .github/workflows/prerelease.yml | 64 ++++++- .github/workflows/release.yml | 2 +- package.json | 11 +- packages/eslint-plugin/.gitignore | 2 + packages/eslint-plugin/README.md | 135 +++++++++++++++ packages/eslint-plugin/jest.config.js | 7 + packages/eslint-plugin/package.json | 36 ++++ packages/eslint-plugin/src/configs/index.ts | 1 + .../eslint-plugin/src/configs/recommended.ts | 7 + packages/eslint-plugin/src/index.ts | 2 + .../src/rules/await-inngest-send.test.ts | 20 +++ .../src/rules/await-inngest-send.ts | 45 +++++ packages/eslint-plugin/src/rules/index.ts | 10 ++ .../src/rules/no-nested-steps.test.ts | 24 +++ .../src/rules/no-nested-steps.ts | 56 +++++++ .../no-variable-mutation-in-step.test.ts | 45 +++++ .../src/rules/no-variable-mutation-in-step.ts | 80 +++++++++ packages/eslint-plugin/tsconfig.json | 109 ++++++++++++ packages/inngest/package.json | 2 +- pnpm-lock.yaml | 156 +++++++++++++++--- .../scripts => scripts/release}/prerelease.js | 11 +- .../release.js => scripts/release/publish.js | 34 ++-- scripts/release/tag.js | 28 ++++ 26 files changed, 870 insertions(+), 64 deletions(-) create mode 100644 .changeset/mighty-lamps-greet.md create mode 100644 packages/eslint-plugin/.gitignore create mode 100644 packages/eslint-plugin/README.md create mode 100644 packages/eslint-plugin/jest.config.js create mode 100644 packages/eslint-plugin/package.json create mode 100644 packages/eslint-plugin/src/configs/index.ts create mode 100644 packages/eslint-plugin/src/configs/recommended.ts create mode 100644 packages/eslint-plugin/src/index.ts create mode 100644 packages/eslint-plugin/src/rules/await-inngest-send.test.ts create mode 100644 packages/eslint-plugin/src/rules/await-inngest-send.ts create mode 100644 packages/eslint-plugin/src/rules/index.ts create mode 100644 packages/eslint-plugin/src/rules/no-nested-steps.test.ts create mode 100644 packages/eslint-plugin/src/rules/no-nested-steps.ts create mode 100644 packages/eslint-plugin/src/rules/no-variable-mutation-in-step.test.ts create mode 100644 packages/eslint-plugin/src/rules/no-variable-mutation-in-step.ts create mode 100644 packages/eslint-plugin/tsconfig.json rename {packages/inngest/scripts => scripts/release}/prerelease.js (85%) rename packages/inngest/scripts/release.js => scripts/release/publish.js (80%) create mode 100644 scripts/release/tag.js diff --git a/.changeset/mighty-lamps-greet.md b/.changeset/mighty-lamps-greet.md new file mode 100644 index 000000000..be5caa552 --- /dev/null +++ b/.changeset/mighty-lamps-greet.md @@ -0,0 +1,5 @@ +--- +"@inngest/eslint-plugin": patch +--- + +Release `@inngest/eslint-plugin` package to help capture common gotchas diff --git a/.github/actions/setup-and-build/action.yml b/.github/actions/setup-and-build/action.yml index e5eb4d845..ab33c91cf 100644 --- a/.github/actions/setup-and-build/action.yml +++ b/.github/actions/setup-and-build/action.yml @@ -5,6 +5,10 @@ inputs: description: 'The directory to run the action in.' required: false default: '.' + install-dependencies: + description: 'Whether dependencies should be installed.' + required: false + default: true build: description: 'Whether the build step should be run.' required: false @@ -27,6 +31,7 @@ runs: shell: bash - name: Install dependencies + if: ${{ inputs.install-dependencies == 'true' }} run: pnpm install shell: bash working-directory: ${{ inputs.working-directory }}/packages/inngest diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index f62d4ba54..49dab03c9 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -16,8 +16,8 @@ env: NODE_AUTH_TOKEN: nothing jobs: - test: - name: Runtime + inngest_test: + name: "inngest: Runtime tests" runs-on: ubuntu-latest defaults: run: @@ -39,8 +39,8 @@ jobs: # Uses npm as pnpm doesn't support Node < 16 - run: node --version && npm --version && npm run test - types: - name: Types + inngest_types: + name: "inngest: Type tests" runs-on: ubuntu-latest defaults: run: @@ -62,8 +62,8 @@ jobs: - run: pnpm add -D typescript@${{ matrix.tsVersion }} - run: pnpm run test:types - api_diff: - name: Local API diff + inngest_api_diff: + name: "inngest: Local API diff" runs-on: ubuntu-latest defaults: run: @@ -73,8 +73,8 @@ jobs: - uses: ./.github/actions/setup-and-build - run: pnpm run api-extractor run - lint: - name: Lint + inngest_lint: + name: "inngest: Lint" runs-on: ubuntu-latest defaults: run: @@ -84,8 +84,23 @@ jobs: - uses: ./.github/actions/setup-and-build - run: pnpm run lint - package: - name: Package + "eslint-plugin_test": + name: "eslint-plugin: Test" + runs-on: ubuntu-latest + defaults: + run: + working-directory: packages/eslint-plugin + steps: + - uses: actions/checkout@v3 + - uses: ./.github/actions/setup-and-build + with: + install-dependencies: false + build: false + - run: pnpm install + - run: pnpm test + + package_inngest: + name: "inngest: Package" runs-on: ubuntu-latest defaults: run: @@ -120,7 +135,7 @@ jobs: defaults: run: working-directory: packages/inngest - needs: [examples-matrix, package] + needs: [examples-matrix, package_inngest] strategy: fail-fast: false matrix: diff --git a/.github/workflows/prerelease.yml b/.github/workflows/prerelease.yml index 0b76a7989..13251aa59 100644 --- a/.github/workflows/prerelease.yml +++ b/.github/workflows/prerelease.yml @@ -10,11 +10,14 @@ env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} jobs: - prelease: + prelease_inngest: runs-on: ubuntu-latest permissions: contents: write id-token: write + defaults: + run: + working-directory: packages/inngest if: contains(github.event.pull_request.labels.*.name, 'prerelease/inngest') steps: - uses: actions/checkout@v3 @@ -24,22 +27,22 @@ jobs: - uses: ./.github/actions/setup-and-build - name: Prerelease PR - run: node scripts/prerelease.js - working-directory: packages/inngest + run: node ../../scripts/release/prerelease.js env: TAG: pr-${{ github.event.pull_request.number }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }} NODE_ENV: test # disable npm access checks; they don't work in CI + DIST_DIR: dist - name: Update PR with latest prerelease uses: edumserrano/find-create-or-update-comment@v1 with: token: ${{ secrets.CHANGESET_GITHUB_TOKEN }} issue-number: ${{ github.event.pull_request.number }} - body-includes: '' + body-includes: '' comment-author: 'inngest-release-bot' body: | # can be a single value or you can compose text with multi-line values - + A user has added the [prerelease/inngest](https://github.com/inngest/inngest-js/labels/prerelease%2Finngest) label, so this PR will be published to npm with the tag `pr-${{ github.event.pull_request.number }}`. It will be updated with the latest changes as you push commits to this PR. You can install this prerelease version with: @@ -50,3 +53,54 @@ jobs: The last release was built and published from ${{ github.event.pull_request.head.sha }}. edit-mode: replace + + prerelease_eslint-plugin: + runs-on: ubuntu-latest + permissions: + contents: write + id-token: write + defaults: + run: + working-directory: packages/eslint-plugin + if: contains(github.event.pull_request.labels.*.name, 'prerelease/eslint-plugin') + steps: + - uses: actions/checkout@v3 + with: + persist-credentials: false + + - uses: ./.github/actions/setup-and-build + with: + install-dependencies: false + build: false + + - run: pnpm install + + - run: pnpm build + + - name: Prerelease PR + run: node ../../scripts/release/prerelease.js + env: + TAG: pr-${{ github.event.pull_request.number }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + NODE_ENV: test # disable npm access checks; they don't work in CI + + - name: Update PR with latest prerelease + uses: edumserrano/find-create-or-update-comment@v1 + with: + token: ${{ secrets.CHANGESET_GITHUB_TOKEN }} + issue-number: ${{ github.event.pull_request.number }} + body-includes: '' + comment-author: 'inngest-release-bot' + body: | # can be a single value or you can compose text with multi-line values + + A user has added the [prerelease/eslint-plugin](https://github.com/inngest/inngest-js/labels/prerelease%2Feslint-plugin) label, so this PR will be published to npm with the tag `pr-${{ github.event.pull_request.number }}`. It will be updated with the latest changes as you push commits to this PR. + + You can install this prerelease version with: + + ```sh + npm install @inngest/eslint-plugin@pr-${{ github.event.pull_request.number }} + ``` + + The last release was built and published from ${{ github.event.pull_request.head.sha }}. + edit-mode: replace + diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 038b4a2b1..001f68ddb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -35,7 +35,7 @@ jobs: - uses: changesets/action@v1 id: changesets with: - publish: pnpm run --if-present --recursive release + publish: pnpm run release:all title: ${{ github.ref_name == 'main' && 'Release @latest' || format('Release {0}', github.ref_name) }} env: GITHUB_TOKEN: ${{ secrets.CHANGESET_GITHUB_TOKEN }} diff --git a/package.json b/package.json index c1d9b2da8..ff5e41c8a 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,16 @@ { "scripts": { - "preinstall": "npx only-allow pnpm" + "preinstall": "npx only-allow pnpm", + "release:all": "pnpm run release:publish && pnpm run release:tag", + "release:publish": "pnpm run --if-present --recursive release", + "release:tag": "node scripts/release/tag.js", + "log": "pnpm run --if-present --recursive log" }, "devDependencies": { + "@actions/core": "^1.10.0", + "@actions/exec": "^1.1.1", "@changesets/changelog-github": "^0.4.8", - "@changesets/cli": "^2.26.2" + "@changesets/cli": "^2.26.2", + "cross-env": "^7.0.3" } } diff --git a/packages/eslint-plugin/.gitignore b/packages/eslint-plugin/.gitignore new file mode 100644 index 000000000..de4d1f007 --- /dev/null +++ b/packages/eslint-plugin/.gitignore @@ -0,0 +1,2 @@ +dist +node_modules diff --git a/packages/eslint-plugin/README.md b/packages/eslint-plugin/README.md new file mode 100644 index 000000000..26dea2ce4 --- /dev/null +++ b/packages/eslint-plugin/README.md @@ -0,0 +1,135 @@ +# `@inngest/eslint-plugin` + +> [!WARNING] +> This package is currently in alpha and is undocumented. Use with caution. + +An ESLint plugin and config for [`inngest`](/packages/inngest/). + +## Getting started + +Install the package using whichever package manager you'd prefer as a [dev dependency](https://docs.npmjs.com/cli/v10/configuring-npm/package-json#devdependencies). + +```sh +npm install -D @inngest/eslint-plugin +``` + +Add the plugin to your ESLint configuration file with the recommended config. + +```json +{ + "plugins": ["@inngest"], + "extends": ["plugin:@inngest/recommended"] +} +``` + +You can also manually configure each rule instead of using the `plugin:@inngest/recommend` config. + +```json +{ + "plugins": ["@inngest"], + "rules": { + "@inngest/await-inngest-send": "warn" + } +} +``` + +See below for a list of all rules available to configure. + +## Rules + +- [@inngest/await-inngest-send](#inngestawait-inngest-send) +- [@inngest/no-nested-steps](#inngestno-nested-steps) +- [@inngest/no-variable-mutation-in-step](#inngestno-variable-mutation-in-step) + +### @inngest/await-inngest-send + +You should use `await` or `return` before `inngest.send(). + +```json +"@inngest/await-inngest-send": "warn" // recommended +``` + +In serverless environments, it's common that runtimes are forcibly killed once a request handler has resolved, meaning any pending promises that are not performed before that handler ends may be cancelled. + +```ts +// ❌ Bad +inngest.send({ name: "some.event" }); +``` +```ts +// ✅ Good +await inngest.send({ name: "some.event" }); +``` + +#### When not to use it + +There are cases where you have deeper control of the runtime or when you'll safely `await` the send at a later time, in which case it's okay to turn this rule off. + +### @inngest/no-nested-steps + +Use of `step.*` within a `step.run()` function is not allowed. + +```json +"@inngest/no-nested-steps": "error" // recommended +``` + +Nesting `step.run()` calls is not supported and will result in an error at runtime. If your steps are nested, they're probably reliant on each other in some way. If this is the case, extract them into a separate function that runs them in sequence instead. + +```ts +// ❌ Bad +await step.run("a", async () => { + const someValue = "..."; + await step.run("b", () => { + return use(someValue); + }); +}); +``` +```ts +// ✅ Good +const aThenB = async () => { + const someValue = await step.run("a", async () => { + return "..."; + }); + + return step.run("b", async () => { + return use(someValue); + }); +}; + +await aThenB(); +``` + +### @inngest/no-variable-mutation-in-step + +Do not mutate variables inside `step.run()`, return the result instead. + +```json +"@inngest/no-variable-mutation-in-step": "error" // recommended +``` + +Inngest executes your function multiple times over the course of a single run, memoizing state as it goes. This means that code within calls to `step.run()` is not called on every execution. + +This can be confusing if you're using steps to update variables within the function's closure, like so: + +```ts +// ❌ Bad +// THIS IS WRONG! step.run only runs once and is skipped for future +// steps, so userID will not be defined. +let userId; + +// Do NOT do this! Instead, return data from step.run. +await step.run("get-user", async () => { + userId = await getRandomUserId(); +}); + +console.log(userId); // undefined +``` + +Instead, make sure that any variables needed for the overall function are _returned_ from calls to `step.run()`. + +```ts +// ✅ Good +// This is the right way to set variables within step.run :) +const userId = await step.run("get-user", () => getRandomUserId()); + +console.log(userId); // 123 +``` diff --git a/packages/eslint-plugin/jest.config.js b/packages/eslint-plugin/jest.config.js new file mode 100644 index 000000000..91b1b852a --- /dev/null +++ b/packages/eslint-plugin/jest.config.js @@ -0,0 +1,7 @@ +/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */ +module.exports = { + preset: "ts-jest", + testEnvironment: "node", + testMatch: ["/src/**/*.test.ts"], + roots: ["/src"], +}; diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json new file mode 100644 index 000000000..d5037ea40 --- /dev/null +++ b/packages/eslint-plugin/package.json @@ -0,0 +1,36 @@ +{ + "name": "@inngest/eslint-plugin", + "version": "0.0.0", + "description": "", + "main": "dist/index.js", + "publishConfig": { + "registry": "https://registry.npmjs.org" + }, + "scripts": { + "build": "tsc", + "test": "jest --silent --ci", + "release": "node ../../scripts/release/publish.js", + "log": "node ./test.js" + }, + "keywords": [ + "eslint", + "eslintplugin", + "inngest" + ], + "homepage": "https://github.com/inngest/inngest-js#readme", + "repository": { + "type": "git", + "url": "git+https://github.com/inngest/inngest-js.git" + }, + "author": "Jack Williams ", + "license": "ISC", + "dependencies": { + "@typescript-eslint/utils": "^6.11.0", + "typescript": "^5.2.2" + }, + "devDependencies": { + "@typescript-eslint/rule-tester": "^6.11.0", + "jest": "^29.3.1", + "ts-jest": "^29.1.0" + } +} diff --git a/packages/eslint-plugin/src/configs/index.ts b/packages/eslint-plugin/src/configs/index.ts new file mode 100644 index 000000000..8ee956b81 --- /dev/null +++ b/packages/eslint-plugin/src/configs/index.ts @@ -0,0 +1 @@ +export * from "./recommended"; diff --git a/packages/eslint-plugin/src/configs/recommended.ts b/packages/eslint-plugin/src/configs/recommended.ts new file mode 100644 index 000000000..d181629d7 --- /dev/null +++ b/packages/eslint-plugin/src/configs/recommended.ts @@ -0,0 +1,7 @@ +export const recommended = { + rules: { + "@inngest/await-inngest-send": "warn", + "@inngest/no-nested-steps": "error", + "@inngest/no-variable-mutation-in-step": "error", + }, +}; diff --git a/packages/eslint-plugin/src/index.ts b/packages/eslint-plugin/src/index.ts new file mode 100644 index 000000000..b2cdcb3f7 --- /dev/null +++ b/packages/eslint-plugin/src/index.ts @@ -0,0 +1,2 @@ +export * as configs from "./configs"; +export { rules } from "./rules"; diff --git a/packages/eslint-plugin/src/rules/await-inngest-send.test.ts b/packages/eslint-plugin/src/rules/await-inngest-send.test.ts new file mode 100644 index 000000000..56af0a259 --- /dev/null +++ b/packages/eslint-plugin/src/rules/await-inngest-send.test.ts @@ -0,0 +1,20 @@ +import { RuleTester } from "@typescript-eslint/rule-tester"; +import { awaitInngestSend } from "./await-inngest-send"; + +const ruleTester = new RuleTester({ + parser: "@typescript-eslint/parser", +}); + +ruleTester.run("my-rule", awaitInngestSend, { + valid: [ + 'await inngest.send({ name: "some.event" });', + 'return inngest.send({ name: "some.event" });', + 'void inngest.send({ name: "some.event" });', + ], + invalid: [ + { + code: 'inngest.send({ name: "some.event" });', + errors: [{ messageId: "await-inngest-send" }], + }, + ], +}); diff --git a/packages/eslint-plugin/src/rules/await-inngest-send.ts b/packages/eslint-plugin/src/rules/await-inngest-send.ts new file mode 100644 index 000000000..e189b36b7 --- /dev/null +++ b/packages/eslint-plugin/src/rules/await-inngest-send.ts @@ -0,0 +1,45 @@ +import { AST_NODE_TYPES, TSESLint } from "@typescript-eslint/utils"; + +// Thanks, Max from https://gowindmill.com/ +export const awaitInngestSend: TSESLint.RuleModule<"await-inngest-send"> = { + meta: { + type: "suggestion", + docs: { + description: + "enforce `await`, `return`, or `void` before `inngest.send()`", + recommended: "recommended", + }, + schema: [], // no options + messages: { + "await-inngest-send": + "You should use `await`, `return`, or `void` before `inngest.send().", + }, + }, + defaultOptions: [], + create(context) { + return { + CallExpression(node) { + if ( + node.callee.type === AST_NODE_TYPES.MemberExpression && + node.callee.object.type === AST_NODE_TYPES.Identifier && + node.callee.object.name === "inngest" && + node.callee.property.type === AST_NODE_TYPES.Identifier && + node.callee.property.name === "send" + ) { + const parent = node.parent; + if ( + parent.type !== AST_NODE_TYPES.AwaitExpression && + parent.type !== AST_NODE_TYPES.ReturnStatement && + (parent.type !== AST_NODE_TYPES.UnaryExpression || + parent.operator !== "void") + ) { + context.report({ + node, + messageId: "await-inngest-send", + }); + } + } + }, + }; + }, +}; diff --git a/packages/eslint-plugin/src/rules/index.ts b/packages/eslint-plugin/src/rules/index.ts new file mode 100644 index 000000000..0a7ebcff4 --- /dev/null +++ b/packages/eslint-plugin/src/rules/index.ts @@ -0,0 +1,10 @@ +import { TSESLint } from "@typescript-eslint/utils"; +import { awaitInngestSend } from "./await-inngest-send"; +import { noNestedSteps } from "./no-nested-steps"; +import { noVariableMutationInStep } from "./no-variable-mutation-in-step"; + +export const rules = { + "await-inngest-send": awaitInngestSend, + "no-nested-steps": noNestedSteps, + "no-variable-mutation-in-step": noVariableMutationInStep, +} satisfies Record>>; diff --git a/packages/eslint-plugin/src/rules/no-nested-steps.test.ts b/packages/eslint-plugin/src/rules/no-nested-steps.test.ts new file mode 100644 index 000000000..84e352b84 --- /dev/null +++ b/packages/eslint-plugin/src/rules/no-nested-steps.test.ts @@ -0,0 +1,24 @@ +import { RuleTester } from "@typescript-eslint/rule-tester"; +import { noNestedSteps } from "./no-nested-steps"; + +const ruleTester = new RuleTester({ + parser: "@typescript-eslint/parser", +}); + +ruleTester.run("my-rule", noNestedSteps, { + valid: [ + `const a = await step.run("a", () => "a"); + const b = await step.run("b", () => "b");`, + `await step.run("a", () => "a").then((a) => step.run("b", () => a + "b"));`, + ], + invalid: [ + { + code: `await step.run("a", async () => { + await step.run("b", async () => { + // ... + }); + });`, + errors: [{ messageId: "no-nested-steps" }], + }, + ], +}); diff --git a/packages/eslint-plugin/src/rules/no-nested-steps.ts b/packages/eslint-plugin/src/rules/no-nested-steps.ts new file mode 100644 index 000000000..fa0d66960 --- /dev/null +++ b/packages/eslint-plugin/src/rules/no-nested-steps.ts @@ -0,0 +1,56 @@ +import { AST_NODE_TYPES, TSESLint } from "@typescript-eslint/utils"; + +export const noNestedSteps: TSESLint.RuleModule<"no-nested-steps"> = { + meta: { + type: "problem", + docs: { + description: + "disallow use of any `step.*` within a `step.run()` function", + recommended: "recommended", + }, + schema: [], // no options + messages: { + "no-nested-steps": + "Use of `step.*` within a `step.run()` function is not allowed", + }, + }, + defaultOptions: [], + create(context) { + let stepRunDepth = 0; + + return { + CallExpression(node) { + if ( + node.callee.type === AST_NODE_TYPES.MemberExpression && + node.callee.object.type === AST_NODE_TYPES.Identifier && + node.callee.object.name === "step" + ) { + if ( + node.callee.property.type === AST_NODE_TYPES.Identifier && + node.callee.property.name === "run" + ) { + stepRunDepth += 1; + } + + if (stepRunDepth > 1) { + context.report({ + node, + messageId: "no-nested-steps", + }); + } + } + }, + "CallExpression:exit"(node) { + if ( + node.callee.type === AST_NODE_TYPES.MemberExpression && + node.callee.object.type === AST_NODE_TYPES.Identifier && + node.callee.object.name === "step" && + node.callee.property.type === AST_NODE_TYPES.Identifier && + node.callee.property.name === "run" + ) { + stepRunDepth -= 1; + } + }, + }; + }, +}; diff --git a/packages/eslint-plugin/src/rules/no-variable-mutation-in-step.test.ts b/packages/eslint-plugin/src/rules/no-variable-mutation-in-step.test.ts new file mode 100644 index 000000000..e18b5445f --- /dev/null +++ b/packages/eslint-plugin/src/rules/no-variable-mutation-in-step.test.ts @@ -0,0 +1,45 @@ +import { RuleTester } from "@typescript-eslint/rule-tester"; +import { noVariableMutationInStep } from "./no-variable-mutation-in-step"; + +const ruleTester = new RuleTester({ + parser: "@typescript-eslint/parser", +}); + +ruleTester.run("my-rule", noVariableMutationInStep, { + valid: [ + `let a = 1; + a = await step.run("add-one", () => a + 1);`, + ], + invalid: [ + { + name: "Returning UpdateExpression", + code: `let a = 1; + await step.run("add-one", () => a++);`, + errors: [{ messageId: "no-variable-mutation-in-step" }], + }, + { + name: "UpdateExpression ++", + code: `let a = 1; + await step.run("add-one", () => { + a++; + });`, + errors: [{ messageId: "no-variable-mutation-in-step" }], + }, + { + name: "AssignmentExpression +=", + code: `let a = 1; + await step.run("add-one", () => { + a += 1; + });`, + errors: [{ messageId: "no-variable-mutation-in-step" }], + }, + { + name: "AssignmentExpression +", + code: `let a = 1; + await step.run("add-one", () => { + a = a + 1; + });`, + errors: [{ messageId: "no-variable-mutation-in-step" }], + }, + ], +}); diff --git a/packages/eslint-plugin/src/rules/no-variable-mutation-in-step.ts b/packages/eslint-plugin/src/rules/no-variable-mutation-in-step.ts new file mode 100644 index 000000000..6e5a053e8 --- /dev/null +++ b/packages/eslint-plugin/src/rules/no-variable-mutation-in-step.ts @@ -0,0 +1,80 @@ +import { AST_NODE_TYPES, TSESLint } from "@typescript-eslint/utils"; + +export const noVariableMutationInStep: TSESLint.RuleModule<"no-variable-mutation-in-step"> = + { + meta: { + type: "problem", + docs: { + description: "disallow mutating variables inside `step.run()`", + recommended: "recommended", + }, + schema: [], // no options + messages: { + "no-variable-mutation-in-step": + "Do not mutate variables inside `step.run()`, return the result instead", + }, + }, + defaultOptions: [], + create(context) { + let inStepRun = false; + const declaredVariables = new Set(); + + return { + VariableDeclaration(node) { + if (!inStepRun) { + node.declarations.forEach((declaration) => { + if (declaration.id.type === AST_NODE_TYPES.Identifier) { + declaredVariables.add(declaration.id.name); + } + }); + } + }, + AssignmentExpression(node) { + if ( + inStepRun && + node.left.type === AST_NODE_TYPES.Identifier && + declaredVariables.has(node.left.name) + ) { + context.report({ + node, + messageId: "no-variable-mutation-in-step", + }); + } + }, + UpdateExpression(node) { + if ( + inStepRun && + node.argument.type === AST_NODE_TYPES.Identifier && + declaredVariables.has(node.argument.name) + ) { + context.report({ + node, + messageId: "no-variable-mutation-in-step", + }); + } + }, + CallExpression(node) { + if ( + node.callee.type === AST_NODE_TYPES.MemberExpression && + node.callee.object.type === AST_NODE_TYPES.Identifier && + node.callee.object.name === "step" && + node.callee.property.type === AST_NODE_TYPES.Identifier && + node.callee.property.name === "run" + ) { + inStepRun = true; + } + }, + "CallExpression:exit"(node) { + if ( + node.callee.type === AST_NODE_TYPES.MemberExpression && + node.callee.object.type === AST_NODE_TYPES.Identifier && + node.callee.object.name === "step" && + node.callee.property.type === AST_NODE_TYPES.Identifier && + node.callee.property.name === "run" + ) { + inStepRun = false; + } + }, + }; + }, + }; diff --git a/packages/eslint-plugin/tsconfig.json b/packages/eslint-plugin/tsconfig.json new file mode 100644 index 000000000..c5d90a0ee --- /dev/null +++ b/packages/eslint-plugin/tsconfig.json @@ -0,0 +1,109 @@ +{ + "compilerOptions": { + /* Visit https://aka.ms/tsconfig to read more about this file */ + + /* Projects */ + // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */ + // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ + // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */ + // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */ + // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ + // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ + + /* Language and Environment */ + "target": "es2016" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */, + // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ + // "jsx": "preserve", /* Specify what JSX code is generated. */ + // "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */ + // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ + // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ + // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ + // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */ + // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */ + // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ + // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ + // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ + + /* Modules */ + "module": "NodeNext" /* Specify what module code is generated. */, + "rootDir": "./src" /* Specify the root folder within your source files. */, + "moduleResolution": "NodeNext" /* Specify how TypeScript looks up a file from a given module specifier. */, + // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ + // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ + // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ + // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */ + // "types": [], /* Specify type package names to be included without being referenced in a source file. */ + // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ + // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ + // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */ + // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */ + // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */ + // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */ + // "resolveJsonModule": true, /* Enable importing .json files. */ + // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */ + // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ + + /* JavaScript Support */ + // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ + // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ + // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ + + /* Emit */ + // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ + // "declarationMap": true, /* Create sourcemaps for d.ts files. */ + // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ + // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ + // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ + // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ + "outDir": "./dist" /* Specify an output folder for all emitted files. */, + // "removeComments": true, /* Disable emitting comments. */ + // "noEmit": true, /* Disable emitting files from a compilation. */ + // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ + // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */ + // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ + // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ + // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */ + // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ + // "newLine": "crlf", /* Set the newline character for emitting files. */ + // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */ + // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */ + // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ + // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */ + // "declarationDir": "./", /* Specify the output directory for generated declaration files. */ + // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */ + + /* Interop Constraints */ + // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ + // "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */ + // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ + "esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */, + // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ + "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */, + + /* Type Checking */ + "strict": true /* Enable all strict type-checking options. */, + // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ + // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */ + // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ + // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */ + // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ + // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */ + // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */ + // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ + // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */ + // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */ + // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ + // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ + // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ + // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */ + // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ + // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */ + // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */ + // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */ + + /* Completeness */ + // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ + "skipLibCheck": true /* Skip type checking all .d.ts files. */ + } +} diff --git a/packages/inngest/package.json b/packages/inngest/package.json index 64f6cce93..76338b147 100644 --- a/packages/inngest/package.json +++ b/packages/inngest/package.json @@ -18,7 +18,7 @@ "clean": "rm -rf ./dist", "lint": "eslint .", "postversion": "pnpm run build && pnpm run build:copy", - "release": "pnpm run test && pnpm run build && pnpm run build:copy && node scripts/release.js", + "release": "pnpm run test && pnpm run build && pnpm run build:copy && cross-env DIST_DIR=dist node ../../scripts/release/publish.js", "api-extractor": "api-extractor", "dev": "pnpm install && concurrently --names Build,Lint --prefix-colors \"green.inverse,magenta.inverse\" --handle-input \"pnpm run dev:build\" \"pnpm run dev:lint\"", "dev:build": "nodemon -w src -e ts -i version.ts --delay 300ms -x 'pnpm run build && pnpm run build:check --local'", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 96eb8509e..490debe1a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8,12 +8,40 @@ importers: .: devDependencies: + '@actions/core': + specifier: ^1.10.0 + version: 1.10.0 + '@actions/exec': + specifier: ^1.1.1 + version: 1.1.1 '@changesets/changelog-github': specifier: ^0.4.8 version: 0.4.8 '@changesets/cli': specifier: ^2.26.2 version: 2.26.2 + cross-env: + specifier: ^7.0.3 + version: 7.0.3 + + packages/eslint-plugin: + dependencies: + '@typescript-eslint/utils': + specifier: ^6.11.0 + version: 6.11.0(eslint@8.36.0)(typescript@5.2.2) + typescript: + specifier: ^5.2.2 + version: 5.2.2 + devDependencies: + '@typescript-eslint/rule-tester': + specifier: ^6.11.0 + version: 6.11.0(@eslint/eslintrc@2.0.1)(eslint@8.36.0)(typescript@5.2.2) + jest: + specifier: ^29.3.1 + version: 29.5.0(@types/node@18.16.16) + ts-jest: + specifier: ^29.1.0 + version: 29.1.0(@babel/core@7.21.3)(jest@29.5.0)(typescript@5.2.2) packages/eslint-plugin-internal: dependencies: @@ -1255,6 +1283,15 @@ packages: eslint: 8.36.0 eslint-visitor-keys: 3.3.0 + /@eslint-community/eslint-utils@4.4.0(eslint@8.36.0): + resolution: {integrity: sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + peerDependencies: + eslint: ^6.0.0 || ^7.0.0 || >=8.0.0 + dependencies: + eslint: 8.36.0 + eslint-visitor-keys: 3.3.0 + /@eslint-community/regexpp@4.4.0: resolution: {integrity: sha512-A9983Q0LnDGdLPjxyXQ00sbV+K+O+ko2Dr+CZigbHWtX9pNfxlaBkMR8X1CztI73zuEyEBXTVjx7CE+/VSwDiQ==} engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0} @@ -2096,6 +2133,9 @@ packages: resolution: {integrity: sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==} dev: true + /@types/json-schema@7.0.15: + resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==} + /@types/json-stringify-safe@5.0.0: resolution: {integrity: sha512-UUA1sH0RSRROdInuDOA1yoRzbi5xVFD1RHCoOvNRPTNwR8zBkJ/84PZ6NhKVDtKp0FTeIccJCdQz1X2aJPr4uw==} dev: true @@ -2180,7 +2220,6 @@ packages: /@types/semver@7.5.0: resolution: {integrity: sha512-G8hZ6XJiHnuhQKR7ZmysCeJWE08o8T0AXtk5darsCaTVsYZhhgUrq53jizaR2FvsoeCwJhlmwTjkXBY5Pn/ZHw==} - dev: true /@types/serve-static@1.15.0: resolution: {integrity: sha512-z5xyF6uh8CbjAu9760KDKsH2FcDxZ2tFCsA4HIMWE6IkiYMXfVoa+4f9KX+FN0ZLsaMw1WNG2ETLA6N+/YA+cg==} @@ -2263,6 +2302,25 @@ packages: - supports-color dev: true + /@typescript-eslint/rule-tester@6.11.0(@eslint/eslintrc@2.0.1)(eslint@8.36.0)(typescript@5.2.2): + resolution: {integrity: sha512-4OQn7HuOnqtg2yDjBvshUs7NnQ4ySKjylh+dbmGojkau7wX8laUcIRUEu3qS2+LyQAmt1yoM7lKdGzJSG3TXyQ==} + engines: {node: ^16.0.0 || >=18.0.0} + peerDependencies: + '@eslint/eslintrc': '>=2' + eslint: '>=8' + dependencies: + '@eslint/eslintrc': 2.0.1 + '@typescript-eslint/typescript-estree': 6.11.0(typescript@5.2.2) + '@typescript-eslint/utils': 6.11.0(eslint@8.36.0)(typescript@5.2.2) + ajv: 6.12.6 + eslint: 8.36.0 + lodash.merge: 4.6.2 + semver: 7.5.4 + transitivePeerDependencies: + - supports-color + - typescript + dev: true + /@typescript-eslint/scope-manager@5.56.0: resolution: {integrity: sha512-jGYKyt+iBakD0SA5Ww8vFqGpoV2asSjwt60Gl6YcO8ksQ8s2HlUEyHBMSa38bdLopYqGf7EYQMUIGdT/Luw+sw==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -2271,6 +2329,13 @@ packages: '@typescript-eslint/visitor-keys': 5.56.0 dev: true + /@typescript-eslint/scope-manager@6.11.0: + resolution: {integrity: sha512-0A8KoVvIURG4uhxAdjSaxy8RdRE//HztaZdG8KiHLP8WOXSk0vlF7Pvogv+vlJA5Rnjj/wDcFENvDaHb+gKd1A==} + engines: {node: ^16.0.0 || >=18.0.0} + dependencies: + '@typescript-eslint/types': 6.11.0 + '@typescript-eslint/visitor-keys': 6.11.0 + /@typescript-eslint/type-utils@5.56.0(eslint@8.36.0)(typescript@5.2.2): resolution: {integrity: sha512-8WxgOgJjWRy6m4xg9KoSHPzBNZeQbGlQOH7l2QEhQID/+YseaFxg5J/DLwWSsi9Axj4e/cCiKx7PVzOq38tY4A==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -2296,6 +2361,10 @@ packages: engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true + /@typescript-eslint/types@6.11.0: + resolution: {integrity: sha512-ZbEzuD4DwEJxwPqhv3QULlRj8KYTAnNsXxmfuUXFCxZmO6CF2gM/y+ugBSAQhrqaJL3M+oe4owdWunaHM6beqA==} + engines: {node: ^16.0.0 || >=18.0.0} + /@typescript-eslint/typescript-estree@5.56.0(typescript@5.2.2): resolution: {integrity: sha512-41CH/GncsLXOJi0jb74SnC7jVPWeVJ0pxQj8bOjH1h2O26jXN3YHKDT1ejkVz5YeTEQPeLCCRY0U2r68tfNOcg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -2317,6 +2386,26 @@ packages: - supports-color dev: true + /@typescript-eslint/typescript-estree@6.11.0(typescript@5.2.2): + resolution: {integrity: sha512-Aezzv1o2tWJwvZhedzvD5Yv7+Lpu1by/U1LZ5gLc4tCx8jUmuSCMioPFRjliN/6SJIvY6HpTtJIWubKuYYYesQ==} + engines: {node: ^16.0.0 || >=18.0.0} + peerDependencies: + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + dependencies: + '@typescript-eslint/types': 6.11.0 + '@typescript-eslint/visitor-keys': 6.11.0 + debug: 4.3.4 + globby: 11.1.0 + is-glob: 4.0.3 + semver: 7.5.4 + ts-api-utils: 1.0.3(typescript@5.2.2) + typescript: 5.2.2 + transitivePeerDependencies: + - supports-color + /@typescript-eslint/utils@5.56.0(eslint@8.36.0)(typescript@5.2.2): resolution: {integrity: sha512-XhZDVdLnUJNtbzaJeDSCIYaM+Tgr59gZGbFuELgF7m0IY03PlciidS7UQNKLE0+WpUTn1GlycEr6Ivb/afjbhA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -2337,6 +2426,24 @@ packages: - typescript dev: true + /@typescript-eslint/utils@6.11.0(eslint@8.36.0)(typescript@5.2.2): + resolution: {integrity: sha512-p23ibf68fxoZy605dc0dQAEoUsoiNoP3MD9WQGiHLDuTSOuqoTsa4oAy+h3KDkTcxbbfOtUjb9h3Ta0gT4ug2g==} + engines: {node: ^16.0.0 || >=18.0.0} + peerDependencies: + eslint: ^7.0.0 || ^8.0.0 + dependencies: + '@eslint-community/eslint-utils': 4.4.0(eslint@8.36.0) + '@types/json-schema': 7.0.15 + '@types/semver': 7.5.0 + '@typescript-eslint/scope-manager': 6.11.0 + '@typescript-eslint/types': 6.11.0 + '@typescript-eslint/typescript-estree': 6.11.0(typescript@5.2.2) + eslint: 8.36.0 + semver: 7.5.4 + transitivePeerDependencies: + - supports-color + - typescript + /@typescript-eslint/visitor-keys@5.56.0: resolution: {integrity: sha512-1mFdED7u5bZpX6Xxf5N9U2c18sb+8EvU3tyOIj6LQZ5OOvnmj8BVeNNP603OFPm5KkS1a7IvCIcwrdHXaEMG/Q==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -2345,6 +2452,13 @@ packages: eslint-visitor-keys: 3.3.0 dev: true + /@typescript-eslint/visitor-keys@6.11.0: + resolution: {integrity: sha512-+SUN/W7WjBr05uRxPggJPSzyB8zUpaYo2hByKasWbqr3PM8AXfZt8UHdNpBS1v9SA62qnSSMF3380SwDqqprgQ==} + engines: {node: ^16.0.0 || >=18.0.0} + dependencies: + '@typescript-eslint/types': 6.11.0 + eslint-visitor-keys: 3.4.3 + /@vercel/build-utils@6.8.3: resolution: {integrity: sha512-C86OPuPAvG/pSr27DPKecmptkYYsgyhOKdHTLv9jI3Pv1yvru78k+JjrAyn7N+0ev75KNV0Prv4P3p76168ePw==} dev: true @@ -2559,7 +2673,6 @@ packages: /array-union@2.1.0: resolution: {integrity: sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==} engines: {node: '>=8'} - dev: true /array.prototype.flat@1.3.1: resolution: {integrity: sha512-roTU0KWIOmJ4DRLmwKd19Otg0/mT3qPNt0Qb3GWW8iObuZXxrjB/pzn0R3hqpRSWg4HCwqx+0vwOnWnvlOyeIA==} @@ -2750,7 +2863,6 @@ packages: engines: {node: '>=8'} dependencies: fill-range: 7.0.1 - dev: true /breakword@1.0.6: resolution: {integrity: sha512-yjxDAYyK/pBvws9H4xKYpLDpYKEH6CzrBPAuXq3x18I+c/2MkVtT3qAr7Oloi6Dss9qNhPVueAAVU1CSeNDIXw==} @@ -3103,6 +3215,14 @@ packages: resolution: {integrity: sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==} dev: true + /cross-env@7.0.3: + resolution: {integrity: sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==} + engines: {node: '>=10.14', npm: '>=6', yarn: '>=1'} + hasBin: true + dependencies: + cross-spawn: 7.0.3 + dev: true + /cross-fetch@4.0.0: resolution: {integrity: sha512-e4a5N8lVvuLgAWgnCrLr2PP0YyDOTHa9H/Rj54dirp61qXnNq46m82bRhNqIA5VccJtWBvPTFRV3TtvHUKPB1g==} dependencies: @@ -3314,7 +3434,6 @@ packages: engines: {node: '>=8'} dependencies: path-type: 4.0.0 - dev: true /doctrine@2.1.0: resolution: {integrity: sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==} @@ -3861,6 +3980,10 @@ packages: resolution: {integrity: sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + /eslint-visitor-keys@3.4.3: + resolution: {integrity: sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + /eslint@8.36.0: resolution: {integrity: sha512-Y956lmS7vDqomxlaaQAHVmeb4tNMp2FWIvU/RnU5BD3IKMD/MJPr76xdyr68P8tV1iNMvN2mRK0yy3c+UjL+bw==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -4085,7 +4208,6 @@ packages: glob-parent: 5.1.2 merge2: 1.4.1 micromatch: 4.0.5 - dev: true /fast-json-stable-stringify@2.1.0: resolution: {integrity: sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==} @@ -4172,7 +4294,6 @@ packages: engines: {node: '>=8'} dependencies: to-regex-range: 5.0.1 - dev: true /finalhandler@1.2.0: resolution: {integrity: sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==} @@ -4364,7 +4485,6 @@ packages: engines: {node: '>= 6'} dependencies: is-glob: 4.0.3 - dev: true /glob-parent@6.0.2: resolution: {integrity: sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==} @@ -4418,7 +4538,6 @@ packages: ignore: 5.2.4 merge2: 1.4.1 slash: 3.0.0 - dev: true /globrex@0.1.2: resolution: {integrity: sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg==} @@ -4763,7 +4882,6 @@ packages: /is-number@7.0.0: resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==} engines: {node: '>=0.12.0'} - dev: true /is-path-inside@3.0.3: resolution: {integrity: sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==} @@ -5581,7 +5699,6 @@ packages: engines: {node: '>=10'} dependencies: yallist: 4.0.0 - dev: true /magic-string@0.30.5: resolution: {integrity: sha512-7xlpfBaQaP/T6Vh8MO/EqXSW5En6INHEvEXQiuff7Gku0PWjU3uf6w/j9o7O+SpB5fOAkrI5HeoNgwjEO0pFsA==} @@ -5654,7 +5771,6 @@ packages: /merge2@1.4.1: resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==} engines: {node: '>= 8'} - dev: true /methods@1.1.2: resolution: {integrity: sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==} @@ -5667,7 +5783,6 @@ packages: dependencies: braces: 3.0.2 picomatch: 2.3.1 - dev: true /mime-db@1.52.0: resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==} @@ -6128,7 +6243,6 @@ packages: /path-type@4.0.0: resolution: {integrity: sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==} engines: {node: '>=8'} - dev: true /pathe@1.1.1: resolution: {integrity: sha512-d+RQGp0MAYTIaDBIMmOfMwz3E+LOZnxx1HZd5R18mmCZY0QBlK0LDZfPc8FW8Ed2DlvsuE6PRjroDY+wg4+j/Q==} @@ -6149,7 +6263,6 @@ packages: /picomatch@2.3.1: resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} engines: {node: '>=8.6'} - dev: true /pify@4.0.1: resolution: {integrity: sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==} @@ -6645,7 +6758,6 @@ packages: hasBin: true dependencies: lru-cache: 6.0.0 - dev: true /send@0.18.0: resolution: {integrity: sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==} @@ -6781,7 +6893,6 @@ packages: /slash@3.0.0: resolution: {integrity: sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==} engines: {node: '>=8'} - dev: true /smartwrap@2.0.2: resolution: {integrity: sha512-vCsKNQxb7PnCNd2wY1WClWifAc2lwqsG8OaswpJkVJsvMGcnEntdTCDajZCkk93Ay1U3t/9puJmb525Rg5MZBA==} @@ -7121,7 +7232,6 @@ packages: engines: {node: '>=8.0'} dependencies: is-number: 7.0.0 - dev: true /toidentifier@1.0.1: resolution: {integrity: sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==} @@ -7153,6 +7263,14 @@ packages: engines: {node: '>=8'} dev: true + /ts-api-utils@1.0.3(typescript@5.2.2): + resolution: {integrity: sha512-wNMeqtMz5NtwpT/UZGY5alT+VoKdSsOOP/kqHFcUW1P/VRhH2wJ48+DN2WwUliNbQ976ETwDL0Ifd2VVvgonvg==} + engines: {node: '>=16.13.0'} + peerDependencies: + typescript: '>=4.2.0' + dependencies: + typescript: 5.2.2 + /ts-jest@29.1.0(@babel/core@7.21.3)(jest@29.5.0)(typescript@5.2.2): resolution: {integrity: sha512-ZhNr7Z4PcYa+JjMl62ir+zPiNJfXJN6E8hSLnaUKhOgqcn8vb3e537cpkd0FuAfRK3sR1LSqM1MOhliXNgOFPA==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} @@ -7182,7 +7300,7 @@ packages: json5: 2.2.3 lodash.memoize: 4.1.2 make-error: 1.3.6 - semver: 7.3.8 + semver: 7.5.4 typescript: 5.2.2 yargs-parser: 21.1.1 dev: true @@ -7374,7 +7492,6 @@ packages: resolution: {integrity: sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==} engines: {node: '>=14.17'} hasBin: true - dev: true /ufo@1.3.0: resolution: {integrity: sha512-bRn3CsoojyNStCZe0BG0Mt4Nr/4KF+rhFlnNXybgqt5pXHNFRlqinSoQaTrGyzE4X8aHplSb+TorH+COin9Yxw==} @@ -7670,7 +7787,6 @@ packages: /yallist@4.0.0: resolution: {integrity: sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==} - dev: true /yargs-parser@18.1.3: resolution: {integrity: sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==} diff --git a/packages/inngest/scripts/prerelease.js b/scripts/release/prerelease.js similarity index 85% rename from packages/inngest/scripts/prerelease.js rename to scripts/release/prerelease.js index 635241df7..ab5e64b87 100644 --- a/packages/inngest/scripts/prerelease.js +++ b/scripts/release/prerelease.js @@ -9,10 +9,13 @@ if (!tag || !tag.startsWith("pr-")) { } console.log("tag:", tag); - -const rootDir = path.join(__dirname, ".."); -const distDir = path.join(rootDir, "dist"); -process.chdir(rootDir); +const packageRootDir = process.cwd(); +console.log("package root:", packageRootDir); +const distDir = process.env.DIST_DIR + ? path.join(packageRootDir, process.env.DIST_DIR) + : packageRootDir; +console.log("dist dir:", distDir); +process.chdir(packageRootDir); const exec = async (...args) => { const exitCode = await rawExec(...args); diff --git a/packages/inngest/scripts/release.js b/scripts/release/publish.js similarity index 80% rename from packages/inngest/scripts/release.js rename to scripts/release/publish.js index 051a29014..c27557559 100644 --- a/packages/inngest/scripts/release.js +++ b/scripts/release/publish.js @@ -7,35 +7,36 @@ if (branch !== "main" && !branch.endsWith(".x")) { `Stopping release from branch ${branch}; only "main" and "v*.x" branches are allowed to release` ); } - console.log("branch:", branch); -const { - version, - publishConfig: { registry }, -} = require("../package.json"); +const name = process.env.npm_package_name; +const version = process.env.npm_package_version; +const registry = process.env.npm_package_publishConfig_registry; console.log("version:", version); -const tag = `inngest@${version}`; +const tag = `${name}@${version}`; console.log("tag:", tag); const [, tagEnd = ""] = version.split("-"); const distTag = tagEnd.split(".")[0] || "latest"; console.log("distTag:", distTag); -const packageRootDir = path.join(__dirname, ".."); +console.log("process.cwd()", process.cwd()); + +const packageRootDir = process.cwd(); console.log("package root:", packageRootDir); const repoRootDir = path.join(packageRootDir, "..", ".."); console.log("repo root:", repoRootDir); -const distDir = path.join(packageRootDir, "dist"); +const distDir = process.env.DIST_DIR + ? path.join(packageRootDir, process.env.DIST_DIR) + : packageRootDir; console.log("dist dir:", distDir); process.chdir(packageRootDir); const exec = async (...args) => { - const exitCode = await rawExec(...args); - - if (exitCode !== 0) { - throw new Error(`Command exited with ${exitCode}`); - } + // const exitCode = await rawExec(...args); + // if (exitCode !== 0) { + // throw new Error(`Command exited with ${exitCode}`); + // } }; (async () => { @@ -114,11 +115,4 @@ const exec = async (...args) => { registry, ]); } - - // Tag and push the release commit - console.log('running "changeset tag" to tag the release commit'); - await exec("changeset", ["tag"], { cwd: repoRootDir }); - - console.log(`pushing git tags to origin/${branch}`); - await exec("git", ["push", "--follow-tags", "origin", branch]); })(); diff --git a/scripts/release/tag.js b/scripts/release/tag.js new file mode 100644 index 000000000..c47d6b136 --- /dev/null +++ b/scripts/release/tag.js @@ -0,0 +1,28 @@ +const path = require("path"); +const { exec: rawExec, getExecOutput } = require("@actions/exec"); + +const branch = process.env.BRANCH; +if (branch !== "main" && !branch.endsWith(".x")) { + throw new Error( + `Stopping release from branch ${branch}; only "main" and "v*.x" branches are allowed to release` + ); +} +console.log("branch:", branch); + +const exec = async (...args) => { + // const exitCode = await rawExec(...args); + // if (exitCode !== 0) { + // throw new Error(`Command exited with ${exitCode}`); + // } +}; + +const repoRootDir = path.join(__dirname, "..", ".."); + +(async () => { + // Tag and push the release commit + console.log('running "changeset tag" to tag the release commit'); + await exec("changeset", ["tag"], { cwd: repoRootDir }); + + console.log(`pushing git tags to origin/${branch}`); + await exec("git", ["push", "--follow-tags", "origin", branch]); +})(); From 6d1f52aeebd304603127a462a5e58b1ff6580701 Mon Sep 17 00:00:00 2001 From: Inngest Release Bot <126702797+inngest-release-bot@users.noreply.github.com> Date: Fri, 17 Nov 2023 19:00:41 +0000 Subject: [PATCH 3/7] Release @latest (#399) This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## @inngest/eslint-plugin@0.0.1 ### Patch Changes - [#377](https://github.com/inngest/inngest-js/pull/377) [`996e3b7`](https://github.com/inngest/inngest-js/commit/996e3b7296505714104d15e7d1eebaeee2445b21) Thanks [@jpwilliams](https://github.com/jpwilliams)! - Release `@inngest/eslint-plugin` package to help capture common gotchas ## inngest@3.6.1 ### Patch Changes - [#401](https://github.com/inngest/inngest-js/pull/401) [`c77f6d7`](https://github.com/inngest/inngest-js/commit/c77f6d7ec90442221cf9fe2d155b5aa9e540795e) Thanks [@tonyhb](https://github.com/tonyhb)! - Remove "Step already exists; automatically indexing" log - [#395](https://github.com/inngest/inngest-js/pull/395) [`aebc2c4`](https://github.com/inngest/inngest-js/commit/aebc2c4ba4ca50975437fbbcaed324ac0f34db0b) Thanks [@jpwilliams](https://github.com/jpwilliams)! - Fix `hasEventKey` in `GET` request always returning `true` Co-authored-by: github-actions[bot] --- .changeset/forty-experts-visit.md | 5 ----- .changeset/mighty-lamps-greet.md | 5 ----- .changeset/popular-buttons-retire.md | 5 ----- packages/eslint-plugin/CHANGELOG.md | 7 +++++++ packages/eslint-plugin/package.json | 2 +- packages/inngest/CHANGELOG.md | 8 ++++++++ packages/inngest/package.json | 2 +- 7 files changed, 17 insertions(+), 17 deletions(-) delete mode 100644 .changeset/forty-experts-visit.md delete mode 100644 .changeset/mighty-lamps-greet.md delete mode 100644 .changeset/popular-buttons-retire.md create mode 100644 packages/eslint-plugin/CHANGELOG.md diff --git a/.changeset/forty-experts-visit.md b/.changeset/forty-experts-visit.md deleted file mode 100644 index e68c16d10..000000000 --- a/.changeset/forty-experts-visit.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"inngest": patch ---- - -Remove "Step already exists; automatically indexing" log diff --git a/.changeset/mighty-lamps-greet.md b/.changeset/mighty-lamps-greet.md deleted file mode 100644 index be5caa552..000000000 --- a/.changeset/mighty-lamps-greet.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@inngest/eslint-plugin": patch ---- - -Release `@inngest/eslint-plugin` package to help capture common gotchas diff --git a/.changeset/popular-buttons-retire.md b/.changeset/popular-buttons-retire.md deleted file mode 100644 index 5299e8809..000000000 --- a/.changeset/popular-buttons-retire.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"inngest": patch ---- - -Fix `hasEventKey` in `GET` request always returning `true` diff --git a/packages/eslint-plugin/CHANGELOG.md b/packages/eslint-plugin/CHANGELOG.md new file mode 100644 index 000000000..e4435493d --- /dev/null +++ b/packages/eslint-plugin/CHANGELOG.md @@ -0,0 +1,7 @@ +# @inngest/eslint-plugin + +## 0.0.1 + +### Patch Changes + +- [#377](https://github.com/inngest/inngest-js/pull/377) [`996e3b7`](https://github.com/inngest/inngest-js/commit/996e3b7296505714104d15e7d1eebaeee2445b21) Thanks [@jpwilliams](https://github.com/jpwilliams)! - Release `@inngest/eslint-plugin` package to help capture common gotchas diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index d5037ea40..c23164546 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@inngest/eslint-plugin", - "version": "0.0.0", + "version": "0.0.1", "description": "", "main": "dist/index.js", "publishConfig": { diff --git a/packages/inngest/CHANGELOG.md b/packages/inngest/CHANGELOG.md index b8dbe4c07..08840358d 100644 --- a/packages/inngest/CHANGELOG.md +++ b/packages/inngest/CHANGELOG.md @@ -1,5 +1,13 @@ # inngest +## 3.6.1 + +### Patch Changes + +- [#401](https://github.com/inngest/inngest-js/pull/401) [`c77f6d7`](https://github.com/inngest/inngest-js/commit/c77f6d7ec90442221cf9fe2d155b5aa9e540795e) Thanks [@tonyhb](https://github.com/tonyhb)! - Remove "Step already exists; automatically indexing" log + +- [#395](https://github.com/inngest/inngest-js/pull/395) [`aebc2c4`](https://github.com/inngest/inngest-js/commit/aebc2c4ba4ca50975437fbbcaed324ac0f34db0b) Thanks [@jpwilliams](https://github.com/jpwilliams)! - Fix `hasEventKey` in `GET` request always returning `true` + ## 3.6.0 ### Minor Changes diff --git a/packages/inngest/package.json b/packages/inngest/package.json index 76338b147..fabb14c11 100644 --- a/packages/inngest/package.json +++ b/packages/inngest/package.json @@ -1,6 +1,6 @@ { "name": "inngest", - "version": "3.6.0", + "version": "3.6.1", "description": "Official SDK for Inngest.com", "main": "./index.js", "types": "./index.d.ts", From 58280a87b5c3964a1aab1ba3aa5b5572ebb912b8 Mon Sep 17 00:00:00 2001 From: Jack Williams <1736957+jpwilliams@users.noreply.github.com> Date: Fri, 17 Nov 2023 19:05:00 +0000 Subject: [PATCH 4/7] Enable release scripts --- scripts/release/publish.js | 8 ++++---- scripts/release/tag.js | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/scripts/release/publish.js b/scripts/release/publish.js index c27557559..27945f568 100644 --- a/scripts/release/publish.js +++ b/scripts/release/publish.js @@ -33,10 +33,10 @@ console.log("dist dir:", distDir); process.chdir(packageRootDir); const exec = async (...args) => { - // const exitCode = await rawExec(...args); - // if (exitCode !== 0) { - // throw new Error(`Command exited with ${exitCode}`); - // } + const exitCode = await rawExec(...args); + if (exitCode !== 0) { + throw new Error(`Command exited with ${exitCode}`); + } }; (async () => { diff --git a/scripts/release/tag.js b/scripts/release/tag.js index c47d6b136..44ba7bf5a 100644 --- a/scripts/release/tag.js +++ b/scripts/release/tag.js @@ -10,10 +10,10 @@ if (branch !== "main" && !branch.endsWith(".x")) { console.log("branch:", branch); const exec = async (...args) => { - // const exitCode = await rawExec(...args); - // if (exitCode !== 0) { - // throw new Error(`Command exited with ${exitCode}`); - // } + const exitCode = await rawExec(...args); + if (exitCode !== 0) { + throw new Error(`Command exited with ${exitCode}`); + } }; const repoRootDir = path.join(__dirname, "..", ".."); From 229ec8480d05188064d33284c2c783096c7fb9d7 Mon Sep 17 00:00:00 2001 From: Jack Williams Date: Fri, 17 Nov 2023 19:30:50 +0000 Subject: [PATCH 5/7] eslint-plugin: Make sure to publish dist files (#403) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary Fixes `@inngest/eslint-plugin` not publishing `dist` files during release 😅 ## Checklist - [ ] ~~Added a [docs PR](https://github.com/inngest/website) that references this PR~~ N/A - [ ] ~~Added unit/integration tests~~ N/A - [x] Added changesets if applicable --- .changeset/chilly-moles-share.md | 5 ++ .github/workflows/label-prs.yml | 24 ++++++ package.json | 1 + packages/eslint-plugin/package.json | 4 + pnpm-lock.yaml | 122 ++++++++++++++++++++++++++++ scripts/labelPrs.js | 77 ++++++++++++++++++ 6 files changed, 233 insertions(+) create mode 100644 .changeset/chilly-moles-share.md create mode 100644 .github/workflows/label-prs.yml create mode 100644 scripts/labelPrs.js diff --git a/.changeset/chilly-moles-share.md b/.changeset/chilly-moles-share.md new file mode 100644 index 000000000..fc86c2d1f --- /dev/null +++ b/.changeset/chilly-moles-share.md @@ -0,0 +1,5 @@ +--- +"@inngest/eslint-plugin": patch +--- + +Fix `dist` files not being published in package diff --git a/.github/workflows/label-prs.yml b/.github/workflows/label-prs.yml new file mode 100644 index 000000000..809974f1e --- /dev/null +++ b/.github/workflows/label-prs.yml @@ -0,0 +1,24 @@ +name: Label PR based on changed package + +on: + pull_request: + types: [opened, synchronize, reopened] + +jobs: + label: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - uses: ./.github/actions/setup-and-build + with: + install-dependencies: false + build: false + + - run: pnpm install + + - name: Label PR + run: node scripts/labelPrs.js + env: + GITHUB_TOKEN: ${{ secrets.CHANGESET_GITHUB_TOKEN }} # inngest-release-bot diff --git a/package.json b/package.json index ff5e41c8a..1a62b1890 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "devDependencies": { "@actions/core": "^1.10.0", "@actions/exec": "^1.1.1", + "@actions/github": "^6.0.0", "@changesets/changelog-github": "^0.4.8", "@changesets/cli": "^2.26.2", "cross-env": "^7.0.3" diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index c23164546..69a9a278a 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -8,10 +8,14 @@ }, "scripts": { "build": "tsc", + "postversion": "pnpm run build", "test": "jest --silent --ci", "release": "node ../../scripts/release/publish.js", "log": "node ./test.js" }, + "files": [ + "dist" + ], "keywords": [ "eslint", "eslintplugin", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 490debe1a..9867e8d87 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -14,6 +14,9 @@ importers: '@actions/exec': specifier: ^1.1.1 version: 1.1.1 + '@actions/github': + specifier: ^6.0.0 + version: 6.0.0 '@changesets/changelog-github': specifier: ^0.4.8 version: 0.4.8 @@ -242,12 +245,28 @@ packages: '@actions/io': 1.1.2 dev: true + /@actions/github@6.0.0: + resolution: {integrity: sha512-alScpSVnYmjNEXboZjarjukQEzgCRmjMv6Xj47fsdnqGS73bjJNDpiiXmp8jr0UZLdUB6d9jW63IcmddUP+l0g==} + dependencies: + '@actions/http-client': 2.2.0 + '@octokit/core': 5.0.1 + '@octokit/plugin-paginate-rest': 9.1.4(@octokit/core@5.0.1) + '@octokit/plugin-rest-endpoint-methods': 10.1.5(@octokit/core@5.0.1) + dev: true + /@actions/http-client@2.0.1: resolution: {integrity: sha512-PIXiMVtz6VvyaRsGY268qvj57hXQEpsYogYOu2nrQhlf+XCGmZstmuZBbAybUl1nQGnvS1k1eEsQ69ZoD7xlSw==} dependencies: tunnel: 0.0.6 dev: true + /@actions/http-client@2.2.0: + resolution: {integrity: sha512-q+epW0trjVUUHboliPb4UF9g2msf+w61b32tAkFEwL/IwP0DQWgbCMM0Hbe3e3WXSKz5VcUXbzJQgy8Hkra/Lg==} + dependencies: + tunnel: 0.0.6 + undici: 5.26.5 + dev: true + /@actions/io@1.1.2: resolution: {integrity: sha512-d+RwPlMp+2qmBfeLYPLXuSRykDIFEwdTA0MMxzS9kh4kvP1ftrc/9fzy6pX6qAjthdXruHQ6/6kjT/DNo5ALuw==} dev: true @@ -1816,6 +1835,92 @@ packages: '@nodelib/fs.scandir': 2.1.5 fastq: 1.15.0 + /@octokit/auth-token@4.0.0: + resolution: {integrity: sha512-tY/msAuJo6ARbK6SPIxZrPBms3xPbfwBrulZe0Wtr/DIY9lje2HeV1uoebShn6mx7SjCHif6EjMvoREj+gZ+SA==} + engines: {node: '>= 18'} + dev: true + + /@octokit/core@5.0.1: + resolution: {integrity: sha512-lyeeeZyESFo+ffI801SaBKmCfsvarO+dgV8/0gD8u1d87clbEdWsP5yC+dSj3zLhb2eIf5SJrn6vDz9AheETHw==} + engines: {node: '>= 18'} + dependencies: + '@octokit/auth-token': 4.0.0 + '@octokit/graphql': 7.0.2 + '@octokit/request': 8.1.5 + '@octokit/request-error': 5.0.1 + '@octokit/types': 12.3.0 + before-after-hook: 2.2.3 + universal-user-agent: 6.0.1 + dev: true + + /@octokit/endpoint@9.0.2: + resolution: {integrity: sha512-qhKW8YLIi+Kmc92FQUFGr++DYtkx/1fBv+Thua6baqnjnOsgBYJDCvWZR1YcINuHGOEQt416WOfE+A/oG60NBQ==} + engines: {node: '>= 18'} + dependencies: + '@octokit/types': 12.3.0 + is-plain-object: 5.0.0 + universal-user-agent: 6.0.1 + dev: true + + /@octokit/graphql@7.0.2: + resolution: {integrity: sha512-OJ2iGMtj5Tg3s6RaXH22cJcxXRi7Y3EBqbHTBRq+PQAqfaS8f/236fUrWhfSn8P4jovyzqucxme7/vWSSZBX2Q==} + engines: {node: '>= 18'} + dependencies: + '@octokit/request': 8.1.5 + '@octokit/types': 12.3.0 + universal-user-agent: 6.0.1 + dev: true + + /@octokit/openapi-types@19.0.2: + resolution: {integrity: sha512-8li32fUDUeml/ACRp/njCWTsk5t17cfTM1jp9n08pBrqs5cDFJubtjsSnuz56r5Tad6jdEPJld7LxNp9dNcyjQ==} + dev: true + + /@octokit/plugin-paginate-rest@9.1.4(@octokit/core@5.0.1): + resolution: {integrity: sha512-MvZx4WvfhBnt7PtH5XE7HORsO7bBk4er1FgRIUr1qJ89NR2I6bWjGyKsxk8z42FPQ34hFQm0Baanh4gzdZR4gQ==} + engines: {node: '>= 18'} + peerDependencies: + '@octokit/core': '>=5' + dependencies: + '@octokit/core': 5.0.1 + '@octokit/types': 12.3.0 + dev: true + + /@octokit/plugin-rest-endpoint-methods@10.1.5(@octokit/core@5.0.1): + resolution: {integrity: sha512-LMEdsMV8TTMjMTqVoqMzV95XTbv0ZsWxCxQtjAunQOCdwoDH4BVF/Ke5JMSZEVCWGI2kzxnUNbFnK/MxwV7NjA==} + engines: {node: '>= 18'} + peerDependencies: + '@octokit/core': '>=5' + dependencies: + '@octokit/core': 5.0.1 + '@octokit/types': 12.3.0 + dev: true + + /@octokit/request-error@5.0.1: + resolution: {integrity: sha512-X7pnyTMV7MgtGmiXBwmO6M5kIPrntOXdyKZLigNfQWSEQzVxR4a4vo49vJjTWX70mPndj8KhfT4Dx+2Ng3vnBQ==} + engines: {node: '>= 18'} + dependencies: + '@octokit/types': 12.3.0 + deprecation: 2.3.1 + once: 1.4.0 + dev: true + + /@octokit/request@8.1.5: + resolution: {integrity: sha512-zVKbNbX1xUluD9ZR4/tPs1yuYrK9xeh5fGZUXA6u04XGsTvomg0YO8/ZUC0FqAd49hAOEMFPAVUTh+2lBhOhLA==} + engines: {node: '>= 18'} + dependencies: + '@octokit/endpoint': 9.0.2 + '@octokit/request-error': 5.0.1 + '@octokit/types': 12.3.0 + is-plain-object: 5.0.0 + universal-user-agent: 6.0.1 + dev: true + + /@octokit/types@12.3.0: + resolution: {integrity: sha512-nJ8X2HRr234q3w/FcovDlA+ttUU4m1eJAourvfUUtwAWeqL8AsyRqfnLvVnYn3NFbUnsmzQCzLNdFerPwdmcDQ==} + dependencies: + '@octokit/openapi-types': 19.0.2 + dev: true + /@polka/url@1.0.0-next.23: resolution: {integrity: sha512-C16M+IYz0rgRhWZdCmK+h58JMv8vijAA61gmz2rspCSwKwzBebpdcsiUmwrtJRdphuY30i6BSLEOP8ppbNLyLg==} dev: true @@ -2812,6 +2917,10 @@ packages: /base64-js@1.5.1: resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==} + /before-after-hook@2.2.3: + resolution: {integrity: sha512-NzUnlZexiaH/46WDhANlyR2bXRopNg4F/zuSA3OpZnllCUgRaOF2znDioDWrmbNVsuZk6l9pMquQB38cfBZwkQ==} + dev: true + /better-path-resolve@1.0.0: resolution: {integrity: sha512-pbnl5XzGBdrFU/wT4jqmJVPn2B6UHPBOhzMQkY/SPUPB6QtUXtmBHBIwCbXJol93mOpGMnQyP/+BB19q04xj7g==} engines: {node: '>=4'} @@ -3386,6 +3495,10 @@ packages: engines: {node: '>= 0.8'} dev: true + /deprecation@2.3.1: + resolution: {integrity: sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ==} + dev: true + /dequal@2.0.3: resolution: {integrity: sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==} engines: {node: '>=6'} @@ -4892,6 +5005,11 @@ packages: engines: {node: '>=0.10.0'} dev: true + /is-plain-object@5.0.0: + resolution: {integrity: sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==} + engines: {node: '>=0.10.0'} + dev: true + /is-reference@3.0.2: resolution: {integrity: sha512-v3rht/LgVcsdZa3O2Nqs+NMowLOxeOm7Ay9+/ARQ2F+qEoANRcqrjAZKGN0v8ymUetZGgkp26LTnGT7H0Qo9Pg==} dependencies: @@ -7536,6 +7654,10 @@ packages: pathe: 1.1.1 dev: false + /universal-user-agent@6.0.1: + resolution: {integrity: sha512-yCzhz6FN2wU1NiiQRogkTQszlQSlpWaw8SvVegAc+bDxbzHgh1vX8uIe8OYyMH6DwH+sdTJsgMl36+mSMdRJIQ==} + dev: true + /universalify@0.1.2: resolution: {integrity: sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==} engines: {node: '>= 4.0.0'} diff --git a/scripts/labelPrs.js b/scripts/labelPrs.js new file mode 100644 index 000000000..ae19166be --- /dev/null +++ b/scripts/labelPrs.js @@ -0,0 +1,77 @@ +const github = require("@actions/github"); +const fs = require("fs").promises; +const path = require("path"); + +const token = process.env.GITHUB_TOKEN; +const octokit = github.getOctokit(token); + +const rootDir = path.resolve(__dirname, ".."); + +async function getChangedPackages() { + const prNumber = github.context.payload.pull_request.number; + const owner = github.context.repo.owner; + const repo = github.context.repo.repo; + + const { data: files } = await octokit.rest.pulls.listFiles({ + owner, + repo, + pull_number: prNumber, + }); + + const changedPackages = new Set(); + + for (const file of files) { + if (file.filename.startsWith("packages/")) { + const packageName = file.filename.split("/")[1]; + changedPackages.add(packageName); + } + } + + return changedPackages; +} + +async function getLabelsForPackages(packageNames) { + const labels = []; + + for (const packageName of packageNames) { + const packageJsonPath = path.resolve( + rootDir, + "packages", + packageName, + "package.json" + ); + const packageJson = JSON.parse(await fs.readFile(packageJsonPath, "utf8")); + const label = `📦 ${packageJson.name}`; + labels.push(label); + } + + return labels; +} + +async function labelPR(labels) { + if (labels.length === 0) return; + + const prNumber = github.context.payload.pull_request.number; + const owner = github.context.repo.owner; + const repo = github.context.repo.repo; + + await octokit.rest.issues.addLabels({ + owner, + repo, + issue_number: prNumber, + labels: labels, + }); +} + +async function run() { + const changedPackages = await getChangedPackages(); + if (changedPackages.size > 0) { + const labels = await getLabelsForPackages(changedPackages); + await labelPR(labels); + } +} + +run().catch((error) => { + console.error(error); + process.exit(1); +}); From 7c66b8a70ff09651f383dd83044d773611941df4 Mon Sep 17 00:00:00 2001 From: Inngest Release Bot <126702797+inngest-release-bot@users.noreply.github.com> Date: Fri, 17 Nov 2023 19:33:47 +0000 Subject: [PATCH 6/7] Release @latest (#404) This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## @inngest/eslint-plugin@0.0.2 ### Patch Changes - [#403](https://github.com/inngest/inngest-js/pull/403) [`229ec84`](https://github.com/inngest/inngest-js/commit/229ec8480d05188064d33284c2c783096c7fb9d7) Thanks [@jpwilliams](https://github.com/jpwilliams)! - Fix `dist` files not being published in package Co-authored-by: github-actions[bot] --- .changeset/chilly-moles-share.md | 5 ----- packages/eslint-plugin/CHANGELOG.md | 6 ++++++ packages/eslint-plugin/package.json | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) delete mode 100644 .changeset/chilly-moles-share.md diff --git a/.changeset/chilly-moles-share.md b/.changeset/chilly-moles-share.md deleted file mode 100644 index fc86c2d1f..000000000 --- a/.changeset/chilly-moles-share.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@inngest/eslint-plugin": patch ---- - -Fix `dist` files not being published in package diff --git a/packages/eslint-plugin/CHANGELOG.md b/packages/eslint-plugin/CHANGELOG.md index e4435493d..5298310c2 100644 --- a/packages/eslint-plugin/CHANGELOG.md +++ b/packages/eslint-plugin/CHANGELOG.md @@ -1,5 +1,11 @@ # @inngest/eslint-plugin +## 0.0.2 + +### Patch Changes + +- [#403](https://github.com/inngest/inngest-js/pull/403) [`229ec84`](https://github.com/inngest/inngest-js/commit/229ec8480d05188064d33284c2c783096c7fb9d7) Thanks [@jpwilliams](https://github.com/jpwilliams)! - Fix `dist` files not being published in package + ## 0.0.1 ### Patch Changes diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index 69a9a278a..6b7d090c2 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@inngest/eslint-plugin", - "version": "0.0.1", + "version": "0.0.2", "description": "", "main": "dist/index.js", "publishConfig": { From bb8dca63cb7231d87c9a3a109db554fe115b0e6b Mon Sep 17 00:00:00 2001 From: Jack Williams <1736957+jpwilliams@users.noreply.github.com> Date: Fri, 17 Nov 2023 19:40:32 +0000 Subject: [PATCH 7/7] Add directory information for published npm packages --- packages/eslint-plugin/package.json | 5 +++-- packages/inngest/package.json | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index 6b7d090c2..122cb076c 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -21,10 +21,11 @@ "eslintplugin", "inngest" ], - "homepage": "https://github.com/inngest/inngest-js#readme", + "homepage": "https://github.com/inngest/inngest-js/tree/main/packages/eslint-plugin#readme", "repository": { "type": "git", - "url": "git+https://github.com/inngest/inngest-js.git" + "url": "git+https://github.com/inngest/inngest-js.git", + "directory": "packages/eslint-plugin" }, "author": "Jack Williams ", "license": "ISC", diff --git a/packages/inngest/package.json b/packages/inngest/package.json index fabb14c11..6d74ed41a 100644 --- a/packages/inngest/package.json +++ b/packages/inngest/package.json @@ -114,7 +114,8 @@ "homepage": "https://github.com/inngest/inngest-js#readme", "repository": { "type": "git", - "url": "git+https://github.com/inngest/inngest-js.git" + "url": "git+https://github.com/inngest/inngest-js.git", + "directory": "packages/inngest" }, "author": "Dan Farrelly ", "license": "GPL-3.0",