From 932f7e80a81a14843d888ce1fd02decdf21d16f5 Mon Sep 17 00:00:00 2001 From: turbocrime <134443988+turbocrime@users.noreply.github.com> Date: Wed, 24 Apr 2024 06:24:40 -0700 Subject: [PATCH] organize package scripts (#975) --- .github/workflows/compile-wasm.yml | 2 +- .github/workflows/packages-release.yml | 2 +- .github/workflows/turbo-ci.yml | 13 ++--- package.json | 29 +++++------ packages/wasm/package.json | 8 +-- turbo.json | 71 +++++++++++++++----------- 6 files changed, 67 insertions(+), 58 deletions(-) diff --git a/.github/workflows/compile-wasm.yml b/.github/workflows/compile-wasm.yml index fddd759941..57ec892eb7 100644 --- a/.github/workflows/compile-wasm.yml +++ b/.github/workflows/compile-wasm.yml @@ -8,7 +8,7 @@ on: jobs: wasm: - runs-on: buildjet-16vcpu-ubuntu-2204 # buildjet for rust, github standard for everything else + runs-on: buildjet-16vcpu-ubuntu-2204 steps: - uses: actions/checkout@v4 - id: compiled diff --git a/.github/workflows/packages-release.yml b/.github/workflows/packages-release.yml index 8711ed1277..a3f4c87467 100644 --- a/.github/workflows/packages-release.yml +++ b/.github/workflows/packages-release.yml @@ -40,7 +40,7 @@ jobs: id: changesets uses: changesets/action@v1 with: - publish: pnpm changeset:publish + publish: pnpm changeset publish env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/turbo-ci.yml b/.github/workflows/turbo-ci.yml index 37037cf29b..4b6faf2429 100644 --- a/.github/workflows/turbo-ci.yml +++ b/.github/workflows/turbo-ci.yml @@ -30,7 +30,7 @@ jobs: turbo-lint: name: Lint - runs-on: buildjet-4vcpu-ubuntu-2204 + runs-on: buildjet-8vcpu-ubuntu-2204 needs: turbo-compile steps: - uses: actions/checkout@v4 @@ -47,12 +47,11 @@ jobs: cache: 'pnpm' - run: pnpm install --frozen-lockfile - run: pnpm turbo telemetry disable - - run: pnpm format-check - run: pnpm turbo lint --cache-dir=.turbo turbo-build: name: Build - runs-on: buildjet-2vcpu-ubuntu-2204 + runs-on: buildjet-4vcpu-ubuntu-2204 needs: turbo-compile steps: - uses: actions/checkout@v4 @@ -73,7 +72,7 @@ jobs: turbo-test: name: test - runs-on: buildjet-2vcpu-ubuntu-2204 + runs-on: buildjet-4vcpu-ubuntu-2204 needs: turbo-compile steps: - uses: actions/checkout@v4 @@ -90,11 +89,12 @@ jobs: cache: 'pnpm' - run: pnpm install --frozen-lockfile - run: pnpm turbo telemetry disable + - run: pnpm playwright install --with-deps chromium - run: pnpm turbo test --cache-dir=.turbo turbo-lint-rust: name: lint:rust - runs-on: buildjet-16vcpu-ubuntu-2204 + runs-on: buildjet-4vcpu-ubuntu-2204 needs: turbo-compile steps: - uses: actions/checkout@v4 @@ -113,7 +113,7 @@ jobs: - uses: dtolnay/rust-toolchain@stable with: targets: wasm32-unknown-unknown - - run: pnpm turbo format-check:rust --cache-dir=.turbo + - run: pnpm turbo telemetry disable - run: pnpm turbo lint:rust --cache-dir=.turbo turbo-test-rust: @@ -141,4 +141,5 @@ jobs: with: version: 'latest' - uses: browser-actions/setup-firefox@v1 + - run: pnpm turbo telemetry disable - run: pnpm turbo test:rust --cache-dir=.turbo diff --git a/package.json b/package.json index f9bed58794..a4a605a27e 100644 --- a/package.json +++ b/package.json @@ -5,25 +5,24 @@ "repository": "penumbra-zone/web.git", "packageManager": "pnpm@8.6.11", "scripts": { - "all-check": "pnpm clean && pnpm install && pnpm compile && pnpm format-check && pnpm lint && pnpm test && pnpm build && pnpm format-check:rust && pnpm lint:rust && pnpm test:rust", - "build": "turbo run build", - "changeset": "changeset", - "changeset:publish": "changeset publish", + "all-check": "pnpm clean && pnpm install && pnpm compile && pnpm lint && pnpm lint:rust && pnpm build && pnpm test && pnpm test:rust", + "build": "turbo build", "clean": "turbo clean", "clean:vitest-mjs": "find . -type f -name 'vite.config.ts.timestamp-*-*.mjs' -ls -delete", - "compile": "turbo run compile", - "dev": "turbo run dev --concurrency 20", - "format": "syncpack format && prettier --write .", - "format-check": "syncpack lint && prettier --check .", - "format-check:rust": "turbo run format-check:rust", - "lint": "turbo run lint -- --max-warnings=0", - "lint:fix": "turbo run lint -- --fix", - "lint:rust": "turbo run lint:rust", + "compile": "turbo compile", + "dev": "turbo dev", + "format": "turbo format", + "format:prettier": "prettier --write .", + "format:syncpack": "syncpack format", + "lint": "turbo lint", + "lint:fix": "turbo lint -- --fix", + "lint:prettier": "prettier --check .", + "lint:rust": "turbo lint:rust", "lint:syncpack": "syncpack lint", - "playwright-install": "playwright install", "postinstall": "syncpack list-mismatches", - "test": "turbo run test", - "test:rust": "turbo run test:rust" + "pretest": "playwright install", + "test": "turbo test", + "test:rust": "turbo test:rust" }, "dependencies": { "@buf/cosmos_ibc.bufbuild_es": "1.8.0-20240327103030-e2006674271c.2", diff --git a/packages/wasm/package.json b/packages/wasm/package.json index a7a18d706b..7125de5809 100644 --- a/packages/wasm/package.json +++ b/packages/wasm/package.json @@ -6,13 +6,13 @@ "scripts": { "clean": "rm -v wasm/index*", "clean:rust": "cargo clean --manifest-path ./crate/Cargo.toml", - "compile": "cd crate ; wasm-pack build --no-pack --target bundler --out-name index --out-dir ../wasm", + "compile": "cd crate && wasm-pack build --no-pack --target bundler --out-name index --out-dir ../wasm", "dev": "cargo watch -C ./crate --postpone -- pnpm turbo run compile", + "format": "cd crate && cargo fmt --all", "lint": "eslint \"src/*.ts*\"", - "lint:rust": "cd crate && cargo clippy -- -D warnings && cargo clippy --tests -- -D warnings", - "predev": "cargo install cargo-watch", + "lint:rust": "cd crate && cargo fmt --all -- --check && cargo clippy -- -D warnings && cargo clippy --tests -- -D warnings", "test": "vitest run", - "test:rust": "cd crate ; wasm-pack test --headless --firefox -- --test build --target wasm32-unknown-unknown --release --features 'mock-database'" + "test:rust": "cd crate && wasm-pack test --headless --firefox -- --test build --target wasm32-unknown-unknown --release --features 'mock-database'" }, "exports": { "./*": "./src/*.ts" diff --git a/turbo.json b/turbo.json index 43757ac2a9..aeea25a2d6 100644 --- a/turbo.json +++ b/turbo.json @@ -3,59 +3,68 @@ "globalDependencies": ["**/.env.*local"], "globalEnv": ["NODE_ENV", "MODE"], "pipeline": { + "//#clean:vitest-mjs": { + "cache": false + }, + "//#format:prettier": { + "cache": false + }, + "//#format:syncpack": { + "cache": false + }, + "//#lint:prettier": { + "cache": false + }, + "//#lint:syncpack": { + "cache": false + }, "build": { + "dependsOn": ["compile", "^build"], "dotEnv": [".env"], "env": ["PRAX", "IDB_VERSION", "CHAIN_ID", "MINIFRONT_URL"], - "dependsOn": ["compile", "^build"], "outputs": ["dist/**"] }, + "clean": { + "cache": false, + "dependsOn": ["//#clean:vitest-mjs"] + }, "compile": { "inputs": ["crate/src/**", "crate/Cargo.toml", "crate/Cargo.lock"], "outputs": ["wasm/**"] }, - "host": { - "dependsOn": ["^build"], + "dev": { "cache": false, + "dependsOn": ["build"], "persistent": true }, - "lint": { - "dependsOn": ["compile", "//#lint:syncpack"] - }, - "dev": { - "dotEnv": [".env"], - "env": ["PRAX", "IDB_VERSION", "CHAIN_ID", "MINIFRONT_URL"], - "dependsOn": ["^build"], - "outputs": ["dist/**"], - "persistent": true, - "cache": false - }, - "test": { - "dependsOn": ["compile", "//#playwright-install"], - "cache": false + "format": { + "cache": false, + "dependsOn": ["//#format:syncpack", "//#format:prettier", "format:rust"] }, - "test:rust": { + "format:rust": { "dependsOn": ["compile"], "inputs": ["crate/src/**", "crate/Cargo.toml", "crate/Cargo.lock", "crate/tests/**"] }, + "host": { + "cache": false, + "dependsOn": ["build"], + "persistent": true + }, + "lint": { + "dependsOn": ["//#lint:syncpack", "//#lint:prettier", "compile"], + "inputs": ["**/*.ts", "**/*.tsx", "wasm/index*.ts", "package.json"] + }, "lint:rust": { "dependsOn": ["compile"], "inputs": ["crate/src/**", "crate/Cargo.toml", "crate/Cargo.lock", "crate/tests/**"] }, - "format-check:rust": { + "test": { + "cache": false, "dependsOn": ["compile"] }, - "//#clean:vitest-mjs": { - "cache": false - }, - "//#lint:syncpack": { - "cache": false - }, - "//#playwright-install": { - "cache": false - }, - "clean": { - "dependsOn": ["//#clean:vitest-mjs"], - "cache": false + "test:rust": { + "dependsOn": ["compile"], + "inputs": ["crate/src/**", "crate/Cargo.toml", "crate/Cargo.lock", "crate/tests/**"] } } }