Skip to content

Commit

Permalink
fix(templates): fix templates tsc errors and add test (#2036)
Browse files Browse the repository at this point in the history
  • Loading branch information
tash-2s committed Jan 3, 2024
1 parent d8c8f66 commit d3f0d32
Show file tree
Hide file tree
Showing 10 changed files with 75 additions and 16 deletions.
21 changes: 21 additions & 0 deletions .github/actions/setup-prerequisites/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Setup prerequisites
description: Setup pnpm, Node.js, and Foundry
runs:
using: composite
steps:
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8.x

- name: Setup node
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
registry-url: https://registry.npmjs.org
cache: pnpm

- name: Setup foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
18 changes: 2 additions & 16 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,8 @@ description: Common setup steps used by our workflows
runs:
using: composite
steps:
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8.x

- name: Setup node
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
registry-url: https://registry.npmjs.org
cache: pnpm

- name: Setup foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
- name: Setup prerequisites
uses: ./.github/actions/setup-prerequisites

# pnpm no longer runs this before the actual install (https://github.com/pnpm/pnpm/issues/3760)
# but we need to create some placeholder files like bins so that the install step can find them and put references to them in the right spot
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,9 @@ jobs:
docker:
uses: ./.github/workflows/docker.yml
needs: release-snapshot

test-snapshot:
uses: ./.github/workflows/test-published-packages.yml
needs: release-snapshot
with:
tag-or-version: ${{ github.ref_name }}
35 changes: 35 additions & 0 deletions .github/workflows/test-published-packages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Test published packages

on:
workflow_call:
inputs:
tag-or-version:
required: true
type: string
workflow_dispatch:
inputs:
tag-or-version:
required: true
type: string

jobs:
test-create-mud-project:
name: Test create-mud project
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
template: [vanilla, react, react-ecs, phaser, threejs]

steps:
- uses: actions/checkout@v3
with:
sparse-checkout: .github

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

- name: Test
run: |
pnpm create mud@${{ inputs.tag-or-version }} project --template ${{ matrix.template }}
pnpm --dir project run test
2 changes: 2 additions & 0 deletions templates/phaser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
},
"devDependencies": {
"@latticexyz/cli": "link:../../packages/cli",
"@types/debug": "4.1.7",
"@types/prettier": "2.7.2",
"@typescript-eslint/eslint-plugin": "5.46.1",
"@typescript-eslint/parser": "5.46.1",
"eslint": "8.29.0",
Expand Down
2 changes: 2 additions & 0 deletions templates/react-ecs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
},
"devDependencies": {
"@latticexyz/cli": "link:../../packages/cli",
"@types/debug": "4.1.7",
"@types/prettier": "2.7.2",
"@typescript-eslint/eslint-plugin": "5.46.1",
"@typescript-eslint/parser": "5.46.1",
"eslint": "8.29.0",
Expand Down
2 changes: 2 additions & 0 deletions templates/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
},
"devDependencies": {
"@latticexyz/cli": "link:../../packages/cli",
"@types/debug": "4.1.7",
"@types/prettier": "2.7.2",
"@typescript-eslint/eslint-plugin": "5.46.1",
"@typescript-eslint/parser": "5.46.1",
"eslint": "8.29.0",
Expand Down
2 changes: 2 additions & 0 deletions templates/threejs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
},
"devDependencies": {
"@latticexyz/cli": "link:../../packages/cli",
"@types/debug": "4.1.7",
"@types/prettier": "2.7.2",
"@typescript-eslint/eslint-plugin": "5.46.1",
"@typescript-eslint/parser": "5.46.1",
"eslint": "8.29.0",
Expand Down
2 changes: 2 additions & 0 deletions templates/vanilla/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
},
"devDependencies": {
"@latticexyz/cli": "link:../../packages/cli",
"@types/debug": "4.1.7",
"@types/prettier": "2.7.2",
"@typescript-eslint/eslint-plugin": "5.46.1",
"@typescript-eslint/parser": "5.46.1",
"eslint": "8.29.0",
Expand Down
1 change: 1 addition & 0 deletions templates/vanilla/packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"viem": "1.14.0"
},
"devDependencies": {
"@types/react-dom": "18.2.7",
"vite": "^4.2.1",
"wait-port": "^1.0.4"
}
Expand Down

0 comments on commit d3f0d32

Please sign in to comment.