Skip to content

Commit 32fbff1

Browse files
authored
Merge pull request #783 from per1234/check-markdown-npm
Use npm to manage Markdown tool dependencies
2 parents 62191be + 51b3eac commit 32fbff1

9 files changed

+1679
-0
lines changed

.ecrc

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"^\\.git[/\\\\]",
44
"__pycache__[/\\\\]",
55
"^LICENSE\\.txt$",
6+
"node_modules[/\\\\]",
67
"^poetry\\.lock$",
78
"^\\.licenses[/\\\\]",
89
"^internal/rule/schema/schemadata/bindata.go$",

.github/workflows/check-markdown-task.yml

+16
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ name: Check Markdown
44
env:
55
# See: https://github.com/actions/setup-go/tree/main#supported-version-syntax
66
GO_VERSION: "1.17"
7+
# See: https://github.com/actions/setup-node/#readme
8+
NODE_VERSION: 20.x
79

810
# See: https://docs.github.com/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows
911
on:
@@ -12,6 +14,8 @@ on:
1214
paths:
1315
- ".github/workflows/check-markdown-task.ya?ml"
1416
- ".markdown-link-check.json"
17+
- "package.json"
18+
- "package-lock.json"
1519
- "Taskfile.ya?ml"
1620
- "**/.markdownlint*"
1721
- "**.mdx?"
@@ -22,6 +26,8 @@ on:
2226
paths:
2327
- ".github/workflows/check-markdown-task.ya?ml"
2428
- ".markdown-link-check.json"
29+
- "package.json"
30+
- "package-lock.json"
2531
- "Taskfile.ya?ml"
2632
- "**/.markdownlint*"
2733
- "**.mdx?"
@@ -70,6 +76,11 @@ jobs:
7076
- name: Checkout repository
7177
uses: actions/checkout@v4
7278

79+
- name: Setup Node.js
80+
uses: actions/setup-node@v4
81+
with:
82+
node-version: ${{ env.NODE_VERSION }}
83+
7384
- name: Initialize markdownlint-cli problem matcher
7485
uses: xt0rted/markdownlint-problem-matcher@v3
7586

@@ -98,6 +109,11 @@ jobs:
98109
with:
99110
go-version: ${{ env.GO_VERSION }}
100111

112+
- name: Setup Node.js
113+
uses: actions/setup-node@v4
114+
with:
115+
node-version: ${{ env.NODE_VERSION }}
116+
101117
- name: Install Task
102118
uses: arduino/setup-task@v2
103119
with:

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
arduino-lint.exe
44
__pycache__/
55

6+
# Generated files
7+
node_modules/
8+
69
# Test artifacts
710
coverage_unit.txt
811

.markdownlintignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-markdown/.markdownlintignore
22
.licenses/
33
__pycache__/
4+
node_modules/

.prettierignore

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
# Generated files
88
/.licenses/
99
__pycache__/
10+
node_modules/
1011

1112
# Test files
1213
/internal/rule/schema/testdata/input/invalid-schema.json

Taskfile.yml

+15
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,7 @@ tasks:
320320
desc: Check for broken links
321321
deps:
322322
- task: docs:generate
323+
- task: npm:install-deps
323324
cmds:
324325
- |
325326
if [[ "{{.OS}}" == "Windows_NT" ]]; then
@@ -361,15 +362,29 @@ tasks:
361362
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-markdown-task/Taskfile.yml
362363
markdown:fix:
363364
desc: Automatically correct linting violations in Markdown files where possible
365+
deps:
366+
- task: npm:install-deps
364367
cmds:
365368
- npx markdownlint-cli --fix "**/*.md"
366369

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

378+
# Parameter variables:
379+
# - PROJECT_PATH: path of the npm-managed project. Default value: "./"
380+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/npm-task/Taskfile.yml
381+
npm:install-deps:
382+
desc: Install dependencies managed by npm
383+
dir: |
384+
"{{default "./" .PROJECT_PATH}}"
385+
cmds:
386+
- npm install
387+
373388
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/poetry-task/Taskfile.yml
374389
poetry:install-deps:
375390
desc: Install dependencies managed by Poetry

docs/CONTRIBUTING.md

+3
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ If you want to run integration tests or work on documentation, you will also nee
8383

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

8790
### Building the source code
8891

0 commit comments

Comments
 (0)