Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 154ed07

Browse files
authored
Merge pull request #194 from per1234/check-npm
Check/fix problems with npm configuration
2 parents e175d17 + 5631824 commit 154ed07

File tree

3 files changed

+56
-1
lines changed

3 files changed

+56
-1
lines changed

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

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,3 +125,45 @@ jobs:
125125
--color \
126126
--exit-code \
127127
"${{ matrix.project.path }}/package-lock.json"
128+
129+
check-config:
130+
name: check-config (${{ matrix.project.path }})
131+
needs: run-determination
132+
if: needs.run-determination.outputs.result == 'true'
133+
runs-on: ubuntu-latest
134+
permissions:
135+
contents: read
136+
137+
strategy:
138+
fail-fast: false
139+
matrix:
140+
project:
141+
# TODO: add paths of all npm-managed projects in the repository here.
142+
- path: .
143+
144+
steps:
145+
- name: Checkout repository
146+
uses: actions/checkout@v5
147+
148+
- name: Setup Node.js
149+
uses: actions/setup-node@v4
150+
with:
151+
node-version-file: "${{ matrix.project.path }}/package.json"
152+
153+
- name: Install Task
154+
uses: arduino/setup-task@v2
155+
with:
156+
repo-token: ${{ secrets.GITHUB_TOKEN }}
157+
version: 3.x
158+
159+
- name: Fix problems in npm configuration file
160+
run: |
161+
task npm:fix-config \
162+
PROJECT_PATH="${{ matrix.project.path }}"
163+
164+
- name: Check if fixes are needed in npm configuration file
165+
run: |
166+
git diff \
167+
--color \
168+
--exit-code \
169+
"${{ matrix.project.path }}/.npmrc"

‎.npmrc‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# See: https://docs.npmjs.com/cli/configuring-npm/npmrc
22

3-
engine-strict=true
3+
engine-strict=true

‎Taskfile.yml‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,19 @@ tasks:
307307
markdownlint-cli \
308308
"**/*.md"
309309
310+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-npm-task/Taskfile.yml
311+
npm:fix-config:
312+
desc: |
313+
Fix problems with the npm configuration file.
314+
Environment variable parameters:
315+
- PROJECT_PATH: Path of the npm-managed project (default: {{.DEFAULT_NPM_PROJECT_PATH}}).
316+
dir: "{{default .DEFAULT_NPM_PROJECT_PATH .PROJECT_PATH}}"
317+
cmds:
318+
- |
319+
npm config \
320+
--location project \
321+
fix
322+
310323
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/npm-task/Taskfile.yml
311324
npm:install-deps:
312325
desc: |

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /