Skip to content

Commit 2fbcacf

Browse files
committed
Configure npm to enforce standard project Node.js version
Various templates use npm package-based tools. The templates are validated for use with a specific major version series of Node.js. Use of a different major version of Node.js by a contributor may result in spurious problems or unwanted results. For this reason, it will be useful to configure npm to produce an error if the contributor uses an unsupported version of Node.js.
1 parent 8c6d50a commit 2fbcacf

32 files changed

+73
-0
lines changed

.github/workflows/check-clang-format.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
- "other/clang-format-configuration/scripts/convert-clang-format-configuration.js"
99
- "other/clang-format-configuration/testdata/**"
1010
- "other/clang-format-configuration/.clang-format"
11+
- ".npmrc"
1112
- "package.json"
1213
- "package-lock.json"
1314
- "Taskfile.ya?ml"
@@ -17,6 +18,7 @@ on:
1718
- "other/clang-format-configuration/scripts/convert-clang-format-configuration.js"
1819
- "other/clang-format-configuration/testdata/**"
1920
- "other/clang-format-configuration/.clang-format"
21+
- ".npmrc"
2022
- "package.json"
2123
- "package-lock.json"
2224
- "Taskfile.ya?ml"

.github/workflows/check-eslint.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@ on:
66
paths:
77
- ".github/workflows/check-eslint.yml"
88
- "workflow-templates/assets/check-javascript/.eslintrc.yml"
9+
- ".npmrc"
910
- "package.json"
1011
- "package-lock.json"
1112
- "Taskfile.ya?ml"
1213
pull_request:
1314
paths:
1415
- ".github/workflows/check-eslint.yml"
1516
- "workflow-templates/assets/check-javascript/.eslintrc.yml"
17+
- ".npmrc"
1618
- "package.json"
1719
- "package-lock.json"
1820
- "Taskfile.ya?ml"

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ on:
99
- ".github/workflows/check-javascript-task.ya?ml"
1010
- ".eslintignore"
1111
- "**/.eslintrc*"
12+
- ".npmrc"
1213
- "package.json"
1314
- "package-lock.json"
1415
- "Taskfile.ya?ml"
@@ -18,6 +19,7 @@ on:
1819
- ".github/workflows/check-javascript-task.ya?ml"
1920
- ".eslintignore"
2021
- "**/.eslintrc*"
22+
- ".npmrc"
2123
- "package.json"
2224
- "package-lock.json"
2325
- "Taskfile.ya?ml"

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
paths:
99
- ".github/workflows/check-markdown-task.ya?ml"
1010
- ".markdown-link-check.json"
11+
- ".npmrc"
1112
- "package.json"
1213
- "package-lock.json"
1314
- "Taskfile.ya?ml"
@@ -20,6 +21,7 @@ on:
2021
paths:
2122
- ".github/workflows/check-markdown-task.ya?ml"
2223
- ".markdown-link-check.json"
24+
- ".npmrc"
2325
- "package.json"
2426
- "package-lock.json"
2527
- "Taskfile.ya?ml"

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@ on:
77
push:
88
paths:
99
- ".github/workflows/check-npm-task.ya?ml"
10+
- "**/.npmrc"
1011
- "**/package.json"
1112
- "**/package-lock.json"
1213
- "Taskfile.ya?ml"
1314
pull_request:
1415
paths:
1516
- ".github/workflows/check-npm-task.ya?ml"
17+
- "**/.npmrc"
1618
- "**/package.json"
1719
- "**/package-lock.json"
1820
- "Taskfile.ya?ml"

.github/workflows/check-prettier-formatting-task.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
push:
88
paths:
99
- ".github/workflows/check-prettier-formatting-task.ya?ml"
10+
- ".npmrc"
1011
- "Taskfile.ya?ml"
1112
- "**/.prettierignore"
1213
- "**/.prettierrc*"
@@ -103,6 +104,7 @@ on:
103104
pull_request:
104105
paths:
105106
- ".github/workflows/check-prettier-formatting-task.ya?ml"
107+
- ".npmrc"
106108
- "Taskfile.ya?ml"
107109
- "**/.prettierignore"
108110
- "**/.prettierrc*"

