Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃彈馃敡锛歱olish off the tasking with prettify #483

Closed
wants to merge 8 commits into from
Closed
38 changes: 29 additions & 9 deletions .github/workflows/lint-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
9 changes: 5 additions & 4 deletions build/tasks/format/format-md.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
121 changes: 104 additions & 17 deletions moon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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'
Expand Down Expand Up @@ -135,19 +167,36 @@ 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:
- '**/*.html'
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'
Expand All @@ -157,33 +206,65 @@ 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
outputs:
- '**/*.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'
Expand All @@ -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'
Expand Down