diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..3e49646 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,34 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + +jobs: + console: + name: console package (build + test) + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + # 本仓库的历史问题集中在 Windows(.cmd 垫片 spawn、HOME 兜底等), + # 因此 Windows 与 Linux 都跑,避免只在单平台绿。 + os: [ubuntu-latest, windows-latest] + defaults: + run: + working-directory: packages/plugin/console + steps: + - uses: actions/checkout@v4 + - uses: pnpm/action-setup@v4 + with: + # lockfile 为 pnpm 9 格式(lockfileVersion '9.0'),钉同大版本。 + version: 9 + - uses: actions/setup-node@v4 + with: + node-version: 22 + cache: pnpm + cache-dependency-path: packages/plugin/console/pnpm-lock.yaml + - run: pnpm install --frozen-lockfile + - run: pnpm build + - run: pnpm test diff --git a/packages/plugin/console/package.json b/packages/plugin/console/package.json index eda1042..d378e17 100644 --- a/packages/plugin/console/package.json +++ b/packages/plugin/console/package.json @@ -8,7 +8,7 @@ "main": "lib/index.mjs", "scripts": { "build": "tsdown --config tsdown.config.ts", - "test": "TSX_TSCONFIG_PATH=tests/tsconfig.json node --import tsx --test tests/discovery/*.spec.ts" + "test": "cd tests && node --import tsx --test \"**/*.spec.ts\"" }, "exports": { ".": { diff --git a/packages/plugin/console/pnpm-lock.yaml b/packages/plugin/console/pnpm-lock.yaml index 9d1b224..6b0e052 100644 --- a/packages/plugin/console/pnpm-lock.yaml +++ b/packages/plugin/console/pnpm-lock.yaml @@ -12,6 +12,9 @@ importers: specifier: ^2.4.0 version: 2.9.0 devDependencies: + '@types/node': + specifier: ^22.0.0 + version: 22.20.1 '@types/react': specifier: ~18.3.1 version: 18.3.31 @@ -224,42 +227,36 @@ packages: engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [linux] - libc: [glibc] '@rolldown/binding-linux-arm64-musl@1.2.3': resolution: {integrity: sha512-NHqjnxpsndf4MPymxteFAWHHfkTL8HjWh1KB7z23ofZ6QO2euONuxDXjat69dKZRALnGypg8k8SsK8vZJoXv1Q==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [linux] - libc: [musl] '@rolldown/binding-linux-ppc64-gnu@1.2.3': resolution: {integrity: sha512-6tbrbwfz5GB9DQ4Jwo6hy9v+vR31xZlvzZ6n5Xut6Hhx5PvrA9q/HsK8KMaYQp063iqZGXwNvZtYNLD7EM/x0w==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [ppc64] os: [linux] - libc: [glibc] '@rolldown/binding-linux-s390x-gnu@1.2.3': resolution: {integrity: sha512-oyuXxXmoZHjXC917IAPFAAv4wWAa0cM9afk8nx1+9/jNNOX1uPf8yDA6p7G0RypOfw/X0PQt5IfoquY1um+zSg==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [s390x] os: [linux] - libc: [glibc] '@rolldown/binding-linux-x64-gnu@1.2.3': resolution: {integrity: sha512-TytMwF2KVGqP2tgd0I1OY0PAv78dZRAYcF5ssDzjM34SUXCED3uXvSd5+lHoC0bTD6eEdFz7LdQNCO1y0oVk9w==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [linux] - libc: [glibc] '@rolldown/binding-linux-x64-musl@1.2.3': resolution: {integrity: sha512-/E9m3qstrJFVPoULV25mVQblSNExY2+kBsYe4sy0Tn0yOOgJ8wZbZt3KnRbF/XeU2Gl1STKUQnDNTqhIE5MD4A==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [linux] - libc: [musl] '@rolldown/binding-openharmony-arm64@1.2.3': resolution: {integrity: sha512-Kr0OcsoQI816i6HOl3vFHpd1K0eZyh76zgfj4c1nTyaTsd5r2Mj1lwM4R90y/qaCfmTn9eHy0SKwi98eitRxug==} @@ -282,6 +279,9 @@ packages: '@rolldown/pluginutils@1.0.1': resolution: {integrity: sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw==} + '@types/node@22.20.1': + resolution: {integrity: sha512-EANqOCF9QFyra+4pfxUcX9STKJpCLjMbObVzljIJomAWSnuSIEAvyzEU53GaajbXJEgdh0iEcPL+DGvpUd4k1Q==} + '@types/prop-types@15.7.15': resolution: {integrity: sha512-F6bEyamV9jKGAFBEmlQnesRPGOQqS2+Uwi0Em15xenOxHaf2hv6L8YCVn3rPdPJOiJfPiCnLIRyvwVaqMY3MIw==} @@ -312,37 +312,31 @@ packages: resolution: {integrity: sha512-g6LnHrR0Rfqq5cXs7olwR2+LlVDc876pw7Hh7YXbukVSiBxQkaxqsEO/trO25z2g99zWzgXwoYvQZ1TnwA2wEw==} cpu: [arm] os: [linux] - libc: [glibc] '@yuku-codegen/binding-linux-arm-musl@0.8.4': resolution: {integrity: sha512-7XAPHrROPEFuJWXEGZeLZQN4xR8ENQ65+HSCtCHjSzCwGgnX53GUjM9ExVcHopV0a5g4vu57v2wwtyWIM5iNOQ==} cpu: [arm] os: [linux] - libc: [musl] '@yuku-codegen/binding-linux-arm64-gnu@0.8.4': resolution: {integrity: sha512-fnBm7NLuuwFXy7F1vRIuyOc+RW9ADUjuCKVGY87Dj8jtr9XgESNrwb+B9VLSFY7nZ0rCdK/Sm1fBqJpI7eLdKQ==} cpu: [arm64] os: [linux] - libc: [glibc] '@yuku-codegen/binding-linux-arm64-musl@0.8.4': resolution: {integrity: sha512-6vTw4ZHO9nm4SUkw36uG+UE6/qifZ0E8HIef7Mx/U/c2Zxu3JLBfXtU7U/NN2GMkDmcJkgwjXfpQoYw4Ch5Y1w==} cpu: [arm64] os: [linux] - libc: [musl] '@yuku-codegen/binding-linux-x64-gnu@0.8.4': resolution: {integrity: sha512-+vuC3V3Lw+DB4oJgHV9pVDfQZlsZJnxmbdods7HzxgEALU3P5+czwdAcw3wfh7Ebabt0Ny8eLUb1k9RV5OB/+w==} cpu: [x64] os: [linux] - libc: [glibc] '@yuku-codegen/binding-linux-x64-musl@0.8.4': resolution: {integrity: sha512-QH60PE4eZecmgNGa1/T1cKPhrfxt6ANtu4lrQ1FZ50F9b0GS9WjGmIjrfdSUeQa+f2Iqk3oEFSJdgVHBg1KPNg==} cpu: [x64] os: [linux] - libc: [musl] '@yuku-codegen/binding-win32-arm64@0.8.4': resolution: {integrity: sha512-6r68c0nKZPIBRXZIBiD7zjlEukBR+xRxpTOVj4n1Fsjcdh4YbbJfjFfmIzdbo9jXR1xL+dPueDVdsRGOUH5MoQ==} @@ -378,37 +372,31 @@ packages: resolution: {integrity: sha512-Fo3r5fYhGDcFnl+KN+L9PgtiQPS4AIE1n1mG1o5jZ11p7g5yZ/1EjLFmSHAUsoXreun8KjTsFjEL7P1Sb93PZQ==} cpu: [arm] os: [linux] - libc: [glibc] '@yuku-parser/binding-linux-arm-musl@0.8.4': resolution: {integrity: sha512-BEB31vUEgXPWf7WkoMPSzzJhpC/wWCBXyysRCCPsw47BJ/OtbQsvJbxX9fFDuSRLy3kbyIV/WbdUTgbQ9COxiw==} cpu: [arm] os: [linux] - libc: [musl] '@yuku-parser/binding-linux-arm64-gnu@0.8.4': resolution: {integrity: sha512-xGLCRcHn9xVz7JVNyyKtiNJSf503qtUmih9XVSsghgzOmiKUMnHObs69OMMwXN3788tg1jsl11fNjjQlB8idMA==} cpu: [arm64] os: [linux] - libc: [glibc] '@yuku-parser/binding-linux-arm64-musl@0.8.4': resolution: {integrity: sha512-3kNRi8NJT2q6FQRVCUFHIQ99+kXdi8cVJEEUi6+xtFqpMgNrZNnbgAj28ILsDC7zmclaU+v47eUCeJoKLSCbww==} cpu: [arm64] os: [linux] - libc: [musl] '@yuku-parser/binding-linux-x64-gnu@0.8.4': resolution: {integrity: sha512-isi62oMy94Z3OXwGs2l2rkqRiRyqLmfHeTRHpA/uWZbsNhnm7IdVvkF7e7wHNKAtd5jwGzOqYSroxKv2fOm7Cw==} cpu: [x64] os: [linux] - libc: [glibc] '@yuku-parser/binding-linux-x64-musl@0.8.4': resolution: {integrity: sha512-9RsEw2xYHqU/pjSRBTOupWN3sF8uz9stjJdARfz6o0llvF+yfrj5QHmTiocGGBeAI80fvKmDtr2RIQClUzAPcA==} cpu: [x64] os: [linux] - libc: [musl] '@yuku-parser/binding-win32-arm64@0.8.4': resolution: {integrity: sha512-VEZHo9rEGOBKR20sA3vCO00aQvwWND5aLu7YxeX+YupMZJh9hd1f17AbClJN37Q2iL1PCHht+wDTOKX6tZYqXg==} @@ -583,6 +571,9 @@ packages: unconfig-core@7.5.0: resolution: {integrity: sha512-Su3FauozOGP44ZmKdHy2oE6LPjk51M/TRRjHv2HNCWiDvfvCoxC2lno6jevMA91MYAdCdwP05QnWdWpSbncX/w==} + undici-types@6.21.0: + resolution: {integrity: sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==} + verkit@0.3.2: resolution: {integrity: sha512-zj/ob3UsvJGN0whEAKFp53REA5X66hvffVqoCtVQAakJKnKlH+/PcOfMoFwIG/o4rElqLv/ycAFlx8ZlXUorCg==} engines: {node: '>=18.12.0'} @@ -731,6 +722,10 @@ snapshots: '@rolldown/pluginutils@1.0.1': {} + '@types/node@22.20.1': + dependencies: + undici-types: 6.21.0 + '@types/prop-types@15.7.15': {} '@types/react@18.3.31': @@ -963,6 +958,8 @@ snapshots: '@quansync/fs': 1.0.0 quansync: 1.0.0 + undici-types@6.21.0: {} + verkit@0.3.2: {} yaml@2.9.0: {} diff --git a/packages/plugin/console/tests/discovery/enumerate.spec.ts b/packages/plugin/console/tests/discovery/enumerate.spec.ts index f484f76..002d954 100644 --- a/packages/plugin/console/tests/discovery/enumerate.spec.ts +++ b/packages/plugin/console/tests/discovery/enumerate.spec.ts @@ -30,8 +30,8 @@ function indexSource(home: string, file: string): PluginSource { describe('parseGithubUrl', () => { it('parses bare and .git URLs', () => { - assert.deepEqual(parseGithubUrl('https://github.com/vlln/whale-girl'), { owner: 'dsh-external', repo: 'whale-girl' }) - assert.deepEqual(parseGithubUrl('https://github.com/vlln/whale-girl'), { owner: 'dsh-external', repo: 'whale-girl' }) + assert.deepEqual(parseGithubUrl('https://github.com/vlln/whale-girl'), { owner: 'vlln', repo: 'whale-girl' }) + assert.deepEqual(parseGithubUrl('https://github.com/vlln/whale-girl.git'), { owner: 'vlln', repo: 'whale-girl' }) }) it('rejects non-github URLs', () => { assert.equal(parseGithubUrl('https://example.com/x'), null)