Skip to content

Use npm to manage Markdown tool dependencies #783

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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .ecrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"^\\.git[/\\\\]",
"__pycache__[/\\\\]",
"^LICENSE\\.txt$",
"node_modules[/\\\\]",
"^poetry\\.lock$",
"^\\.licenses[/\\\\]",
"^internal/rule/schema/schemadata/bindata.go$",
Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/check-markdown-task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ name: Check Markdown
env:
# See: https://github.com/actions/setup-go/tree/main#supported-version-syntax
GO_VERSION: "1.17"
# See: https://github.com/actions/setup-node/#readme
NODE_VERSION: 20.x

# See: https://docs.github.com/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows
on:
Expand All @@ -12,6 +14,8 @@ on:
paths:
- ".github/workflows/check-markdown-task.ya?ml"
- ".markdown-link-check.json"
- "package.json"
- "package-lock.json"
- "Taskfile.ya?ml"
- "**/.markdownlint*"
- "**.mdx?"
Expand All @@ -22,6 +26,8 @@ on:
paths:
- ".github/workflows/check-markdown-task.ya?ml"
- ".markdown-link-check.json"
- "package.json"
- "package-lock.json"
- "Taskfile.ya?ml"
- "**/.markdownlint*"
- "**.mdx?"
Expand Down Expand Up @@ -70,6 +76,11 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}

- name: Initialize markdownlint-cli problem matcher
uses: xt0rted/markdownlint-problem-matcher@v3

Expand Down Expand Up @@ -98,6 +109,11 @@ jobs:
with:
go-version: ${{ env.GO_VERSION }}

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}

- name: Install Task
uses: arduino/setup-task@v2
with:
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
arduino-lint.exe
__pycache__/

# Generated files
node_modules/

# Test artifacts
coverage_unit.txt

Expand Down
1 change: 1 addition & 0 deletions .markdownlintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-markdown/.markdownlintignore
.licenses/
__pycache__/
node_modules/
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
# Generated files
/.licenses/
__pycache__/
node_modules/

# Test files
/internal/rule/schema/testdata/input/invalid-schema.json
Expand Down
15 changes: 15 additions & 0 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ tasks:
desc: Check for broken links
deps:
- task: docs:generate
- task: npm:install-deps
cmds:
- |
if [[ "{{.OS}}" == "Windows_NT" ]]; then
Expand Down Expand Up @@ -361,15 +362,29 @@ tasks:
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-markdown-task/Taskfile.yml
markdown:fix:
desc: Automatically correct linting violations in Markdown files where possible
deps:
- task: npm:install-deps
cmds:
- npx markdownlint-cli --fix "**/*.md"

# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-markdown-task/Taskfile.yml
markdown:lint:
desc: Check for problems in Markdown files
deps:
- task: npm:install-deps
cmds:
- npx markdownlint-cli "**/*.md"

# Parameter variables:
# - PROJECT_PATH: path of the npm-managed project. Default value: "./"
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/npm-task/Taskfile.yml
npm:install-deps:
desc: Install dependencies managed by npm
dir: |
"{{default "./" .PROJECT_PATH}}"
cmds:
- npm install

# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/poetry-task/Taskfile.yml
poetry:install-deps:
desc: Install dependencies managed by Poetry
Expand Down
3 changes: 3 additions & 0 deletions docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ If you want to run integration tests or work on documentation, you will also nee

- A working [Python](https://www.python.org/downloads/) environment, version 3.9 or later.
- [Poetry](https://python-poetry.org/docs/).
- [**Node.js** / **npm**](https://nodejs.org/en/download/) - Node.js dependencies management tool.
- **ⓘ** [**nvm**](https://github.com/nvm-sh/nvm#installing-and-updating) is recommended if you want to manage multiple
installations of **Node.js** on your system.

### Building the source code

Expand Down
Loading
Loading