mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 19:53:36 +00:00
Minor fixes.
This commit is contained in:
parent
29fc7910b7
commit
e2dbe8a0a2
@ -12,5 +12,11 @@
|
|||||||
"browser": true,
|
"browser": true,
|
||||||
"node": true,
|
"node": true,
|
||||||
"es6": true
|
"es6": true
|
||||||
|
},
|
||||||
|
"parserOptions": {
|
||||||
|
"sourceType": "module",
|
||||||
|
"ecmaFeatures": {
|
||||||
|
"globalReturn": true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import { danger, fail } from 'danger'
|
import { danger, fail } from "danger"
|
||||||
|
|
||||||
// Check if the CHANGELOG.md file has been edited
|
// Check if the CHANGELOG.md file has been edited
|
||||||
const changelogEdited = danger.git.modified_files.includes('CHANGELOG.md')
|
const changelogEdited = danger.git.modified_files.includes("CHANGELOG.md")
|
||||||
|
|
||||||
// Fail the build and post a comment reminding submitters to do so if it wasn't changed
|
// Fail the build and post a comment reminding submitters to do so if it wasn't changed
|
||||||
if (!changelogEdited) {
|
if (!changelogEdited) {
|
||||||
fail('Please include a CHANGELOG entry. You can find it at [CHANGELOG.md](CHANGELOG.md).')
|
fail("Please include a CHANGELOG entry. You can find it at [CHANGELOG.md](CHANGELOG.md).")
|
||||||
}
|
}
|
@ -14,8 +14,6 @@ var path = require("path");
|
|||||||
var fs = require("fs");
|
var fs = require("fs");
|
||||||
var Utils = require(__dirname + "/../../js/utils.js");
|
var Utils = require(__dirname + "/../../js/utils.js");
|
||||||
|
|
||||||
if (process.env.NODE_ENV == "test") { return 0 };
|
|
||||||
|
|
||||||
/* getConfigFile()
|
/* getConfigFile()
|
||||||
* Return string with path of configuration file
|
* Return string with path of configuration file
|
||||||
* Check if set by enviroment variable MM_CONFIG_FILE
|
* Check if set by enviroment variable MM_CONFIG_FILE
|
||||||
@ -30,26 +28,27 @@ function getConfigFile() {
|
|||||||
return configFileName;
|
return configFileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
var configFileName = getConfigFile();
|
function checkConfigFile() {
|
||||||
// Check if file is present
|
var configFileName = getConfigFile();
|
||||||
if (fs.existsSync(configFileName) === false) {
|
// Check if file is present
|
||||||
|
if (fs.existsSync(configFileName) === false) {
|
||||||
console.error(Utils.colors.error("File not found: "), configFileName);
|
console.error(Utils.colors.error("File not found: "), configFileName);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// check permision
|
// check permision
|
||||||
try {
|
try {
|
||||||
fs.accessSync(configFileName, fs.F_OK);
|
fs.accessSync(configFileName, fs.F_OK);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(Utils.colors.error(e));
|
console.log(Utils.colors.error(e));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate syntax of the configuration file.
|
// Validate syntax of the configuration file.
|
||||||
// In case the there errors show messages and
|
// In case the there errors show messages and
|
||||||
// return
|
// return
|
||||||
console.info(Utils.colors.info("Checking file... ", configFileName));
|
console.info(Utils.colors.info("Checking file... ", configFileName));
|
||||||
// I'm not sure if all ever is utf-8
|
// I'm not sure if all ever is utf-8
|
||||||
fs.readFile(configFileName, "utf-8", function (err, data) {
|
fs.readFile(configFileName, "utf-8", function (err, data) {
|
||||||
if (err) { throw err; }
|
if (err) { throw err; }
|
||||||
v.JSHINT(data); // Parser by jshint
|
v.JSHINT(data); // Parser by jshint
|
||||||
|
|
||||||
@ -63,4 +62,9 @@ fs.readFile(configFileName, "utf-8", function (err, data) {
|
|||||||
console.log("Line", error.line, "col", error.character, error.reason);
|
console.log("Line", error.line, "col", error.character, error.reason);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (process.env.NODE_ENV !== "test") {
|
||||||
|
checkConfigFile();
|
||||||
|
};
|
Loading…
x
Reference in New Issue
Block a user