diff --git a/.github/workflows/lint-and-test.yml b/.github/workflows/lint-and-test.yml index 14d74730..810bb97a 100644 --- a/.github/workflows/lint-and-test.yml +++ b/.github/workflows/lint-and-test.yml @@ -54,39 +54,59 @@ jobs: - name: Verify CSS if: ${{ steps.filter.outputs.css == 'true' }} - run: pnpm exec nps verify.css + - name: Verify CSS + if: ${{ steps.filter.outputs.css == 'true' }} + run: pnpm exec moon verify.css - name: Verify JavaScript if: ${{ steps.filter.outputs.js == 'true' }} - run: pnpm exec nps verify.js + - name: Verify JavaScript + if: ${{ steps.filter.outputs.js == 'true' }} + run: pnpm exec moon verify.js - name: Verify JSON if: ${{ steps.filter.outputs.json == 'true' }} - run: pnpm exec nps verify.json + - name: Verify JSON + if: ${{ steps.filter.outputs.json == 'true' }} + run: pnpm exec moon verify.json - name: Verify Markdown if: ${{ steps.filter.outputs.md == 'true' }} - run: pnpm exec nps verify.md + - name: Verify Markdown + if: ${{ steps.filter.outputs.md == 'true' }} + run: pnpm exec moon verify.md - name: Verify SVG if: ${{ steps.filter.outputs.svg == 'true' }} - run: pnpm exec nps verify.svg + - name: Verify SVG + if: ${{ steps.filter.outputs.svg == 'true' }} + run: pnpm exec moon verify.svg - name: Verify TOML if: ${{ steps.filter.outputs.toml == 'true' }} - run: pnpm exec nps verify.toml + - name: Verify TOML + if: ${{ steps.filter.outputs.toml == 'true' }} + run: pnpm exec moon verify.toml - name: Verify TypeScript if: ${{ steps.filter.outputs.ts == 'true' }} - run: pnpm exec nps verify.ts + - name: Verify TypeScript + if: ${{ steps.filter.outputs.ts == 'true' }} + run: pnpm exec moon verify.ts - name: Verify YAML if: ${{ steps.filter.outputs.yaml == 'true' }} - run: pnpm exec nps verify.yaml + - name: Verify YAML + if: ${{ steps.filter.outputs.yaml == 'true' }} + run: pnpm exec moon verify.yaml # Only run tests if the PR touches behavior-related files. - name: Test if: ${{ steps.filter.outputs.js == 'true' || steps.filter.outputs.json == 'true' || steps.filter.outputs.ts == 'true' }} - run: pnpm test + - name: Test + if: ${{ steps.filter.outputs.js == 'true' || + steps.filter.outputs.json == 'true' || + steps.filter.outputs.ts == 'true' }} + run: pnpm exec moon test diff --git a/build/tasks/format/format-md.mjs b/build/tasks/format/format-md.mjs index 33b40b97..51fe6b11 100644 --- a/build/tasks/format/format-md.mjs +++ b/build/tasks/format/format-md.mjs @@ -12,17 +12,18 @@ const MarkdownFiles = JSON.parse(MarkdownObject.stdout); let exitCode = 0; const scripts = [ // fix style of JS/TS code blocks in Markdown - `eslint --fix ${MarkdownFiles.join(' ')}`, - 'prettier --write **/*{.*.md,.md}', // Markdown fix sty;e + `moon run eslint --fix ${MarkdownFiles.join(' ')}`, + 'moon run prettier --write **/*{.*.md,.md}', // Markdown fix style // validate Markdown - 'markdownlint-cli2-fix "**/**.md" "#node_modules" "#vendor"', + 'moon run markdownlint-cli2-fix "**/**.md" "#node_modules" "#vendor"', ]; for await (const element of scripts) { try { - exitCode = await execute(`pnpm exec ${element}`); + exitCode = await execute(`moon exec ${element}`); } catch (p) { exitCode = p.exitCode; } + } process.exitCode = exitCode > 0 ? exitCode : 0; } diff --git a/moon.yml b/moon.yml index 0e9832e2..ac16f397 100644 --- a/moon.yml +++ b/moon.yml @@ -50,40 +50,66 @@ tasks: runDepsInParallel: true mergeInputs: append verify-css: - command: node build/tasks/verify/verify-css.mjs + command: moon run verify.css + inputs: + - '**/*.css' inputs: - '**/*.css' verify-html: - command: node build/tasks/verify/verify-html.mjs + command: moon run verify.html + inputs: + - '**/*.html' inputs: - '**/*.html' verify-js: - command: node build/tasks/verify/verify-js.mjs + command: moon run verify.js + inputs: + - '**/*.js' + - '**/*.cjs' + - '**/*.mjs' inputs: - '**/*.js' - '**/*.cjs' - '**/*.mjs' verify-json: - command: node build/tasks/verify/verify-json.mjs + command: moon run verify.json + inputs: + - '**/*.json' + - '**/*.json5' + - '**/*.jsonc' inputs: - '**/*.json' - '**/*.json5' - '**/*.jsonc' verify-md: - command: node build/tasks/verify/verify-md.mjs + command: moon run verify.md + inputs: + - '**/*.md' inputs: - '**/*.md' verify-svg: - command: node build/tasks/verify/verify-svg.mjs + command: moon run verify.svg + inputs: + - '**/*.svg' inputs: - '**/*.svg' verify-toml: - command: node build/tasks/verify/verify-toml.mjs + command: moon run verify.toml + inputs: + - '**/*.tml' + - '**/*.toml' inputs: - '**/*.tml' - '**/*.toml' verify-ts: - command: node build/tasks/verify/verify-ts.mjs + command: moon run verify.ts + inputs: + - '**/*.ts' + - '**/*.cts' + - '**/*.mts' + - '**/*.d.ts' + - '**/*.d.cts' + - '**/*.d.mts' inputs: - '**/*.ts' - '**/*.cts' @@ -92,7 +118,13 @@ tasks: - '**/*.d.cts' - '**/*.d.mts' verify-yaml: - command: node build/tasks/verify/verify-yaml.mjs + command: moon run verify.yaml + inputs: + - '**/*.yaml' + - '**/*.yml' + outputs: + - '**/*.yaml' + - '**/*.yml' inputs: - '**/*.yaml' - '**/*.yml' @@ -135,11 +167,20 @@ tasks: runDepsInParallel: true mergeInputs: append format-css: - command: node build/tasks/format/format-css.mjs + command: moon run format.css inputs: - '**/*.css' outputs: - '**/*.css' + inputs: + - '**/*.css' + outputs: + format-html: + command: moon run format.html + inputs: + - '**/*.html' + outputs: + - '**/*.html' format-html: command: node build/tasks/format/format-html.mjs inputs: @@ -147,7 +188,15 @@ tasks: outputs: - '**/*.html' format-js: - command: node build/tasks/format/format-js.mjs + command: moon run format.js + inputs: + - '**/*.js' + - '**/*.cjs' + - '**/*.mjs' + outputs: + - '**/*.js' + - '**/*.cjs' + - '**/*.mjs' inputs: - '**/*.js' - '**/*.cjs' @@ -157,7 +206,13 @@ tasks: - '**/*.cjs' - '**/*.mjs' format-json: - command: node build/tasks/format/format-json.mjs + command: moon run format.json + inputs: + - '**/*.json' + - OWNERS + outputs: + - '**/*.json' + - OWNERS inputs: - '**/*.json' - OWNERS @@ -165,25 +220,51 @@ tasks: - '**/*.json' - OWNERS format-md: - command: node build/tasks/format/format-md.mjs + command: moon run format.md + inputs: + - '**/*.md' + outputs: + - '**/*.md' inputs: - '**/*.md' outputs: - '**/*.md' format-svg: - command: node build/tasks/format/format-svg.mjs + command: moon run format.svg + inputs: + - '**/*.svg' + outputs: + - '**/*.svg' inputs: - '**/*.svg' outputs: - '**/*.svg' format-toml: - command: node build/tasks/format/format-toml.mjs + command: moon run format.toml + inputs: + - .deepsource.toml + outputs: + - .deepsource.toml inputs: - .deepsource.toml outputs: - .deepsource.toml format-ts: - command: node build/tasks/format/format-ts.mjs + command: moon run format.ts + inputs: + - '**/*.ts' + - '**/*.cts' + - '**/*.mts' + - '**/*.d.ts' + - '**/*.d.cts' + - '**/*.d.mts' + outputs: + - '**/*.ts' + - '**/*.cts' + - '**/*.mts' + - '**/*.d.ts' + - '**/*.d.cts' + - '**/*.d.mts' inputs: - '**/*.ts' - '**/*.cts' @@ -199,7 +280,13 @@ tasks: - '**/*.d.cts' - '**/*.d.mts' format-yaml: - command: node build/tasks/format/format-yaml.mjs + command: moon run format.yaml + inputs: + - '**/*.yaml' + - '**/*.yml' + outputs: + - '**/*.yaml' + - '**/*.yml' inputs: - '**/*.yaml' - '**/*.yml'