diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 73b93e2..4d600e6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,6 +2,7 @@ name: CI on: push: + branches: [main] pull_request: permissions: @@ -46,9 +47,13 @@ jobs: if: runner.os == 'Windows' run: pnpm exec vitest run tests/config.spec.ts tests/runner.spec.ts tests/version-updates.spec.ts - - name: Build package on Windows + - name: Verify deterministic build on Windows if: runner.os == 'Windows' - run: pnpm run build + run: pnpm run verify:build + + - name: Verify published package on Windows + if: runner.os == 'Windows' + run: pnpm run verify:package - name: Download and verify Mnemon Windows release if: runner.os == 'Windows' diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index acee528..fa6c22f 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -48,7 +48,10 @@ jobs: - name: Verify package run: pnpm run verify - - name: Publish package - run: npm publish --access public --ignore-scripts + - name: Pack release + run: npm pack --ignore-scripts + + - name: Publish packed release + run: npm publish "dsh-mnemon-$(node --print "require('./package.json').version").tgz" --access public --ignore-scripts env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.gitignore b/.gitignore index aa8b581..decfe11 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ node_modules/ coverage/ +/lib/ *.log .DS_Store *.tgz diff --git a/README.md b/README.md index 8835bcd..743178a 100644 --- a/README.md +++ b/README.md @@ -180,7 +180,7 @@ pnpm install pnpm run verify ``` -`verify` runs TypeScript checks, Vitest, and the production build. Generated artifacts are committed under `lib/`. +`verify` runs TypeScript checks, Vitest, a reproducible double build, and published-package validation. `lib/` is generated and intentionally not tracked. ## License diff --git a/README.zh-CN.md b/README.zh-CN.md index 4a07b9e..7a53748 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -180,7 +180,7 @@ pnpm install pnpm run verify ``` -`verify` 依次运行 TypeScript 检查、Vitest 和生产构建。构建产物提交在 `lib/` 中。 +`verify` 依次运行 TypeScript 检查、Vitest、两次可复现构建和发布包校验。`lib/` 是生成目录,不再提交到仓库。 ## License diff --git a/docs/en/development.md b/docs/en/development.md index 543a494..9ce2f0c 100644 --- a/docs/en/development.md +++ b/docs/en/development.md @@ -4,7 +4,7 @@ ## Environment -The repository does not declare minimum Node, pnpm, DSH, or Mnemon versions in `package.json`. Use the current DSH development environment and verify compatibility through the full validation chain whenever dependencies are upgraded. +`package.json` requires Node.js 20 or newer. CI uses Node.js 24 and pnpm 10.13.1. Verify DSH and Mnemon compatibility through the full validation chain whenever dependencies are upgraded. Install dependencies: @@ -18,7 +18,7 @@ pnpm install pnpm run typecheck # tsc --noEmit pnpm test # vitest run pnpm run build # declarations + host/client bundles -pnpm run verify # typecheck + test + build +pnpm run verify # typecheck + tests + reproducible build + package validation ``` ## Directory Structure @@ -38,9 +38,11 @@ src/ +-- tools.ts / commands.ts # model and human interfaces +-- rpc.ts / settings.ts # Web bridges +-- storage-scope.ts # storage inventory ++-- shared/contracts.ts # canonical Host/Client wire contracts +-- client/ # React workspace and locales tests/ # Vitest suites -lib/ # committed build artifacts +scripts/ # deterministic build and package checks +lib/ # generated, ignored publish artifacts docs/zh-CN/ # Chinese documentation docs/en/ # English mirror cordis.patch.yml # DSH profile bundle patch @@ -49,23 +51,22 @@ cordis.patch.yml # DSH profile bundle patch ## Build Artifacts ```text -tsc -p tsconfig.build.json - -> lib/types/* declarations, maps, intermediate ESM - -tsdown host bundle +tsdown (directly from src/) -> lib/index.js Node ES2024 ESM - -tsdown client bundle -> lib/client.js DSH browser module wrapper - -> lib/client.js.map + +tsc -p tsconfig.types.json + -> lib/types/**/*.d.ts declarations only lightningcss plugin -> CSS Modules compiled and injected as scoped