diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 2e485da9b72d8031f133d29b6f1c5a54b35caa4b..c4a95b6cf661845088840e9d0e0a03e320cccb3b 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 0000000000000000000000000000000000000000..65d334b4550a5db397221aeca254929bda9cc052 --- /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 b9b9ec0dba52bd18a11a893e740df2a729182b57..6322c54419a4d586c35945213e692bf2f92571c7 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 15d152d4306af7809d9e3ad6282a7733085e202f..6e41501a8625590178f5772225a1a32ef979b526 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" },