mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-30 13:09:34 +00:00
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:
parent
ff6682982f
commit
b9d63d7252
12
.github/CONTRIBUTING.md
vendored
12
.github/CONTRIBUTING.md
vendored
@ -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.
|
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
|
### JavaScript: Run ESLint
|
||||||
|
|
||||||
We use [ESLint](https://eslint.org) to lint our JavaScript files. The configuration is in our `eslint.config.mjs` file.
|
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
|
### CSS: Run StyleLint
|
||||||
|
|
||||||
We use [StyleLint](https://stylelint.io) to lint our CSS. The configuration is in our `.stylelintrc.json` file.
|
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
|
### 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.
|
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
|
## Testing
|
||||||
|
|
||||||
We use [Jest](https://jestjs.io) for JavaScript 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`.
|
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`.
|
||||||
|
10
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
10
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
@ -44,11 +44,11 @@ body:
|
|||||||
description: |
|
description: |
|
||||||
Please keep in mind that some problems are specific to certain start options.
|
Please keep in mind that some problems are specific to certain start options.
|
||||||
options:
|
options:
|
||||||
- "npm run start"
|
- "node --run start"
|
||||||
- "npm run start:wayland"
|
- "node --run start:wayland"
|
||||||
- "npm run start:windows"
|
- "node --run start:windows"
|
||||||
- "npm run start:x11"
|
- "node --run start:x11"
|
||||||
- "npm run server"
|
- "node --run server"
|
||||||
- "node clientonly --address ... --port ..."
|
- "node clientonly --address ... --port ..."
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
|
2
.github/PULL_REQUEST_TEMPLATE.md
vendored
2
.github/PULL_REQUEST_TEMPLATE.md
vendored
@ -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.
|
> - What does the pull request accomplish? Use a list if needed.
|
||||||
> - If it includes major visual changes please add screenshots.
|
> - 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.
|
> style issues are fixed.
|
||||||
> 4. Don't forget to add an entry about your changes to
|
> 4. Don't forget to add an entry about your changes to
|
||||||
> the CHANGELOG.md file.
|
> the CHANGELOG.md file.
|
||||||
|
14
.github/workflows/automated-tests.yaml
vendored
14
.github/workflows/automated-tests.yaml
vendored
@ -26,13 +26,13 @@ jobs:
|
|||||||
cache: "npm"
|
cache: "npm"
|
||||||
- name: "Install dependencies"
|
- name: "Install dependencies"
|
||||||
run: |
|
run: |
|
||||||
npm run install-mm:dev
|
node --run install-mm:dev
|
||||||
- name: "Run linter tests"
|
- name: "Run linter tests"
|
||||||
run: |
|
run: |
|
||||||
npm run test:prettier
|
node --run test:prettier
|
||||||
npm run test:js
|
node --run test:js
|
||||||
npm run test:css
|
node --run test:css
|
||||||
npm run test:markdown
|
node --run test:markdown
|
||||||
test:
|
test:
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
timeout-minutes: 30
|
timeout-minutes: 30
|
||||||
@ -54,7 +54,7 @@ jobs:
|
|||||||
cache: "npm"
|
cache: "npm"
|
||||||
- name: "Install MagicMirror²"
|
- name: "Install MagicMirror²"
|
||||||
run: |
|
run: |
|
||||||
npm run install-mm:dev
|
node --run install-mm:dev
|
||||||
- name: "Run tests"
|
- name: "Run tests"
|
||||||
run: |
|
run: |
|
||||||
# Fix chrome-sandbox permissions:
|
# Fix chrome-sandbox permissions:
|
||||||
@ -64,4 +64,4 @@ jobs:
|
|||||||
WLR_BACKENDS=headless WLR_LIBINPUT_NO_DEVICES=1 WLR_RENDERER=pixman labwc &
|
WLR_BACKENDS=headless WLR_LIBINPUT_NO_DEVICES=1 WLR_RENDERER=pixman labwc &
|
||||||
export WAYLAND_DISPLAY=wayland-0
|
export WAYLAND_DISPLAY=wayland-0
|
||||||
touch css/custom.css
|
touch css/custom.css
|
||||||
npm run test
|
node --run test
|
||||||
|
2
.github/workflows/electron-rebuild.yaml
vendored
2
.github/workflows/electron-rebuild.yaml
vendored
@ -18,7 +18,7 @@ jobs:
|
|||||||
node-version: ${{ matrix.node-version }}
|
node-version: ${{ matrix.node-version }}
|
||||||
check-latest: true
|
check-latest: true
|
||||||
- name: Install MagicMirror
|
- name: Install MagicMirror
|
||||||
run: npm run install-mm
|
run: node --run install-mm
|
||||||
- name: Install @electron/rebuild
|
- name: Install @electron/rebuild
|
||||||
run: npm install @electron/rebuild
|
run: npm install @electron/rebuild
|
||||||
- name: Install node-libgpiod deps
|
- name: Install node-libgpiod deps
|
||||||
|
4
.github/workflows/spellcheck.yaml
vendored
4
.github/workflows/spellcheck.yaml
vendored
@ -26,6 +26,6 @@ jobs:
|
|||||||
cache: "npm"
|
cache: "npm"
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
npm run install-mm:dev
|
node --run install-mm:dev
|
||||||
- name: Run Spellcheck
|
- name: Run Spellcheck
|
||||||
run: npm run test:spelling
|
run: node --run test:spelling
|
||||||
|
4
.gitignore
vendored
4
.gitignore
vendored
@ -84,3 +84,7 @@ Temporary Items
|
|||||||
|
|
||||||
# Ignore positions file (#3518)
|
# Ignore positions file (#3518)
|
||||||
js/positions.js
|
js/positions.js
|
||||||
|
|
||||||
|
# Ignore lock files other than package-lock.json
|
||||||
|
pnpm-lock.yaml
|
||||||
|
yarn.lock
|
||||||
|
@ -17,7 +17,8 @@ planned for 2025-07-01
|
|||||||
|
|
||||||
### Changed
|
### 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
|
## [2.31.0] - 2025-04-01
|
||||||
|
|
||||||
@ -38,7 +39,7 @@ Thanks to: @Developer-Incoming, @eltociear, @geraki, @khassel, @KristjanESPERANT
|
|||||||
|
|
||||||
### Changed
|
### 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] Optimize systeminformation calls and output (#3689)
|
||||||
- [core] Add issue templates for feature requests and bug reports (#3695)
|
- [core] Add issue templates for feature requests and bug reports (#3695)
|
||||||
- [core] Adapt `start:x11:dev` script
|
- [core] Adapt `start:x11:dev` script
|
||||||
|
@ -62,7 +62,7 @@ const defaults = {
|
|||||||
position: "middle_center",
|
position: "middle_center",
|
||||||
classes: "xsmall",
|
classes: "xsmall",
|
||||||
config: {
|
config: {
|
||||||
text: "If you get this message while your config file is already created,<br>" + "it probably contains an error. To validate your config file run in your MagicMirror² directory<br>" + "<pre>npm run config:check</pre>"
|
text: "If you get this message while your config file is already created,<br>" + "it probably contains an error. To validate your config file run in your MagicMirror² directory<br>" + "<pre>node --run config:check</pre>"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -112,7 +112,7 @@ function createWindow () {
|
|||||||
const port = process.env.MM_PORT || config.port;
|
const port = process.env.MM_PORT || config.port;
|
||||||
mainWindow.loadURL(`${prefix}${address}:${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.argv.includes("dev")) {
|
||||||
if (process.env.JEST_WORKER_ID !== undefined) {
|
if (process.env.JEST_WORKER_ID !== undefined) {
|
||||||
// if we are running with jest
|
// if we are running with jest
|
||||||
|
@ -133,10 +133,10 @@ class Updater {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// restart rules (pm2 or npm start)
|
// restart rules (pm2 or node --run start)
|
||||||
restart () {
|
restart () {
|
||||||
if (this.usePM2) this.pm2Restart();
|
if (this.usePM2) this.pm2Restart();
|
||||||
else this.npmRestart();
|
else this.nodeRestart();
|
||||||
}
|
}
|
||||||
|
|
||||||
// restart MagicMiror with "pm2": use PM2Id for restart it
|
// restart MagicMiror with "pm2": use PM2Id for restart it
|
||||||
@ -150,12 +150,12 @@ class Updater {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// restart MagicMiror with "npm start"
|
// restart MagicMiror with "node --run start"
|
||||||
npmRestart () {
|
nodeRestart () {
|
||||||
Log.info("updatenotification: Restarting MagicMirror...");
|
Log.info("updatenotification: Restarting MagicMirror...");
|
||||||
const out = process.stdout;
|
const out = process.stdout;
|
||||||
const err = process.stderr;
|
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
|
subprocess.unref(); // detach the newly launched process from the master process
|
||||||
process.exit();
|
process.exit();
|
||||||
}
|
}
|
||||||
|
12
package.json
12
package.json
@ -33,17 +33,17 @@
|
|||||||
"lint:js": "eslint --fix",
|
"lint:js": "eslint --fix",
|
||||||
"lint:markdown": "markdownlint-cli2 . --fix",
|
"lint:markdown": "markdownlint-cli2 . --fix",
|
||||||
"lint:prettier": "prettier . --write",
|
"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.",
|
"prepare": "[ -f node_modules/.bin/husky ] && husky || echo no husky installed.",
|
||||||
"server": "node ./serveronly",
|
"server": "node ./serveronly",
|
||||||
"start": "npm run start:x11",
|
"start": "node --run start:x11",
|
||||||
"start:dev": "npm run start -- dev",
|
"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": "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": ".\\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": "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": "NODE_ENV=test jest -i --forceExit",
|
||||||
"test:calendar": "node ./modules/default/calendar/debug.js",
|
"test:calendar": "node ./modules/default/calendar/debug.js",
|
||||||
"test:coverage": "NODE_ENV=test jest --coverage -i --verbose false --forceExit",
|
"test:coverage": "NODE_ENV=test jest --coverage -i --verbose false --forceExit",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user