From 6db1c83396e43958a24744925190b45a3209fc46 Mon Sep 17 00:00:00 2001 From: Jacob Paris Date: Tue, 17 Dec 2024 14:15:06 +0700 Subject: [PATCH 1/7] dev: add pkg-pr-new --- .github/workflows/preview.yml | 40 +++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .github/workflows/preview.yml diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml new file mode 100644 index 0000000..3db3255 --- /dev/null +++ b/.github/workflows/preview.yml @@ -0,0 +1,40 @@ +name: Preview +on: + pull_request_review: + types: [submitted] + +jobs: + check: + # First, trigger a permissions check on the user approving the pull request. + if: github.event.review.state == 'approved' + runs-on: ubuntu-latest + outputs: + has-permissions: ${{ steps.checkPermissions.outputs.require-result }} + steps: + - name: Check permissions + id: checkPermissions + uses: actions-cool/check-user-permission@v2 + with: + # In this example, the approver must have the write access + # to the repository to trigger the package preview. + require: "write" + + publish: + needs: check + # Publish the preview package only if the permissions check passed. + if: needs.check.outputs.has-permissions == 'true' + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - run: corepack enable + - uses: actions/setup-node@v4 + with: + node-version: 20 + cache: "pnpm" + + - name: Install dependencies + run: pnpm install + + - run: pnpx pkg-pr-new publish From 81075c68ca2d46b1942ee4c65ff26a595471b794 Mon Sep 17 00:00:00 2001 From: jacobparis Date: Tue, 17 Dec 2024 07:23:05 +0000 Subject: [PATCH 2/7] [ci] format --- packages/core/src/prompts/prompt.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/core/src/prompts/prompt.ts b/packages/core/src/prompts/prompt.ts index 9e4e63c..5b75c31 100644 --- a/packages/core/src/prompts/prompt.ts +++ b/packages/core/src/prompts/prompt.ts @@ -115,10 +115,14 @@ export default class Prompt { public prompt() { return new Promise((resolve, reject) => { if (this.abortController) { - this.abortController.addEventListener('abort', () => { - this.state = 'cancel'; - this.close(); - }, { once: true }); + this.abortController.addEventListener( + 'abort', + () => { + this.state = 'cancel'; + this.close(); + }, + { once: true } + ); } const sink = new WriteStream(0); From 2635642c3eca849aa0430efef95c4635c02a42a9 Mon Sep 17 00:00:00 2001 From: Jacob Paris Date: Tue, 17 Dec 2024 14:23:35 +0700 Subject: [PATCH 3/7] fix: add comment to trigger deploy --- packages/core/src/prompts/prompt.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/core/src/prompts/prompt.ts b/packages/core/src/prompts/prompt.ts index 9e4e63c..28ecfe6 100644 --- a/packages/core/src/prompts/prompt.ts +++ b/packages/core/src/prompts/prompt.ts @@ -9,6 +9,7 @@ import { ALIASES, CANCEL_SYMBOL, KEYS, diffLines, hasAliasKey, setRawMode } from import type { ClackEvents, ClackState, InferSetType } from '../types'; +// trigger build export interface PromptOptions { render(this: Omit): string | undefined; placeholder?: string; From 51c991d07569ec737bd60e6c0671c583497de851 Mon Sep 17 00:00:00 2001 From: Jacob Paris Date: Tue, 17 Dec 2024 14:26:40 +0700 Subject: [PATCH 4/7] fix: on pr --- .github/workflows/preview.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml index 3db3255..44b7764 100644 --- a/.github/workflows/preview.yml +++ b/.github/workflows/preview.yml @@ -1,5 +1,6 @@ name: Preview on: + pull_request: pull_request_review: types: [submitted] From 26a4e457a8925deaef250d3a3d40fad4e8520b93 Mon Sep 17 00:00:00 2001 From: Jacob Paris Date: Tue, 17 Dec 2024 14:27:58 +0700 Subject: [PATCH 5/7] fix: remove permissions checks I am the boss --- .github/workflows/preview.yml | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml index 44b7764..a6ac817 100644 --- a/.github/workflows/preview.yml +++ b/.github/workflows/preview.yml @@ -5,25 +5,8 @@ on: types: [submitted] jobs: - check: - # First, trigger a permissions check on the user approving the pull request. - if: github.event.review.state == 'approved' - runs-on: ubuntu-latest - outputs: - has-permissions: ${{ steps.checkPermissions.outputs.require-result }} - steps: - - name: Check permissions - id: checkPermissions - uses: actions-cool/check-user-permission@v2 - with: - # In this example, the approver must have the write access - # to the repository to trigger the package preview. - require: "write" publish: - needs: check - # Publish the preview package only if the permissions check passed. - if: needs.check.outputs.has-permissions == 'true' runs-on: ubuntu-latest steps: - name: Checkout code From 05cbdc571a28fda4f7fdf4d94678fa67841c96f5 Mon Sep 17 00:00:00 2001 From: Jacob Paris Date: Tue, 17 Dec 2024 14:53:21 +0700 Subject: [PATCH 6/7] fix: use real package --- .github/workflows/preview.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml index a6ac817..4623ae5 100644 --- a/.github/workflows/preview.yml +++ b/.github/workflows/preview.yml @@ -21,4 +21,4 @@ jobs: - name: Install dependencies run: pnpm install - - run: pnpx pkg-pr-new publish + - run: pnpx pkg-pr-new publish --package ./packages/core From 97de1cd069f09a0ba32a6dc44a6b71c68c3c11ab Mon Sep 17 00:00:00 2001 From: Jacob Paris Date: Tue, 17 Dec 2024 14:57:43 +0700 Subject: [PATCH 7/7] read the docs, jacob --- .github/workflows/preview.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml index 4623ae5..9bab9d0 100644 --- a/.github/workflows/preview.yml +++ b/.github/workflows/preview.yml @@ -21,4 +21,4 @@ jobs: - name: Install dependencies run: pnpm install - - run: pnpx pkg-pr-new publish --package ./packages/core + - run: pnpx pkg-pr-new publish './packages/*'