5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-01 07:51:28 +08:00

chore: add Prettier as format tool (#2689)

This commit is contained in:
Misite Bao 2023-05-30 05:40:54 +08:00 committed by GitHub
parent 84919468ba
commit d3a4d89786
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 141 additions and 8 deletions

View File

@ -0,0 +1,37 @@
name: Format Markdown Files
on:
workflow_dispatch:
push:
branches: [master]
jobs:
format_markdown_files:
runs-on: ubuntu-latest
if: github.repository == 'wailsapp/wails'
steps:
- uses: actions/checkout@v3
- name: Setup Nodejs
uses: actions/setup-node@v2
with:
node-version: 18.x
- name: Install Task
uses: arduino/setup-task@v1
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Format All Markdown Files
run: task format-all-md
- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
with:
commit-message: "docs: format document"
title: "docs: format document"
body: "- [x] Format all Markdown(x) documents"
branch: chore/format-markdown-files
delete-branch: true
draft: false

3
.prettierignore Normal file
View File

@ -0,0 +1,3 @@
website
v2
v3

6
.prettierrc.yml Normal file
View File

@ -0,0 +1,6 @@
overrides:
- files:
- "**/*.md"
options:
printWidth: 80
proseWrap: always

View File

@ -2,8 +2,19 @@
version: "3"
vars:
GREETING: Hello, World!
includes:
website:
taskfile: website
dir: website
v2:
taskfile: v2
dir: v2
optional: true
v3:
taskfile: v3
dir: v3
optional: true
tasks:
contributors:check:
@ -18,7 +29,19 @@ tasks:
cmds:
- npx -y all-contributors-cli generate
release:
dir: v2/tools/release
format:md:
cmds:
- go run release.go {{.CLI_ARGS}}
- npx prettier --write "**/*.md"
format:
cmds:
- task: format:md
format-all-md:
cmds:
- task: format:md
- task: website:format:md
- task: v2:format:md
# - task: v2:website:format
- task: v3:format:md
# - task: v3:website:format:md

1
v2/.prettierignore Normal file
View File

@ -0,0 +1 @@
website

6
v2/.prettierrc.yml Normal file
View File

@ -0,0 +1,6 @@
overrides:
- files:
- "**/*.md"
options:
printWidth: 80
proseWrap: always

17
v2/Taskfile.yaml Normal file
View File

@ -0,0 +1,17 @@
# https://taskfile.dev
version: "3"
tasks:
release:
dir: tools/release
cmds:
- go run release.go {{.CLI_ARGS}}
format:md:
cmds:
- npx prettier --write "**/*.md"
format:
cmds:
- task: format:md

1
v3/.prettierignore Normal file
View File

@ -0,0 +1 @@
website

6
v3/.prettierrc.yml Normal file
View File

@ -0,0 +1,6 @@
overrides:
- files:
- "**/*.md"
options:
printWidth: 80
proseWrap: always

View File

@ -1,9 +1,14 @@
# https://taskfile.dev
version: '3'
version: "3"
includes:
website:
taskfile: ./website
dir: ./website
optional: true
tasks:
build-runtime-debug:
dir: internal/runtime
internal: true
@ -78,7 +83,6 @@ tasks:
cmds:
- npm install
install-runtime-deps:
dir: internal/runtime
internal: true
@ -200,3 +204,11 @@ tasks:
cmds:
- task: reinstall-cli
- echo "Generated templates"
format:md:
cmds:
- npx prettier --write "**/*.md"
format:
cmds:
- task: format:md

2
website/.prettierignore Normal file
View File

@ -0,0 +1,2 @@
i18n
versioned_docs

View File

@ -45,3 +45,11 @@ tasks:
deps: [install]
cmds:
- npx crowdin pull -b v2 --export-only-approved
format:md:
cmds:
- npx prettier --write "**/*.{md,mdx}"
format:
cmds:
- task: format:md

View File

@ -0,0 +1,11 @@
module.exports = {
overrides: [
{
files: "**/*.{md,mdx}",
options: {
printWidth: 80,
proseWrap: "always",
},
},
],
};