diff --git a/.github/workflows/ci-lib-changelog-emitter.yml b/.github/workflows/ci-lib-changelog-emitter.yml index 4952edef..62ff0198 100644 --- a/.github/workflows/ci-lib-changelog-emitter.yml +++ b/.github/workflows/ci-lib-changelog-emitter.yml @@ -34,11 +34,11 @@ jobs: - name: Build library run: pnpm --filter typespec-versioning-changelog run build - - name: Lint and format + - name: Run checks run: pnpm --filter typespec-versioning-changelog run checks - name: Run tests - run: pnpm --filter typespec-versioning-changelog test + run: pnpm --filter typespec-versioning-changelog run test:coverage - name: Audit dependencies - run: pnpm audit + run: pnpm --filter typespec-versioning-changelog run audit diff --git a/.github/workflows/ci-lib-cli.yml b/.github/workflows/ci-lib-cli.yml index be07c467..43e1037d 100644 --- a/.github/workflows/ci-lib-cli.yml +++ b/.github/workflows/ci-lib-cli.yml @@ -36,7 +36,7 @@ jobs: - name: Build core library run: pnpm --filter @common-grants/core run build - - name: Lint and format + - name: Run checks run: pnpm --filter @common-grants/cli run checks - name: Run tests @@ -46,4 +46,4 @@ jobs: run: pnpm --filter @common-grants/cli run build - name: Audit dependencies - run: pnpm audit + run: pnpm --filter @common-grants/cli run audit diff --git a/.github/workflows/ci-lib-core.yml b/.github/workflows/ci-lib-core.yml index 24b32964..282d85a2 100644 --- a/.github/workflows/ci-lib-core.yml +++ b/.github/workflows/ci-lib-core.yml @@ -33,7 +33,7 @@ jobs: - name: Install dependencies run: pnpm install --frozen-lockfile - - name: Lint and format + - name: Run checks run: pnpm --filter @common-grants/core run checks - name: Build library @@ -43,4 +43,4 @@ jobs: run: pnpm --filter @common-grants/core run typespec - name: Audit dependencies - run: pnpm audit + run: pnpm --filter @common-grants/core run audit diff --git a/.github/workflows/ci-lib-pysdk.yml b/.github/workflows/ci-lib-pysdk.yml index d1f1c965..2de9e48c 100644 --- a/.github/workflows/ci-lib-pysdk.yml +++ b/.github/workflows/ci-lib-pysdk.yml @@ -29,22 +29,13 @@ jobs: run: poetry self add poetry-audit-plugin - name: Install dependencies - run: poetry install + run: make install - - name: Audit dependencies for vulnerabilities - run: poetry audit - - - name: Run linting - run: poetry run ruff check . - - - name: Run formatting - run: poetry run black . --check - - - name: Run type checking - run: poetry run mypy . + - name: Run linting, formatting, and type checking + run: make checks - name: Run tests - run: poetry run pytest + run: make test - name: Build package - run: poetry build + run: make build diff --git a/.github/workflows/ci-lib-ts-sdk.yml b/.github/workflows/ci-lib-ts-sdk.yml index cd5f8b48..2a0db440 100644 --- a/.github/workflows/ci-lib-ts-sdk.yml +++ b/.github/workflows/ci-lib-ts-sdk.yml @@ -33,14 +33,14 @@ jobs: - name: Install dependencies run: pnpm install --frozen-lockfile - - name: Build SDK library + - name: Build library run: pnpm --filter @common-grants/sdk run build - - name: Lint and format + - name: Run checks run: pnpm --filter @common-grants/sdk run checks - name: Run tests - run: pnpm --filter @common-grants/sdk test:coverage + run: pnpm --filter @common-grants/sdk run test:coverage - name: Audit dependencies - run: pnpm audit + run: pnpm --filter @common-grants/sdk run audit diff --git a/lib/changelog-emitter/package.json b/lib/changelog-emitter/package.json index 9c34e1b1..931b357a 100644 --- a/lib/changelog-emitter/package.json +++ b/lib/changelog-emitter/package.json @@ -18,14 +18,15 @@ "@typespec/versioning": "catalog:" }, "devDependencies": { + "@eslint/js": "^9.15.0", "@types/node": "catalog:", "@typespec/prettier-plugin-typespec": "^1.5.0", "eslint": "^9.15.0", - "@eslint/js": "^9.15.0", "prettier": "^3.3.3", "typescript": "^5.3.3", "typescript-eslint": "^8.15.0", - "vitest": "catalog:" + "vitest": "catalog:", + "@vitest/coverage-v8": "^3.2.4" }, "scripts": { "build": "tsc", @@ -37,7 +38,9 @@ "format": "prettier . --write", "check:format": "prettier --check .", "check:lint": "eslint . --report-unused-disable-directives --max-warnings=0", - "checks": "pnpm run check:lint && pnpm run check:format" - }, - "packageManager": "npm@11.6.2+sha512.ee22b335fcbc95662cdf3ab8a053daf045d9cf9c6df6040d28965abb707512b2c16fa6c5eec049d34c74f78f390cebd14f697919eadb97756564d4f9eccc4954" + "check:types": "tsc --noEmit", + "checks": "pnpm run check:lint && pnpm run check:format && pnpm run check:types", + "test:coverage": "vitest run --coverage --coverage.reporter=text", + "audit": "pnpm audit" + } } diff --git a/lib/cli/DEVELOPMENT.md b/lib/cli/DEVELOPMENT.md index 7cea5bbc..868f5058 100644 --- a/lib/cli/DEVELOPMENT.md +++ b/lib/cli/DEVELOPMENT.md @@ -16,8 +16,8 @@ The CommonGrants CLI is a command-line tool that provides a set of commands for | `npm run start` | Start the CLI application | | `npm run dev` | Start development server with ts-node | | `npm run prepare` | Run TypeScript compilation (pre-install hook) | -| `npm run test` | Run Jest test suite | -| `npm run test:watch` | Run Jest test suite in watch mode | +| `npm run test` | Run vi test suite | +| `npm run test:watch` | Run vi test suite in watch mode | | `npm run lint` | Run ESLint with automatic fixes | | `npm run format` | Run automatic formatting and fix issues | | `npm run check:lint` | Check linting, fail if issues are found | diff --git a/lib/cli/package.json b/lib/cli/package.json index 8e7f5c6b..eb3d1362 100644 --- a/lib/cli/package.json +++ b/lib/cli/package.json @@ -49,7 +49,9 @@ "format": "prettier --write .", "check:lint": "eslint .", "check:format": "prettier --check .", - "checks": "pnpm run check:lint && pnpm run check:format" + "check:types": "tsc --noEmit", + "checks": "pnpm run check:lint && pnpm run check:format && pnpm run check:types", + "audit": "pnpm audit" }, "dependencies": { "@apidevtools/swagger-parser": "^10.1.1", diff --git a/lib/core/package.json b/lib/core/package.json index 762e195c..5f59e470 100644 --- a/lib/core/package.json +++ b/lib/core/package.json @@ -35,12 +35,14 @@ "build": "tsc -p .", "watch": "tsc -p . --watch", "typespec": "tsp compile lib/main.tsp", - "prepare": "npm run build", + "prepare": "pnpm run build", "lint": "eslint . --fix", "format": "prettier --write . && tsp format lib", "check:lint": "eslint", "check:format": "prettier --check . && tsp format lib --check", - "checks": "npm run check:lint && npm run check:format" + "check:types": "tsc --noEmit", + "checks": "pnpm run check:lint && pnpm run check:format && pnpm run check:types", + "audit": "pnpm audit" }, "keywords": [ "typespec", diff --git a/lib/python-sdk/Makefile b/lib/python-sdk/Makefile new file mode 100644 index 00000000..043a6fdb --- /dev/null +++ b/lib/python-sdk/Makefile @@ -0,0 +1,28 @@ +RUNTIME_PREFIX := poetry run +.PHONY: install format lint test build check-format check-lint check-types checks + +install: + poetry install + +format: + $(RUNTIME_PREFIX) black . + +lint: + $(RUNTIME_PREFIX) ruff check . + +test: + $(RUNTIME_PREFIX) pytest + +build: + poetry build + +check-format: + $(RUNTIME_PREFIX) black . --check + +check-lint: + $(RUNTIME_PREFIX) ruff check . + +check-types: + $(RUNTIME_PREFIX) mypy . + +checks: check-format check-lint check-types diff --git a/lib/ts-sdk/package.json b/lib/ts-sdk/package.json index b42d19dc..d0930a8f 100644 --- a/lib/ts-sdk/package.json +++ b/lib/ts-sdk/package.json @@ -67,7 +67,9 @@ "format": "prettier --write .", "check:lint": "eslint . --ext .ts", "check:format": "prettier --check .", - "checks": "pnpm check:lint && pnpm check:format", + "check:types": "tsc --noEmit", + "checks": "pnpm run check:lint && pnpm run check:format && pnpm run check:types", + "audit": "pnpm audit", "typespec": "tsp compile lib/main.tsp", "example:list": "tsx examples/list-opportunities.ts", "example:get": "tsx examples/get-opportunity.ts", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 362d81b0..83d1db44 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -86,6 +86,9 @@ importers: '@typespec/prettier-plugin-typespec': specifier: ^1.5.0 version: 1.5.0 + '@vitest/coverage-v8': + specifier: ^3.2.4 + version: 3.2.4(vitest@3.2.4(@types/debug@4.1.12)(@types/node@20.19.31)(tsx@4.21.0)(yaml@2.8.2)) eslint: specifier: ^9.15.0 version: 9.38.0 diff --git a/templates/express-js/DEVELOPMENT.md b/templates/express-js/DEVELOPMENT.md index e53357b6..752c01ce 100644 --- a/templates/express-js/DEVELOPMENT.md +++ b/templates/express-js/DEVELOPMENT.md @@ -10,7 +10,7 @@ | `npm run typespec` | Compile and emit TypeSpec outputs (i.e. OpenAPI and JSON schema) | | `npm run dev` | Start development server with hot reload | | `npm run start` | Start production server | -| `npm run test` | Run Jest test suite | +| `npm run test` | Run vi test suite | | `npm run prepare` | Run typespec compilation and build (pre-install hook) | | `npm run lint` | Run ESLint with automatic fixes | | `npm run format` | Run automatic formatting and fix issues | diff --git a/templates/express-js/package.json b/templates/express-js/package.json index f555a971..482b39fa 100644 --- a/templates/express-js/package.json +++ b/templates/express-js/package.json @@ -61,5 +61,15 @@ "typescript": "^5.9.3", "typescript-eslint": "^8.54.0", "vitest": "^3.2.4" + }, + "pnpm": { + "auditConfig": { + "ignoreGhsas": [ + "GHSA-3ppc-4f35-3m26", + "GHSA-83g3-92jg-28cx", + "GHSA-2g4f-4pwh-qvx6", + "GHSA-w7fw-mjwx-w883" + ] + } } } diff --git a/website/package.json b/website/package.json index f003ac48..5d7ae280 100644 --- a/website/package.json +++ b/website/package.json @@ -24,12 +24,13 @@ "check:format": "prettier --check .", "check:astro": "astro check", "check:spelling": "cspell .", - "checks": "pnpm check:lint && pnpm check:format && pnpm check:astro && pnpm check:spelling", + "check:types": "tsc --noEmit", + "checks": "pnpm check:lint && pnpm check:format && pnpm check:types && pnpm check:astro && pnpm check:spelling", "audit:moderate": "pnpm audit --audit-level=moderate", "audit:high": "pnpm audit --audit-level=high", "audit:critical": "pnpm audit --audit-level=critical", "validate:schemas": "tsx src/scripts/validate-schemas.ts", - "test": "vitest" + "test": "vitest run" }, "dependencies": { "@astrojs/react": "^4.4.2",