From cf7806b60476575d2c2f29d5b1f41f3c85a1487d Mon Sep 17 00:00:00 2001 From: Marcus Schiesser <mail@marcusschiesser.de> Date: Tue, 19 Mar 2024 10:50:38 +0700 Subject: [PATCH] docs: add contributing.md --- .github/workflows/e2e.yml | 9 +++----- CONTRIBUTING.md | 47 +++++++++++++++++++++++++++++++++++++++ e2e/utils.ts | 12 +--------- package.json | 1 + 4 files changed, 52 insertions(+), 17 deletions(-) create mode 100644 CONTRIBUTING.md diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 2e485da9..c4a95b6c 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -46,14 +46,11 @@ jobs: - name: Build create-llama run: pnpm run build working-directory: . - - name: Pack - run: pnpm pack --pack-destination ./output - working-directory: . - - name: Extract Pack - run: tar -xvzf ./output/*.tgz -C ./output + - name: Install + run: pnpm run install-local working-directory: . - name: Run Playwright tests - run: pnpm exec playwright test + run: pnpm run e2e env: OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} working-directory: . diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..65d334b4 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,47 @@ +# Contributing + +## Getting Started + +Install NodeJS. Preferably v18 using nvm or n. + +Inside the `create-llama` directory: + +``` +npm i -g pnpm ts-node +pnpm install +``` + +Note: we use pnpm in this repo, which has a lot of the same functionality and CLI options as npm but it does do some things better, like caching. + +### Building + +When we publish to NPM we will have a [ncc](https://github.com/vercel/ncc) compiled version of the tool. To run the build command, run + +``` +pnpm run build +``` + +### Test cases + +We are using a set of e2e tests to ensure that the tool works as expected. + +We're using [playwright](https://playwright.dev/) to run the tests. +To install it, call: + +``` +pnpm exec playwright install --with-deps +``` + +Then you can first install the `create-llama` command locally: + +``` +pnpm run install-local +``` + +And then finally run the tests: + +``` +pnpm run e2e +``` + +To write new test cases write them in [e2e](/e2e) diff --git a/e2e/utils.ts b/e2e/utils.ts index b9b9ec0d..6322c544 100644 --- a/e2e/utils.ts +++ b/e2e/utils.ts @@ -75,15 +75,6 @@ export async function runCreateLlama( externalPort: number, postInstallAction: TemplatePostInstallAction, ): Promise<CreateLlamaResult> { - const createLlama = path.join( - __dirname, - "..", - "output", - "package", - "dist", - "index.js", - ); - const name = [ templateType, templateFramework, @@ -92,8 +83,7 @@ export async function runCreateLlama( appType, ].join("-"); const command = [ - "node", - createLlama, + "create-llama", name, "--template", templateType, diff --git a/package.json b/package.json index 15d152d4..6e41501a 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,7 @@ "lint": "eslint . --ignore-pattern dist --ignore-pattern e2e/cache", "e2e": "playwright test", "prepare": "husky", + "install-local": "pnpm link --global", "release": "pnpm run build && changeset publish", "new-version": "pnpm run build && changeset version" }, -- GitLab