.github/workflows/check-taskfiles.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@ on:
77
push:
88
paths:
99
- ".github/workflows/check-taskfiles.ya?ml"
10+
- ".npmrc"
1011
- "package.json"
1112
- "package-lock.json"
1213
- "**/Taskfile.ya?ml"
1314
pull_request:
1415
paths:
1516
- ".github/workflows/check-taskfiles.ya?ml"
17+
- ".npmrc"
1618
- "package.json"
1719
- "package-lock.json"
1820
- "**/Taskfile.ya?ml"

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@ on:
66
push:
77
paths:
88
- ".github/workflows/*.ya?ml"
9+
- ".npmrc"
910
- "Taskfile.ya?ml"
1011
- "workflow-templates/*.ya?ml"
1112
pull_request:
1213
paths:
1314
- ".github/workflows/*.ya?ml"
15+
- ".npmrc"
1416
- "Taskfile.ya?ml"
1517
- "workflow-templates/*.ya?ml"
1618
schedule:

.github/workflows/sync-labels-npm.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@ on:
77
paths:
88
- ".github/workflows/sync-labels-npm.ya?ml"
99
- ".github/label-configuration-files/*.ya?ml"
10+
- ".npmrc"
1011
- "package.json"
1112
- "package-lock.json"
1213
pull_request:
1314
paths:
1415
- ".github/workflows/sync-labels-npm.ya?ml"
1516
- ".github/label-configuration-files/*.ya?ml"
17+
- ".npmrc"
1618
- "package.json"
1719
- "package-lock.json"
1820
schedule:

.npmrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/npm/.npmrc
2+
# See: https://docs.npmjs.com/cli/configuring-npm/npmrc
3+
4+
engine-strict=true

Taskfile.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,7 @@ tasks:
353353
"{{.WORKFLOW_TEMPLATE_ASSETS_PATH}}/general/.editorconfig" \
354354
"{{.WORKFLOW_TEMPLATE_ASSETS_PATH}}/check-python/.flake8" \
355355
"{{.WORKFLOW_TEMPLATE_ASSETS_PATH}}/check-markdown/.markdownlint.yml" \
356+
"{{.WORKFLOW_TEMPLATE_ASSETS_PATH}}/npm/.npmrc" \
356357
"{{.REPOSITORY_ROOT_PATH}}"
357358
358359
dependabot:validate:

workflow-templates/assets/npm/.npmrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/npm/.npmrc
2+
# See: https://docs.npmjs.com/cli/configuring-npm/npmrc
3+
4+
engine-strict=true

workflow-templates/check-action-metadata-task.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ Install the [`check-action-metadata-task.yml`](check-action-metadata-task.yml) G
1414

1515
- [`Taskfile.yml`](assets/check-action-metadata-task/Taskfile.yml) - task for validating `action.yml`
1616
- Install to: repository root (or merge into the existing `Taskfile.yml`).
17+
- [`.npmrc`](assets/npm/.npmrc) - **npm** configuration file.
18+
- Install to: repository root.
1719
- [`Taskfile.yml`](assets/npm-task/Taskfile.yml) - **npm** tasks.
1820
- Install to: repository root (or merge into the existing `Taskfile.yml`).
1921
- [`Taskfile.yml`](assets/windows-task/Taskfile.yml) - utility tasks.

workflow-templates/check-action-metadata-task.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@ on:
88
paths:
99
- ".github/workflows/check-action-metadata-task.ya?ml"
1010
- "action.ya?ml"
11+
- ".npmrc"
1112
- "package.json"
1213
- "package-lock.json"
1314
- "Taskfile.ya?ml"
1415
pull_request:
1516
paths:
1617
- ".github/workflows/check-action-metadata-task.ya?ml"
1718
- "action.ya?ml"
19+
- ".npmrc"
1820
- "package.json"
1921
- "package-lock.json"
2022
- "Taskfile.ya?ml"

workflow-templates/check-javascript-task.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ Install the [`check-javascript-task.yml`](check-javascript-task.yml) GitHub Acti
1919
- [`.eslintrc.yml`](assets/check-javascript/.eslintrc.yml) - **ESLint** configuration file.
2020
❗ The code style defined in this file is the official standardized style to be used in all Arduino projects and should not be modified.
2121
- Install to: repository root
22+
- [`.npmrc`](assets/npm/.npmrc) - **npm** configuration file.
23+
- Install to: repository root.
2224
- [`Taskfile.yml`](assets/check-javascript-task/Taskfile.yml) - JavaScript linting tasks.
2325
- Install to: repository root (or merge into the existing `Taskfile.yml`).
2426
- [`Taskfile.yml`](assets/npm-task/Taskfile.yml) - npm tasks.

workflow-templates/check-javascript-task.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ on:
99
- ".github/workflows/check-javascript-task.ya?ml"
1010
- ".eslintignore"
1111
- "**/.eslintrc*"
12+
- ".npmrc"
1213
- "package.json"
1314
- "package-lock.json"
1415
- "Taskfile.ya?ml"
@@ -18,6 +19,7 @@ on:
1819
- ".github/workflows/check-javascript-task.ya?ml"
1920
- ".eslintignore"
2021
- "**/.eslintrc*"
22+
- ".npmrc"
2123
- "package.json"
2224
- "package-lock.json"
2325
- "Taskfile.ya?ml"

