Skip to content

Commit

Permalink
Merge pull request #200 from siguici/main
Browse files Browse the repository at this point in the history
πŸ’š Test the CLI on all environments
  • Loading branch information
siguici authored Dec 30, 2024
2 parents 3d3a55b + 09835f4 commit c7f38aa
Show file tree
Hide file tree
Showing 7 changed files with 243 additions and 725 deletions.
82 changes: 82 additions & 0 deletions .github/workflows/cli.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: CLI

on:
push:
branches:
- main
pull_request:

defaults:
run:
working-directory: ./libs/create-qwikdev-astro

jobs:
test:
name: πŸ§ͺ Test the CLI on ${{ matrix.runtime }} under ${{ matrix.os }} using ${{ matrix.package_manager }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runtime: [node, deno, bun]
package_manager: [npm, pnpm]
exclude:
- runtime: deno
package_manager: pnpm
- runtime: bun
package_manager: pnpm
steps:
- name: 🚚 Checkout repository
uses: actions/checkout@v3

- name: Set up Node.js
if: matrix.runtime == 'node'
uses: actions/setup-node@v3
with:
node-version: 22

- name: Set up Deno
if: matrix.runtime == 'deno'
uses: denoland/setup-deno@v2
with:
deno-version: v2.x

- name: Set up Bun
if: matrix.runtime == 'bun'
uses: oven-sh/setup-bun@v2
with:
bun-version: latest

- name: ⚑️Install dependencies
run: |
if [[ "${{ matrix.runtime }}" == "node" ]]; then
corepack enable
corepack prepare ${{ matrix.package_manager }}@latest --activate
${{ matrix.package_manager }} install
elif [[ "${{ matrix.runtime }}" == "deno" ]]; then
deno install
elif [[ "${{ matrix.runtime }}" == "bun" ]]; then
bun install
fi
shell: bash

- name: πŸ“¦οΈ Build the package
run: |
if [[ "${{ matrix.runtime }}" == "node" ]]; then
${{ matrix.package_manager }} run build
elif [[ "${{ matrix.runtime }}" == "deno" ]]; then
deno task build
elif [[ "${{ matrix.runtime }}" == "bun" ]]; then
bun run build
fi
shell: bash

- name: βœ… Test CLI
run: |
if [[ "${{ matrix.runtime }}" == "node" ]]; then
${{ matrix.package_manager }} run test
elif [[ "${{ matrix.runtime }}" == "deno" ]]; then
deno task test
elif [[ "${{ matrix.runtime }}" == "bun" ]]; then
bun run test
fi
shell: bash
10 changes: 4 additions & 6 deletions libs/create-qwikdev-astro/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
"description": "Interactive CLI for create @QwikDev/astro projects.",
"scripts": {
"check": "tsc --noEmit",
"build": "pnpm check && tsup-node --env.NODE_ENV production",
"build": "tsup-node --env.NODE_ENV production",
"prod": "pnpm check && pnpm build",
"start": "tsup-node --env.NODE_ENV development --watch",
"test": "NODE_ENV=test node --loader tsm --enable-source-maps bin/test.ts"
"test": "node --loader tsm --enable-source-maps bin/test.ts"
},
"contributors": [
{
Expand Down Expand Up @@ -86,10 +87,7 @@
},
"./package.json": "./package.json"
},
"files": [
"dist",
"stubs"
],
"files": ["dist", "stubs"],
"bin": "./dist/cli.js",
"keywords": [
"astro-integration",
Expand Down
3 changes: 2 additions & 1 deletion libs/create-qwikdev-astro/tests/cli.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ process.env.CI = "1";
const integration = "@qwikdev/astro";
const root = "labs";
const project = "test-app";
const pm = getPackageManager();

const setup = () => {
ensureDirSync(root);
Expand Down Expand Up @@ -162,7 +163,7 @@ async function testRun(
const { assert } = context;
const destination = `${root}/${project}`;

const result = await run(["pnpm", "create", `${destination}`, ...args]);
const result = await run([pm, "create", `${destination}`, ...args]);
assert.equal(result, 0);

testProject(destination, context, options);
Expand Down
7 changes: 1 addition & 6 deletions libs/qwikdev-astro/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,7 @@
"./utils": "./src/utils.ts",
"./q-astro-manifest.json": "./q-astro-manifest.json"
},
"files": [
"src",
"src/index.ts",
"server.ts",
"env.d.ts"
],
"files": ["src", "src/index.ts", "server.ts", "env.d.ts"],
"keywords": [
"astro-integration",
"astro-component",
Expand Down
2 changes: 1 addition & 1 deletion libs/qwikdev-astro/q-astro-manifest.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"manifestHash":"2kpemp","symbols":{"s_0DHRa0FqCj4":{"origin":"../../../libs/qwikdev-astro/src/root.tsx","displayName":"root.tsx_root_component","canonicalFilename":"root.tsx_root_component_0DHRa0FqCj4","hash":"0DHRa0FqCj4","ctxKind":"function","ctxName":"component$","captures":false,"loc":[81,136]},"s_qY02pQHKSts":{"origin":"components/qwik/counter.tsx","displayName":"counter.tsx_Counter_component","canonicalFilename":"counter.tsx_Counter_component_qY02pQHKSts","hash":"qY02pQHKSts","ctxKind":"function","ctxName":"component$","captures":false,"loc":[121,322]},"s_WDqUvWziK5k":{"origin":"components/qwik/counter.tsx","displayName":"counter.tsx_Counter_component_Fragment_button_onClick","canonicalFilename":"counter.tsx_Counter_component_Fragment_button_onClick_WDqUvWziK5k","hash":"WDqUvWziK5k","ctxKind":"eventHandler","ctxName":"onClick$","captures":true,"parent":"s_qY02pQHKSts","loc":[235,256]}},"mapping":{"s_0DHRa0FqCj4":"q-CXpka_yH.js","s_qY02pQHKSts":"q-4LT-psvh.js","s_WDqUvWziK5k":"q-Cf-M9i3S.js"},"bundles":{"q-4LT-psvh.js":{"size":88,"imports":["q-Cf-M9i3S.js","q-CXpka_yH.js"],"symbols":["s_qY02pQHKSts"]},"q-Cf-M9i3S.js":{"size":1635,"imports":["q-CXpka_yH.js"],"origins":["src/components/qwik/counter.tsx_Counter_component_Fragment_button_onClick_WDqUvWziK5k.js","src/components/qwik/counter.tsx_Counter_component_qY02pQHKSts.js"],"symbols":["s_WDqUvWziK5k"]},"q-CXpka_yH.js":{"size":61657,"origins":["../../libs/qwikdev-astro/src/root.tsx_root_component_0DHRa0FqCj4.js","../../node_modules/.pnpm/@[email protected][email protected]_@[email protected][email protected][email protected]_/node_modules/@builder.io/qwik/dist/core.prod.mjs","@builder.io/qwik/build"],"symbols":["s_0DHRa0FqCj4"]},"q-FfniopH8.js":{"size":184,"imports":["q-Cf-M9i3S.js","q-CXpka_yH.js"],"dynamicImports":["q-CXpka_yH.js"],"origins":["../../libs/qwikdev-astro/src/root.tsx"]},"q-fzuY5JUw.js":{"size":171,"imports":["q-Cf-M9i3S.js","q-CXpka_yH.js"],"dynamicImports":["q-4LT-psvh.js"],"origins":["src/components/qwik/counter.tsx"]}},"injections":[],"version":"1","options":{"target":"client","buildMode":"production","entryStrategy":{"type":"smart"}},"platform":{"qwik":"1.12.0","vite":"","rollup":"4.29.1","env":"node","os":"darwin","node":"22.12.0"}}
{"manifestHash":"uvwr9a","symbols":{"s_Jkq4JnSu3vc":{"origin":"components/qwik/counter.tsx","displayName":"counter.tsx_Counter_component","canonicalFilename":"counter.tsx_Counter_component_Jkq4JnSu3vc","hash":"Jkq4JnSu3vc","ctxKind":"function","ctxName":"component$","captures":false,"loc":[121,301]},"s_o0dE1oWgGK4":{"origin":"../../../libs/qwikdev-astro/src/root.tsx","displayName":"root.tsx_root_component","canonicalFilename":"root.tsx_root_component_o0dE1oWgGK4","hash":"o0dE1oWgGK4","ctxKind":"function","ctxName":"component$","captures":false,"loc":[81,136]},"s_WTj7Z5OCKjk":{"origin":"components/qwik/counter.tsx","displayName":"counter.tsx_Counter_component_button_onClick","canonicalFilename":"counter.tsx_Counter_component_button_onClick_WTj7Z5OCKjk","hash":"WTj7Z5OCKjk","ctxKind":"eventHandler","ctxName":"onClick$","captures":true,"parent":"s_Jkq4JnSu3vc","loc":[226,247]}},"mapping":{"s_Jkq4JnSu3vc":"q-gxfui5gO.js","s_o0dE1oWgGK4":"q-BVmDhJRY.js","s_WTj7Z5OCKjk":"q-D0icCluT.js"},"bundles":{"q-BVmDhJRY.js":{"size":61649,"origins":["../../libs/qwikdev-astro/src/root.tsx_root_component_o0dE1oWgGK4.js","../../node_modules/.pnpm/@[email protected][email protected]_@[email protected][email protected][email protected]_/node_modules/@builder.io/qwik/dist/core.prod.mjs","@builder.io/qwik/build"],"symbols":["s_o0dE1oWgGK4"]},"q-C4FN6EFX.js":{"size":184,"imports":["q-BVmDhJRY.js","q-D0icCluT.js"],"dynamicImports":["q-BVmDhJRY.js"],"origins":["../../libs/qwikdev-astro/src/root.tsx"]},"q-CyizIga3.js":{"size":171,"imports":["q-BVmDhJRY.js","q-D0icCluT.js"],"dynamicImports":["q-gxfui5gO.js"],"origins":["src/components/qwik/counter.tsx"]},"q-D0icCluT.js":{"size":1610,"imports":["q-BVmDhJRY.js"],"origins":["src/components/qwik/counter.tsx_Counter_component_Jkq4JnSu3vc.js","src/components/qwik/counter.tsx_Counter_component_button_onClick_WTj7Z5OCKjk.js"],"symbols":["s_WTj7Z5OCKjk"]},"q-gxfui5gO.js":{"size":88,"imports":["q-BVmDhJRY.js","q-D0icCluT.js"],"symbols":["s_Jkq4JnSu3vc"]}},"injections":[],"version":"1","options":{"target":"client","buildMode":"production","entryStrategy":{"type":"smart"}},"platform":{"qwik":"1.12.0","vite":"","rollup":"4.29.1","env":"node","os":"linux","node":"22.12.0"}}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"fix": "pnpm lint && pnpm format",
"format": "biome format --write .",
"lint": "biome check --write .",
"build.create-qwikdev-astro": "pnpm -C ./libs/create-qwikdev-astro build",
"build.create-qwikdev-astro": "pnpm -C ./libs/create-qwikdev-astro prod",
"postinstall": "lefthook install && playwright install --with-deps",
"changeset": "changeset",
"release": "pnpm build.create-qwikdev-astro && changeset publish",
Expand All @@ -40,7 +40,7 @@
"@qwikdev/create-astro": "workspace:*",
"@types/node": "^22.10.2",
"astro": "5.0.3",
"lefthook": "^1.10.0",
"lefthook": "^1.10.1",
"pkg-pr-new": "^0.0.35"
}
}
Loading

0 comments on commit c7f38aa

Please sign in to comment.