Skip to content

Commit

Permalink
👷 feat: Add type build pipeline (#381)
Browse files Browse the repository at this point in the history
## Description

closes #272

- Generates .d.ts files in types/ for every package
- Importantly does it in a non blocking way for tests and esbuild. This
allows build and tests to run in parallel without being blocked by the
slow typechecker
- Change types in package.json to point at types/index.d.ts
- Reduces issues with type issues in future compared to pointing at .ts

## Testing

Explain the quality checks that have been done on the code changes

## Additional Information

- [ ] I read the [contributing docs](../docs/contributing.md) (if this
is your first contribution)

Your ENS/address:

Co-authored-by: Will Cory <[email protected]>
  • Loading branch information
roninjin10 and Will Cory authored Jul 24, 2023
1 parent b7b9993 commit 56dfb3b
Show file tree
Hide file tree
Showing 39 changed files with 812 additions and 443 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ Runs prettier and eslint

Runs npm publish in dry mode. On workflow releases it will actually publish

### typecheck.yml

Runs the typechecker. Since build is done (faster) with babel typechecker must be run as a seperate lint step.

### unit.yml

Runs run unit tests for all packages
22 changes: 19 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ on:
name: Build

jobs:
build:
name: Build
build-types:
name: Build types
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -22,7 +22,23 @@ jobs:
uses: ./.github/actions/setup

- name: Run build
run: pnpm nx affected --target=build
run: pnpm nx affected --target=build:types
env:
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
build-dist:
name: Build dist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: recursive

- name: "Setup"
uses: ./.github/actions/setup

- name: Run build dist
run: pnpm nx affected --target=build:dist
env:
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}

31 changes: 0 additions & 31 deletions .github/workflows/e2e.yml

This file was deleted.

28 changes: 0 additions & 28 deletions .github/workflows/formatter.yml

This file was deleted.

35 changes: 34 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
name: Lint

jobs:
check:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
Expand All @@ -26,3 +26,36 @@ jobs:
env:
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}

format:
name: Formatters
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: recursive

- name: "Setup"
uses: ./.github/actions/setup

- name: Run Formatters
run: pnpm nx affected --targets=format:check
env:
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}

sort-package-json:
name: Sort package json
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: recursive

- name: "Setup"
uses: ./.github/actions/setup

- name: Run Package.json formatter - Run `pnpm sort-package-json` to fix
run: pnpm sort-package-json:check
env:
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
27 changes: 0 additions & 27 deletions .github/workflows/sort-package-json.yml

This file was deleted.

26 changes: 23 additions & 3 deletions .github/workflows/coverage.yml → .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ on:
pull_request:
merge_group:

name: Coverage
name: Test

jobs:
check:
name: Coverage
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -62,3 +62,23 @@ jobs:
with:
name: "@evmts/esbuild"
working-directory: "./examples/esbuild"
e2e:
name: E2E
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: recursive

- name: "Setup"
uses: ./.github/actions/setup

- name: Install Playwright Browsers
run: npx playwright install --with-deps

- name: Run tests
run: echo "WIP" # pnpm nx e2e e2e
env:
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
27 changes: 0 additions & 27 deletions .github/workflows/typecheck.yml

This file was deleted.

27 changes: 0 additions & 27 deletions .github/workflows/unit.yml

This file was deleted.

6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ forge-artifacts
broadcast

# compiled output
*/dist
*/*/dist
*/types
*/*/types
packages/*/dist
apps/*/dist
tmp
Expand Down Expand Up @@ -50,4 +54,4 @@ Thumbs.db

# My personal files
.zshrc
/target
/target
9 changes: 5 additions & 4 deletions bundlers/bundler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,23 @@
"types": "types/index.d.ts",
"files": [
"dist",
"types"
"types",
"src"
],
"scripts": {
"test": "vitest --coverage",
"test:coverage": "vitest run --coverage",
"test:run": "vitest run",
"test:ui": "vitest --ui",
"build": "tsup && pnpm build:types",
"build": "nx run-many --targets=build:dist,build:types --projects=@evmts/bundler ",
"build:dist": "tsup",
"build:types": "tsc --emitDeclarationOnly",
"clean": "rm -rf node_modules && rm -rf artifacts && rm -rf dist && rm -rf cache",
"format": "rome format . --write",
"format:check": "rome format .",
"lint": "rome check . --apply-unsafe",
"lint:check": "rome check . --verbose",
"package:up": "pnpm up --latest",
"typecheck": "tsc --noEmit"
"package:up": "pnpm up --latest"
},
"dependencies": {
"@evmts/config": "workspace:^",
Expand Down
10 changes: 6 additions & 4 deletions bundlers/config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,16 @@
"type": "module",
"main": "dist/index.cjs",
"module": "dist/index.js",
"types": "src/index.ts",
"types": "types/index.d.ts",
"files": [
"dist",
"types",
"src"
],
"scripts": {
"build": "tsup",
"build": "nx run-many --targets=build:dist,build:types --projects=@evmts/config ",
"build:dist": "tsup",
"build:types": "tsc --emitDeclarationOnly",
"clean": "rm -rf node_modules && rm -rf artifacts && rm -rf dist && rm -rf cache",
"format": "rome format . --write",
"format:check": "rome format .",
Expand All @@ -40,8 +43,7 @@
"test": "vitest --coverage",
"test:coverage": "vitest run --coverage",
"test:run": "vitest run",
"test:ui": "vitest --ui",
"typecheck": "tsc --noEmit"
"test:ui": "vitest --ui"
},
"dependencies": {
"@types/node": "^20.4.2",
Expand Down
2 changes: 1 addition & 1 deletion bundlers/config/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"compilerOptions": {
"rootDir": "src",
"composite": true,
"outDir": "dist",
"outDir": "types",
"skipLibCheck": true
},
"include": ["src", "src/**/*.json"]
Expand Down
10 changes: 6 additions & 4 deletions bundlers/esbuild-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,16 @@
"type": "module",
"main": "dist/index.cjs",
"module": "dist/index.js",
"types": "src/index.ts",
"types": "src/index.d.ts",
"files": [
"dist",
"types",
"src"
],
"scripts": {
"build": "tsup",
"build": "nx run-many --targets=build:dist,build:types --projects=@evmts/@evmts/esbuild-plugin ",
"build:dist": "tsup",
"build:types": "tsc --emitDeclarationOnly",
"clean": "rm -rf node_modules && rm -rf artifacts && rm -rf dist && rm -rf cache",
"format": "rome format . --write",
"format:check": "rome format .",
Expand All @@ -37,8 +40,7 @@
"package:up": "pnpm up --latest",
"test": "vitest",
"test:run": "vitest run",
"test:ui": "vitest --ui",
"typecheck": "tsc --noEmit"
"test:ui": "vitest --ui"
},
"dependencies": {
"@evmts/bundler": "workspace:^"
Expand Down
2 changes: 1 addition & 1 deletion bundlers/esbuild-plugin/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"compilerOptions": {
"rootDir": "src",
"composite": true,
"outDir": "dist",
"outDir": "types",
"skipLibCheck": true
},
"include": ["src", "src/**/*.json"]
Expand Down
Loading

0 comments on commit 56dfb3b

Please sign in to comment.