workflow-templates/check-markdown-task.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ Install the [`check-markdown-task.yml`](check-markdown-task.yml) GitHub Actions
2323
- Install to: repository root
2424
- [`.markdownlintignore`](assets/check-markdown/.markdownlintignore) - markdownlint configuration file.
2525
- Install to: repository root
26+
- [`.npmrc`](assets/npm/.npmrc) - **npm** configuration file.
27+
- Install to: repository root.
2628
- [`Taskfile.yml`](assets/check-markdown-task/Taskfile.yml) - Markdown tasks.
2729
- Install to: repository root (or merge into the existing `Taskfile.yml`).
2830
- [`Taskfile.yml`](assets/npm-task/Taskfile.yml) - npm tasks.

workflow-templates/check-markdown-task.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
paths:
99
- ".github/workflows/check-markdown-task.ya?ml"
1010
- ".markdown-link-check.json"
11+
- ".npmrc"
1112
- "package.json"
1213
- "package-lock.json"
1314
- "Taskfile.ya?ml"
@@ -20,6 +21,7 @@ on:
2021
paths:
2122
- ".github/workflows/check-markdown-task.ya?ml"
2223
- ".markdown-link-check.json"
24+
- ".npmrc"
2325
- "package.json"
2426
- "package-lock.json"
2527
- "Taskfile.ya?ml"

workflow-templates/check-npm-dependencies-task.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ Install the [`check-npm-dependencies-task.yml`](check-npm-dependencies-task.yml)
1717

1818
### Assets
1919

20+
- [`.npmrc`](assets/npm/.npmrc) - **npm** configuration file.
21+
- Install to: repository root.
2022
- [`Taskfile.yml`](assets/check-dependencies-task/Taskfile.yml) - tasks to cache metadata for and check compatibility of dependency licenses.
2123
- Install to: repository root (or merge into the existing `Taskfile.yml`).
2224
- [`Taskfile.yml`](assets/check-npm-dependencies-task/Taskfile.yml) - tasks to check **npm** dependencies.

workflow-templates/check-npm-dependencies-task.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ on:
1010
- ".licenses/**"
1111
- ".licensed.json"
1212
- ".licensed.ya?ml"
13+
- ".npmrc"
1314
- "Taskfile.ya?ml"
1415
- "**/.gitmodules"
1516
- "**/package.json"
@@ -18,6 +19,7 @@ on:
1819
paths:
1920
- ".github/workflows/check-npm-dependencies-task.ya?ml"
2021
- ".licenses/**"
22+
- ".npmrc"
2123
- ".licensed.json"
2224
- ".licensed.ya?ml"
2325
- "Taskfile.ya?ml"

workflow-templates/check-npm-task.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ Install the [check-npm-task.yml](check-npm-task.yml) GitHub Actions workflow to
1212

1313
### Assets
1414

15+
- [`.npmrc`](assets/npm/.npmrc) - **npm** configuration file.
16+
- Install to: repository root.
1517
- [`Taskfile.yml`](assets/npm-task/Taskfile.yml) - npm tasks.
1618
- Install to: repository root (or merge into the existing `Taskfile.yml`).
1719
- [`Taskfile.yml`](assets/check-npm-task/Taskfile.yml) - Validation task.

workflow-templates/check-npm-task.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@ on:
77
push:
88
paths:
99
- ".github/workflows/check-npm-task.ya?ml"
10+
- "**/.npmrc"
1011
- "**/package.json"
1112
- "**/package-lock.json"
1213
- "Taskfile.ya?ml"
1314
pull_request:
1415
paths:
1516
- ".github/workflows/check-npm-task.ya?ml"
17+
- "**/.npmrc"
1618
- "**/package.json"
1719
- "**/package-lock.json"
1820
- "Taskfile.ya?ml"

