diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md
index f934c59ccf..bbaeb71d13 100644
--- a/.github/CONTRIBUTING.md
+++ b/.github/CONTRIBUTING.md
@@ -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`.
diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml
index d9777a4d5d..318e11f458 100644
--- a/.github/ISSUE_TEMPLATE/bug_report.yml
+++ b/.github/ISSUE_TEMPLATE/bug_report.yml
@@ -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
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
index e3dc222245..f1d2349952 100644
--- a/.github/PULL_REQUEST_TEMPLATE.md
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -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.
diff --git a/.github/workflows/automated-tests.yaml b/.github/workflows/automated-tests.yaml
index f27439f634..3d0e886cba 100644
--- a/.github/workflows/automated-tests.yaml
+++ b/.github/workflows/automated-tests.yaml
@@ -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
diff --git a/.github/workflows/electron-rebuild.yaml b/.github/workflows/electron-rebuild.yaml
index 30c03e4a86..52c593425c 100644
--- a/.github/workflows/electron-rebuild.yaml
+++ b/.github/workflows/electron-rebuild.yaml
@@ -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
diff --git a/.github/workflows/spellcheck.yaml b/.github/workflows/spellcheck.yaml
index 8e3b915d07..bf327b6ebc 100644
--- a/.github/workflows/spellcheck.yaml
+++ b/.github/workflows/spellcheck.yaml
@@ -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
diff --git a/.gitignore b/.gitignore
index 7301472cce..31c9a0bf75 100644
--- a/.gitignore
+++ b/.gitignore
@@ -84,3 +84,7 @@ Temporary Items
# Ignore positions file (#3518)
js/positions.js
+
+# Ignore lock files other than package-lock.json
+pnpm-lock.yaml
+yarn.lock
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 98ea0e697a..816b0d5b22 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -13,7 +13,8 @@ planned for 2025-07-01
### Changed
-- [refactor] Simplify module loading process
+- [refactor] Simplify module loading process (#3766)
+- Use "node --run" instead of "npm run" (#1511)
## [2.31.0] - 2025-04-01
@@ -34,7 +35,7 @@ Thanks to: @Developer-Incoming, @eltociear, @geraki, @khassel, @KristjanESPERANT
### Changed
-- [core] starting clientonly now checks for needed env var `WAYLAND_DISPLAY` or `DISPLAY` and starts electron with needed parameters (if both are set wayland is used) (#3677)
+- [core] Starting clientonly now checks for needed env var `WAYLAND_DISPLAY` or `DISPLAY` and starts electron with needed parameters (if both are set wayland is used) (#3677)
- [core] Optimize systeminformation calls and output (#3689)
- [core] Add issue templates for feature requests and bug reports (#3695)
- [core] Adapt `start:x11:dev` script
diff --git a/js/defaults.js b/js/defaults.js
index ce16b1e95c..469a172b37 100644
--- a/js/defaults.js
+++ b/js/defaults.js
@@ -62,7 +62,7 @@ const defaults = {
position: "middle_center",
classes: "xsmall",
config: {
- text: "If you get this message while your config file is already created,
" + "it probably contains an error. To validate your config file run in your MagicMirror² directory
" + "
npm run config:check" + text: "If you get this message while your config file is already created,
node --run config:check" } }, { diff --git a/js/electron.js b/js/electron.js index 8bf8e15ba5..241602efc8 100644 --- a/js/electron.js +++ b/js/electron.js @@ -112,7 +112,7 @@ function createWindow () { const port = process.env.MM_PORT || config.port; mainWindow.loadURL(`${prefix}${address}:${port}`); - // Open the DevTools if run with "npm start dev" + // Open the DevTools if run with "node --run start:dev" if (process.argv.includes("dev")) { if (process.env.JEST_WORKER_ID !== undefined) { // if we are running with jest diff --git a/modules/default/updatenotification/update_helper.js b/modules/default/updatenotification/update_helper.js index fc7cc10b78..1aeace1029 100644 --- a/modules/default/updatenotification/update_helper.js +++ b/modules/default/updatenotification/update_helper.js @@ -133,10 +133,10 @@ class Updater { }); } - // restart rules (pm2 or npm start) + // restart rules (pm2 or node --run start) restart () { if (this.usePM2) this.pm2Restart(); - else this.npmRestart(); + else this.nodeRestart(); } // restart MagicMiror with "pm2": use PM2Id for restart it @@ -150,12 +150,12 @@ class Updater { }); } - // restart MagicMiror with "npm start" - npmRestart () { + // restart MagicMiror with "node --run start" + nodeRestart () { Log.info("updatenotification: Restarting MagicMirror..."); const out = process.stdout; const err = process.stderr; - const subprocess = Spawn("npm start", { cwd: this.root_path, shell: true, detached: true, stdio: ["ignore", out, err] }); + const subprocess = Spawn("node --run start", { cwd: this.root_path, shell: true, detached: true, stdio: ["ignore", out, err] }); subprocess.unref(); // detach the newly launched process from the master process process.exit(); } diff --git a/package.json b/package.json index e8f81bc26b..fd94f733cc 100644 --- a/package.json +++ b/package.json @@ -33,17 +33,17 @@ "lint:js": "eslint --fix", "lint:markdown": "markdownlint-cli2 . --fix", "lint:prettier": "prettier . --write", - "postinstall": "npm run install-vendor && npm run install-fonts && echo \"MagicMirror² installation finished successfully! \n\"", + "postinstall": "node --run install-vendor && node --run install-fonts && echo \"MagicMirror² installation finished successfully! \n\"", "prepare": "[ -f node_modules/.bin/husky ] && husky || echo no husky installed.", "server": "node ./serveronly", - "start": "npm run start:x11", - "start:dev": "npm run start -- dev", + "start": "node --run start:x11", + "start:dev": "node --run start -- dev", "start:wayland": "WAYLAND_DISPLAY=\"${WAYLAND_DISPLAY:=wayland-1}\" ./node_modules/.bin/electron js/electron.js --enable-features=UseOzonePlatform --ozone-platform=wayland", - "start:wayland:dev": "npm run start:wayland -- dev", + "start:wayland:dev": "node --run start:wayland -- dev", "start:windows": ".\\node_modules\\.bin\\electron js\\electron.js", - "start:windows:dev": "npm run start:windows -- dev", + "start:windows:dev": "node --run start:windows -- dev", "start:x11": "DISPLAY=\"${DISPLAY:=:0}\" ./node_modules/.bin/electron js/electron.js", - "start:x11:dev": "npm run start:x11 -- dev", + "start:x11:dev": "node --run start:x11 -- dev", "test": "NODE_ENV=test jest -i --forceExit", "test:calendar": "node ./modules/default/calendar/debug.js", "test:coverage": "NODE_ENV=test jest --coverage -i --verbose false --forceExit",