-
Notifications
You must be signed in to change notification settings - Fork 188
fix yarn build; add workflow ci #1075
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,187 @@ | ||
| name: Workspace CI | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: | ||
| - dev | ||
| - staging | ||
| - main | ||
| push: | ||
| branches: | ||
| - dev | ||
| - staging | ||
| - main | ||
|
|
||
| jobs: | ||
| workspace-build: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Cache Yarn dependencies | ||
| uses: ./.github/actions/cache-yarn | ||
| with: | ||
| path: | | ||
| .yarn/cache | ||
| node_modules | ||
| */node_modules | ||
| packages/*/node_modules | ||
| cache-version: v1 | ||
|
|
||
| - name: Install Dependencies | ||
| uses: ./.github/actions/yarn-install | ||
|
|
||
| - name: Run workspace build | ||
| run: yarn build | ||
|
|
||
| - name: Verify build artifacts | ||
| run: | | ||
| echo "Checking for build artifacts..." | ||
| find . -name "dist" -type d | head -10 | ||
| echo "Build completed successfully!" | ||
| workspace-type-check: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Cache Yarn dependencies | ||
| uses: ./.github/actions/cache-yarn | ||
| with: | ||
| path: | | ||
| .yarn/cache | ||
| node_modules | ||
| */node_modules | ||
| packages/*/node_modules | ||
| cache-version: v1 | ||
|
|
||
| - name: Install Dependencies | ||
| uses: ./.github/actions/yarn-install | ||
|
|
||
| - name: Run workspace type checking | ||
| run: yarn types | ||
|
|
||
| - name: Verify type checking passed | ||
| run: echo "Type checking completed successfully!" | ||
|
|
||
| workspace-lint: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Cache Yarn dependencies | ||
| uses: ./.github/actions/cache-yarn | ||
| with: | ||
| path: | | ||
| .yarn/cache | ||
| node_modules | ||
| */node_modules | ||
| packages/*/node_modules | ||
| cache-version: v1 | ||
|
|
||
| - name: Install Dependencies | ||
| uses: ./.github/actions/yarn-install | ||
|
|
||
| - name: Run workspace linting | ||
| run: yarn lint | ||
|
|
||
| - name: Verify linting passed | ||
| run: echo "Linting completed successfully!" | ||
|
|
||
| workspace-format-check: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Cache Yarn dependencies | ||
| uses: ./.github/actions/cache-yarn | ||
| with: | ||
| path: | | ||
| .yarn/cache | ||
| node_modules | ||
| */node_modules | ||
| packages/*/node_modules | ||
| cache-version: v1 | ||
|
|
||
| - name: Install Dependencies | ||
| uses: ./.github/actions/yarn-install | ||
|
|
||
| - name: Check code formatting (dry run) | ||
| run: | | ||
| echo "Checking if code is properly formatted..." | ||
| # Run format in dry-run mode by checking if any files would change | ||
| if ! git diff --quiet --exit-code; then | ||
| echo "Working directory not clean before format check" | ||
| git status --porcelain | ||
| exit 1 | ||
| fi | ||
| yarn format | ||
| if ! git diff --quiet --exit-code; then | ||
| echo "❌ Code formatting issues found. The following files need formatting:" | ||
| git diff --name-only | ||
| echo "Run 'yarn format' to fix these issues." | ||
| exit 1 | ||
| fi | ||
| - name: Verify formatting check passed | ||
| run: echo "Code formatting check completed successfully!" | ||
|
|
||
| workspace-test: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Cache Yarn dependencies | ||
| uses: ./.github/actions/cache-yarn | ||
| with: | ||
| path: | | ||
| .yarn/cache | ||
| node_modules | ||
| */node_modules | ||
| packages/*/node_modules | ||
| cache-version: v1 | ||
|
|
||
| - name: Install Dependencies | ||
| uses: ./.github/actions/yarn-install | ||
|
|
||
| - name: Run workspace tests | ||
| run: yarn test | ||
|
|
||
| - name: Verify tests passed | ||
| run: echo "Workspace tests completed successfully!" | ||
|
|
||
| version-consistency: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Cache Yarn dependencies | ||
| uses: ./.github/actions/cache-yarn | ||
| with: | ||
| path: | | ||
| .yarn/cache | ||
| node_modules | ||
| */node_modules | ||
| packages/*/node_modules | ||
| cache-version: v1 | ||
|
|
||
| - name: Install Dependencies | ||
| uses: ./.github/actions/yarn-install | ||
|
|
||
| - name: Check package version consistency | ||
| run: yarn check:versions | ||
|
|
||
| - name: Verify version consistency | ||
| run: echo "Package version consistency check passed!" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,7 +13,7 @@ | |
| "baseUrl": ".", | ||
| "composite": false | ||
| }, | ||
| "include": ["tests/**/*", "tests/**/*.json", "src/**/*"], | ||
| "include": ["tests/**/*", "tests/**/*.json", "src/**/*", "../common/src/**/*"], | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: TypeScript Config Conflict: Project References vs. Source InclusionAdding |
||
| "exclude": ["node_modules"], | ||
|
Comment on lines
+16
to
17
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don’t compile tests or cross‑package sources in build tsconfig; rely on project refs. Including tests and ../common/src in this build config can (a) bloat/slow the build, (b) risk TS6059/rootDir expansion to “..” and odd emit paths, and (c) duplicate-compilation with the referenced ../common project. Keep build inputs scoped to this package’s src and exclude tests/dist. Apply this diff: - "include": ["tests/**/*", "tests/**/*.json", "src/**/*", "../common/src/**/*"],
- "exclude": ["node_modules"],
+ "include": ["src/**/*"],
+ "exclude": ["node_modules", "tests", "dist"],If tests need TS, add a separate tsconfig.test.json that extends this and includes tests. |
||
| "references": [ | ||
| { | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -3,13 +3,9 @@ | |||||||||||||||||||||||||||
| "compilerOptions": { | ||||||||||||||||||||||||||||
| "declaration": true, | ||||||||||||||||||||||||||||
| "emitDeclarationOnly": true, | ||||||||||||||||||||||||||||
| "declarationMap": false, | ||||||||||||||||||||||||||||
| "outDir": "./dist/esm", | ||||||||||||||||||||||||||||
| "declarationDir": "./dist/esm", | ||||||||||||||||||||||||||||
| "composite": true, | ||||||||||||||||||||||||||||
| "noEmit": false, | ||||||||||||||||||||||||||||
| "rootDir": "." | ||||||||||||||||||||||||||||
| "outDir": "./dist/types", | ||||||||||||||||||||||||||||
| "skipLibCheck": true | ||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||
| "include": ["src/**/*", "tests/**/*", "tests/**/*.json"], | ||||||||||||||||||||||||||||
| "exclude": ["node_modules", "dist"] | ||||||||||||||||||||||||||||
| "include": ["src/**/*"], | ||||||||||||||||||||||||||||
| "exclude": ["node_modules", "dist", "tests"] | ||||||||||||||||||||||||||||
|
Comment on lines
+6
to
+10
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Harden declaration‑only build to avoid pulling in .js files. This config inherits allowJs: true from tsconfig.json; with emitDeclarationOnly it can try to emit d.ts from JS (often incomplete/unstable). Explicitly disable JS here. Apply this diff: "compilerOptions": {
"declaration": true,
"emitDeclarationOnly": true,
"outDir": "./dist/types",
- "skipLibCheck": true
+ "skipLibCheck": true,
+ "allowJs": false
},📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Formatting step mutates the tree and can fail due to install side‑effects; use a non‑mutating check.
Running
yarn formatwrites files; the pre-check also fails if install touches tracked files (common with Yarn Berry). Use a read‑only check (Prettier--checkoryarn format:check) and drop the “clean before” gate.Apply this diff:
Ensure package.json has a “format:check”: “prettier --check .” script.
📝 Committable suggestion
🤖 Prompt for AI Agents