mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-08-22 13:09:26 +00:00
[refactor] Replace deprecated constants (#3789)
`fs.F_OK` and `fs.R_OK` are [deprecated since a while node 20.8.0](https://nodejs.org/api/deprecations.html#DEP0176). Node 24 now complains about them when running server mode (`node --run server`): ```bash [2025-05-23 23:11:44.932] [ERROR] (node:37733) [DEP0176] DeprecationWarning: fs.F_OK is deprecated, use fs.constants.F_OK instead (Use `node --trace-deprecation ...` to show where the warning was created) ``` The replacements have been in place for a while, and this change should work without any issues.
This commit is contained in:
committed by
GitHub
parent
4e3821c2ff
commit
85b4ece767
@@ -77,7 +77,7 @@ function App () {
|
||||
|
||||
// check if templateFile exists
|
||||
try {
|
||||
fs.accessSync(templateFile, fs.F_OK);
|
||||
fs.accessSync(templateFile, fs.constants.F_OK);
|
||||
} catch (err) {
|
||||
templateFile = null;
|
||||
Log.log("config template file not exists, no envsubst");
|
||||
@@ -126,7 +126,7 @@ function App () {
|
||||
require(`${global.root_path}/js/check_config.js`);
|
||||
|
||||
try {
|
||||
fs.accessSync(configFilename, fs.F_OK);
|
||||
fs.accessSync(configFilename, fs.constants.F_OK);
|
||||
const c = require(configFilename);
|
||||
if (Object.keys(c).length === 0) {
|
||||
Log.error("WARNING! Config file appears empty, maybe missing module.exports last line?");
|
||||
@@ -198,7 +198,7 @@ function App () {
|
||||
const moduleFile = `${moduleFolder}/${moduleName}.js`;
|
||||
|
||||
try {
|
||||
fs.accessSync(moduleFile, fs.R_OK);
|
||||
fs.accessSync(moduleFile, fs.constants.R_OK);
|
||||
} catch (e) {
|
||||
Log.warn(`No ${moduleFile} found for module: ${moduleName}.`);
|
||||
}
|
||||
@@ -207,7 +207,7 @@ function App () {
|
||||
|
||||
let loadHelper = true;
|
||||
try {
|
||||
fs.accessSync(helperPath, fs.R_OK);
|
||||
fs.accessSync(helperPath, fs.constants.R_OK);
|
||||
} catch (e) {
|
||||
loadHelper = false;
|
||||
Log.log(`No helper found for module: ${moduleName}.`);
|
||||
|
Reference in New Issue
Block a user