Skip to content

Make default npm project path configurable via taskfile variable #616

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 2 commits into from
Jun 21, 2025
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
23 changes: 18 additions & 5 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ vars:
CLANG_FORMAT_GOLDEN_TEST_DATA_FOLDER: "{{.CLANG_FORMAT_TEST_DATA_FOLDER}}/golden"
# See: https://github.com/arduino/arduino-ide/blob/main/arduino-ide-extension/package.json
DEFAULT_CLANG_FORMAT_VERSION: 14.0.0
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/npm-task/Taskfile.yml
# Path of the project's primary npm-managed project:
DEFAULT_NPM_PROJECT_PATH: ./

tasks:
check:
Expand Down Expand Up @@ -91,6 +94,8 @@ tasks:
TEMPLATE_WORKFLOWS_DATA_PATH: "./workflow-templates/*.{yml,yaml}"
deps:
- task: npm:install-deps
vars:
PROJECT_PATH: ./
cmds:
- |
wget \
Expand Down Expand Up @@ -571,6 +576,8 @@ tasks:
desc: Format all supported files with Prettier
deps:
- task: npm:install-deps
vars:
PROJECT_PATH: ./
cmds:
- npx prettier --write .

Expand Down Expand Up @@ -684,6 +691,8 @@ tasks:
deps:
- task: docs:generate
- task: npm:install-deps
vars:
PROJECT_PATH: ./
cmds:
- |
npx \
Expand All @@ -695,6 +704,8 @@ tasks:
desc: Automatically correct linting violations in Markdown files where possible
deps:
- task: npm:install-deps
vars:
PROJECT_PATH: ./
cmds:
- npx markdownlint-cli --fix "**/*.md"

Expand All @@ -703,6 +714,8 @@ tasks:
desc: Check for problems in Markdown files
deps:
- task: npm:install-deps
vars:
PROJECT_PATH: ./
cmds:
- npx markdownlint-cli "**/*.md"

Expand Down Expand Up @@ -735,10 +748,10 @@ tasks:
desc: |
Install dependencies managed by npm.
Environment variable parameters:
- PROJECT_PATH: Path of the npm-managed project (default: "./").
- PROJECT_PATH: Path of the npm-managed project (default: {{.DEFAULT_NPM_PROJECT_PATH}}).
run: when_changed
dir: |
"{{default "./" .PROJECT_PATH}}"
"{{default .DEFAULT_NPM_PROJECT_PATH .PROJECT_PATH}}"
cmds:
- npm install

Expand All @@ -749,7 +762,7 @@ tasks:
Environment variable parameters:
- PROJECT_PATH: Path of the npm-managed project (default: {{.DEFAULT_NPM_PROJECT_PATH}}).
dir: |
"{{default "./" .PROJECT_PATH}}"
"{{default .DEFAULT_NPM_PROJECT_PATH .PROJECT_PATH}}"
cmds:
- |
npm \
Expand All @@ -762,7 +775,7 @@ tasks:
desc: |
Validate npm configuration files against their JSON schema.
Environment variable parameters:
- PROJECT_PATH: Path of the npm-managed project (default: "./").
- PROJECT_PATH: Path of the npm-managed project (default: {{.DEFAULT_NPM_PROJECT_PATH}}).
deps:
- task: npm:install-deps
vars:
Expand Down Expand Up @@ -807,7 +820,7 @@ tasks:
STYLELINTRC_SCHEMA_PATH:
sh: task utility:mktemp-file TEMPLATE="stylelintrc-schema-XXXXXXXXXX.json"
INSTANCE_PATH: >-
{{default "." .PROJECT_PATH}}/package.json
{{default .DEFAULT_NPM_PROJECT_PATH .PROJECT_PATH}}/package.json
cmds:
- wget --quiet --output-document="{{.SCHEMA_PATH}}" {{.SCHEMA_URL}}
- wget --quiet --output-document="{{.AVA_SCHEMA_PATH}}" {{.AVA_SCHEMA_URL}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ tasks:
sh: task utility:mktemp-file TEMPLATE="github-action-schema-XXXXXXXXXX.json"
deps:
- task: npm:install-deps
vars:
PROJECT_PATH: ./
cmds:
- |
wget \
Expand Down
6 changes: 6 additions & 0 deletions workflow-templates/assets/check-markdown-task/Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ tasks:
deps:
- task: docs:generate
- task: npm:install-deps
vars:
PROJECT_PATH: ./
cmds:
- |
npx \
Expand All @@ -50,6 +52,8 @@ tasks:
desc: Automatically correct linting violations in Markdown files where possible
deps:
- task: npm:install-deps
vars:
PROJECT_PATH: ./
cmds:
- npx markdownlint-cli --fix "**/*.md"

Expand All @@ -58,5 +62,7 @@ tasks:
desc: Check for problems in Markdown files
deps:
- task: npm:install-deps
vars:
PROJECT_PATH: ./
cmds:
- npx markdownlint-cli "**/*.md"
8 changes: 4 additions & 4 deletions workflow-templates/assets/check-npm-task/Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ tasks:
desc: |
Fix problems with the npm configuration file.
Environment variable parameters:
- PROJECT_PATH: Path of the npm-managed project (default: ./).
- PROJECT_PATH: Path of the npm-managed project (default: {{.DEFAULT_NPM_PROJECT_PATH}}).
dir: |
"{{default "./" .PROJECT_PATH}}"
"{{default .DEFAULT_NPM_PROJECT_PATH .PROJECT_PATH}}"
cmds:
- |
npm \
Expand All @@ -22,7 +22,7 @@ tasks:
desc: |
Validate npm configuration files against their JSON schema.
Environment variable parameters:
- PROJECT_PATH: Path of the npm-managed project (default: "./").
- PROJECT_PATH: Path of the npm-managed project (default: {{.DEFAULT_NPM_PROJECT_PATH}}).
deps:
- task: npm:install-deps
vars:
Expand Down Expand Up @@ -67,7 +67,7 @@ tasks:
STYLELINTRC_SCHEMA_PATH:
sh: task utility:mktemp-file TEMPLATE="stylelintrc-schema-XXXXXXXXXX.json"
INSTANCE_PATH: >-
{{default "." .PROJECT_PATH}}/package.json
{{default .DEFAULT_NPM_PROJECT_PATH .PROJECT_PATH}}/package.json
cmds:
- wget --quiet --output-document="{{.SCHEMA_PATH}}" {{.SCHEMA_URL}}
- wget --quiet --output-document="{{.AVA_SCHEMA_PATH}}" {{.AVA_SCHEMA_URL}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@ tasks:
desc: Format all supported files with Prettier
deps:
- task: npm:install-deps
vars:
PROJECT_PATH: ./
cmds:
- npx prettier --write .
2 changes: 2 additions & 0 deletions workflow-templates/assets/check-toc-task/Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ tasks:
- FILE_PATH: path to the file that contains the ToC.
deps:
- task: npm:install-deps
vars:
PROJECT_PATH: ./
cmds:
- |
npx markdown-toc \
Expand Down
2 changes: 2 additions & 0 deletions workflow-templates/assets/check-workflows-task/Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ tasks:
WORKFLOWS_DATA_PATH: "./.github/workflows/*.{yml,yaml}"
deps:
- task: npm:install-deps
vars:
PROJECT_PATH: ./
cmds:
- |
wget \
Expand Down
9 changes: 7 additions & 2 deletions workflow-templates/assets/npm-task/Taskfile.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
# See: https://taskfile.dev/#/usage
version: "3"

vars:
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/npm-task/Taskfile.yml
# Path of the project's primary npm-managed project:
DEFAULT_NPM_PROJECT_PATH: ./

tasks:
# 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.
Environment variable parameters:
- PROJECT_PATH: Path of the npm-managed project (default: "./").
- PROJECT_PATH: Path of the npm-managed project (default: {{.DEFAULT_NPM_PROJECT_PATH}}).
run: when_changed
dir: |
"{{default "./" .PROJECT_PATH}}"
"{{default .DEFAULT_NPM_PROJECT_PATH .PROJECT_PATH}}"
cmds:
- npm install
6 changes: 5 additions & 1 deletion workflow-templates/assets/test-go-task/Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ vars:
tasks:
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/test-go-task/Taskfile.yml
go:test:
desc: Run unit tests
desc: |
Run unit tests.
Environment variable parameters:
- GO_MODULE_PATH: Path of the Go module root (default: {{.DEFAULT_GO_MODULE_PATH}}).
- GO_PACKAGES: List of Go packages to test (default: all packages of the module).
dir: "{{default .DEFAULT_GO_MODULE_PATH .GO_MODULE_PATH}}"
cmds:
- |
Expand Down
Loading