workflow-templates/check-prettier-formatting-task.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ Install the [`check-prettier-formatting-task.yml`](check-prettier-formatting-tas
2020

2121
### Assets
2222

23+
- [`.npmrc`](assets/npm/.npmrc) - **npm** configuration file.
24+
- Install to: repository root.
2325
- [`Taskfile.yml`](assets/check-prettier-formatting-task/Taskfile.yml) - Formatting task.
2426
- Install to: repository root (or merge into the existing `Taskfile.yml`).
2527
- [`Taskfile.yml`](assets/npm-task/Taskfile.yml) - npm tasks.

workflow-templates/check-prettier-formatting-task.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
push:
88
paths:
99
- ".github/workflows/check-prettier-formatting-task.ya?ml"
10+
- ".npmrc"
1011
- "Taskfile.ya?ml"
1112
- "**/.prettierignore"
1213
- "**/.prettierrc*"
@@ -103,6 +104,7 @@ on:
103104
pull_request:
104105
paths:
105106
- ".github/workflows/check-prettier-formatting-task.ya?ml"
107+
- ".npmrc"
106108
- "Taskfile.ya?ml"
107109
- "**/.prettierignore"
108110
- "**/.prettierrc*"

workflow-templates/check-taskfiles.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ Validate the repository's [Taskfiles](https://taskfile.dev/#/usage) against the
88

99
Install the [`check-taskfiles.yml`](check-taskfiles.yml) GitHub Actions workflow to `.github/workflows/`
1010

11+
### Assets
12+
13+
- [`.npmrc`](assets/npm/.npmrc) - **npm** configuration file.
14+
- Install to: repository root.
15+
1116
### Dependencies
1217

1318
The tool dependencies of this workflow are managed by [npm](https://www.npmjs.com/).

workflow-templates/check-taskfiles.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@ on:
77
push:
88
paths:
99
- ".github/workflows/check-taskfiles.ya?ml"
10+
- ".npmrc"
1011
- "package.json"
1112
- "package-lock.json"
1213
- "**/Taskfile.ya?ml"
1314
pull_request:
1415
paths:
1516
- ".github/workflows/check-taskfiles.ya?ml"
17+
- ".npmrc"
1618
- "package.json"
1719
- "package-lock.json"
1820
- "**/Taskfile.ya?ml"

workflow-templates/check-toc-task.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ Install the [`check-toc-task.yml`](check-toc-task.yml) GitHub Actions workflow t
1414

1515
### Assets
1616

17+
- [`.npmrc`](assets/npm/.npmrc) - **npm** configuration file.
18+
- Install to: repository root.
1719
- [`Taskfile.yml`](assets/check-toc-task/Taskfile.yml) - Table of contents generation task.
1820
- Install to: repository root (or merge into the existing `Taskfile.yml`).
1921
- [`Taskfile.yml`](assets/npm-task/Taskfile.yml) - npm tasks.

workflow-templates/check-toc-task.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@ on:
77
push:
88
paths:
99
- ".github/workflows/check-toc-task.ya?ml"
10+
- ".npmrc"
1011
- "package.json"
1112
- "package-lock.json"
1213
# TODO: Update this if ToC of any other files should be checked.
1314
- "README.md"
1415
pull_request:
1516
paths:
1617
- ".github/workflows/check-toc-task.ya?ml"
18+
- ".npmrc"
1719
- "package.json"
1820
- "package-lock.json"
1921
# TODO: Update this if ToC of any other files should be checked.

workflow-templates/check-workflows-task.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ Install the [`check-workflows-task.yml`](check-workflows-task.yml) GitHub Action
1212

1313
### Assets
1414

15+
- [`.npmrc`](assets/npm/.npmrc) - **npm** configuration file.
16+
- Install to: repository root.
1517
- [`Taskfile.yml`](assets/check-workflows-task/Taskfile.yml) - workflow validation task.
1618
- Install to: repository root (or merge into the existing `Taskfile.yml`).
1719
- [`Taskfile.yml`](assets/npm-task/Taskfile.yml) - npm tasks.

workflow-templates/check-workflows-task.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@ on:
66
push:
77
paths:
88
- ".github/workflows/*.ya?ml"
9+
- ".npmrc"
910
- "package.json"
1011
- "package-lock.json"
1112
- "Taskfile.ya?ml"
1213
pull_request:
1314
paths:
1415
- ".github/workflows/*.ya?ml"
16+
- ".npmrc"
1517
- "package.json"
1618
- "package-lock.json"
1719
- "Taskfile.ya?ml"

workflow-templates/sync-labels-npm.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ This is the version of the workflow using [npm](https://www.npmjs.com/) for depe
1414

1515
Install the [`sync-labels-npm.yml`](sync-labels-npm.yml) GitHub Actions workflow to `.github/workflows/`
1616

17+
### Assets
18+
19+
- [`.npmrc`](assets/npm/.npmrc) - **npm** configuration file.
20+
- Install to: repository root.
21+
1722
### Dependencies
1823

1924
The tool dependencies of this workflow are managed by [npm](https://www.npmjs.com/).

0 commit comments

Comments
 (0)