diff --git a/.changeset/chatty-toes-retire.md b/.changeset/chatty-toes-retire.md new file mode 100644 index 0000000000000000000000000000000000000000..239fbe6974217eb448ddcdc22afe2eff966c6902 --- /dev/null +++ b/.changeset/chatty-toes-retire.md @@ -0,0 +1,5 @@ +--- +"create-llama": patch +--- + +Add windows e2e tests diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 428944d9cde10aacf66344166a9c7cb54cca9454..4d74c8bdcf7dd92d23d593da9e3e6661dcd9adb0 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -17,7 +17,7 @@ jobs: matrix: node-version: [18, 20] python-version: ["3.11"] - os: [macos-latest] #, windows-latest] + os: [macos-latest, windows-latest] defaults: run: shell: bash @@ -47,7 +47,7 @@ jobs: run: pnpm run build working-directory: . - name: Install - run: pnpm run install-local + run: pnpm run pack-install working-directory: . - name: Run Playwright tests run: pnpm run e2e diff --git a/.gitignore b/.gitignore index a2cade9e4079f140e83002a5e4382f39e49c2b41..6c50932b7f7f33d3dcfefb68077863ae5fccc2a7 100644 --- a/.gitignore +++ b/.gitignore @@ -45,3 +45,6 @@ e2e/cache # intellij **/.idea + +# build artifacts +create-llama-*.tgz diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 55f2c30bcb23edfee1fa0cd173f84dba6cce8838..2b82150df15e5e0e5b2ceff10a8c1e0c0f63fd7c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -32,10 +32,10 @@ To install it, call: pnpm exec playwright install --with-deps ``` -Then you can first install the `create-llama` command locally: +Then you can create a global `create-llama` command (used by the e2e tests) that is linked to your local dev environment (if you update the build, you don't need to re-link): ``` -pnpm run install-local +pnpm link --global ``` And then finally run the tests: diff --git a/index.ts b/index.ts index f14c79270787fcb4f30d8eef2921ced730bf5d61..15f453ed9567c12067a40b5b6c27e82c1e4e8a6a 100644 --- a/index.ts +++ b/index.ts @@ -1,4 +1,3 @@ -#!/usr/bin/env node /* eslint-disable import/no-extraneous-dependencies */ import { execSync } from "child_process"; import Commander from "commander"; diff --git a/package.json b/package.json index bca0a4f9ccb538f8ad16ae97ddfdb8d1354f3f36..a2daa6e55ecf349c503407bfba32a0db2490ce9e 100644 --- a/package.json +++ b/package.json @@ -24,15 +24,15 @@ "format": "prettier --ignore-unknown --cache --check .", "format:write": "prettier --ignore-unknown --write .", "dev": "ncc build ./index.ts -w -o dist/", - "build": "npm run clean && ncc build ./index.ts -o ./dist/ --minify --no-cache --no-source-map-register", + "build": "bash ./scripts/build.sh", "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", "release-snapshot": "pnpm run build && changeset publish --tag snapshot", - "new-snapshot": "pnpm run build && changeset version --snapshot" + "new-snapshot": "pnpm run build && changeset version --snapshot", + "pack-install": "bash ./scripts/pack.sh" }, "devDependencies": { "@playwright/test": "^1.41.1", diff --git a/scripts/build.sh b/scripts/build.sh new file mode 100644 index 0000000000000000000000000000000000000000..d11d45485753cba6444a2744f4282b250f7066b5 --- /dev/null +++ b/scripts/build.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +# build dist/index.js file +npm run clean && ncc build ./index.ts -o ./dist/ --minify --no-cache --no-source-map-register + +# add shebang to the top of dist/index.js (space after shebang is to fix windows issue) +echo '#!/usr/bin/env node ' | cat - dist/index.js > temp && mv temp dist/index.js \ No newline at end of file diff --git a/scripts/pack.sh b/scripts/pack.sh new file mode 100644 index 0000000000000000000000000000000000000000..3009ef80994d1449b434f25d0bf977ca3a0a0fae --- /dev/null +++ b/scripts/pack.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +pnpm pack && npm install -g $(pwd)/$(ls ./*.tgz | head -1) \ No newline at end of file