Use "node --run" instead of "npm run" (#3764)

This has the advantage that the package manager is no longer involved
after the installation process.

However, previous start commands such as `npm run start` continue to
work. So we don't even have to adapt the documentation.
This commit is contained in:
Kristjan ESPERANTO
2025-05-06 20:33:42 +02:00
committed by GitHub
parent ff6682982f
commit b9d63d7252
12 changed files with 42 additions and 37 deletions

View File

@@ -8,31 +8,31 @@ We hold our code to standard, and these standards are documented below.
We use [prettier](https://prettier.io/) for automatic formatting a lot all our files. The configuration is in our `prettier.config.mjs` file.
To run prettier, use `npm run lint:prettier`.
To run prettier, use `node --run lint:prettier`.
### JavaScript: Run ESLint
We use [ESLint](https://eslint.org) to lint our JavaScript files. The configuration is in our `eslint.config.mjs` file.
To run ESLint, use `npm run lint:js`.
To run ESLint, use `node --run lint:js`.
### CSS: Run StyleLint
We use [StyleLint](https://stylelint.io) to lint our CSS. The configuration is in our `.stylelintrc.json` file.
To run StyleLint, use `npm run lint:css`.
To run StyleLint, use `node --run lint:css`.
### Markdown: Run markdownlint
We use [markdownlint-cli2](https://github.com/DavidAnson/markdownlint-cli2) to lint our markdown files. The configuration is in our `.markdownlint.json` file.
To run markdownlint, use `npm run markdownlint:css`.
To run markdownlint, use `node --run markdownlint:css`.
## Testing
We use [Jest](https://jestjs.io) for JavaScript testing.
To run all tests, use `npm run test`.
To run all tests, use `node --run test`.
The specific test commands are defined in `package.json`.
So you can also run the specific tests with other commands, e.g. `npm run test:unit` or `npx jest tests/e2e/env_spec.js`.
So you can also run the specific tests with other commands, e.g. `node --run test:unit` or `npx jest tests/e2e/env_spec.js`.

View File

@@ -44,11 +44,11 @@ body:
description: |
Please keep in mind that some problems are specific to certain start options.
options:
- "npm run start"
- "npm run start:wayland"
- "npm run start:windows"
- "npm run start:x11"
- "npm run server"
- "node --run start"
- "node --run start:wayland"
- "node --run start:windows"
- "node --run start:x11"
- "node --run server"
- "node clientonly --address ... --port ..."
validations:
required: true

View File

@@ -10,7 +10,7 @@ Hello and thank you for wanting to contribute to the MagicMirror² project!
> - What does the pull request accomplish? Use a list if needed.
> - If it includes major visual changes please add screenshots.
>
> 3. Please run `npm run lint:prettier` before submitting so that
> 3. Please run `node --run lint:prettier` before submitting so that
> style issues are fixed.
> 4. Don't forget to add an entry about your changes to
> the CHANGELOG.md file.

View File

@@ -26,13 +26,13 @@ jobs:
cache: "npm"
- name: "Install dependencies"
run: |
npm run install-mm:dev
node --run install-mm:dev
- name: "Run linter tests"
run: |
npm run test:prettier
npm run test:js
npm run test:css
npm run test:markdown
node --run test:prettier
node --run test:js
node --run test:css
node --run test:markdown
test:
runs-on: ubuntu-24.04
timeout-minutes: 30
@@ -54,7 +54,7 @@ jobs:
cache: "npm"
- name: "Install MagicMirror²"
run: |
npm run install-mm:dev
node --run install-mm:dev
- name: "Run tests"
run: |
# Fix chrome-sandbox permissions:
@@ -64,4 +64,4 @@ jobs:
WLR_BACKENDS=headless WLR_LIBINPUT_NO_DEVICES=1 WLR_RENDERER=pixman labwc &
export WAYLAND_DISPLAY=wayland-0
touch css/custom.css
npm run test
node --run test

View File

@@ -18,7 +18,7 @@ jobs:
node-version: ${{ matrix.node-version }}
check-latest: true
- name: Install MagicMirror
run: npm run install-mm
run: node --run install-mm
- name: Install @electron/rebuild
run: npm install @electron/rebuild
- name: Install node-libgpiod deps

View File

@@ -26,6 +26,6 @@ jobs:
cache: "npm"
- name: Install dependencies
run: |
npm run install-mm:dev
node --run install-mm:dev
- name: Run Spellcheck
run: npm run test:spelling
run: node --run test:spelling