mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 11:50:00 +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,37 +28,43 @@ 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
|
||||||
console.error(Utils.colors.error("File not found: "), configFileName);
|
if (fs.existsSync(configFileName) === false) {
|
||||||
return;
|
console.error(Utils.colors.error("File not found: "), configFileName);
|
||||||
}
|
return;
|
||||||
// check permision
|
|
||||||
try {
|
|
||||||
fs.accessSync(configFileName, fs.F_OK);
|
|
||||||
} catch (e) {
|
|
||||||
console.log(Utils.colors.error(e));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Validate syntax of the configuration file.
|
|
||||||
// In case the there errors show messages and
|
|
||||||
// return
|
|
||||||
console.info(Utils.colors.info("Checking file... ", configFileName));
|
|
||||||
// I'm not sure if all ever is utf-8
|
|
||||||
fs.readFile(configFileName, "utf-8", function (err, data) {
|
|
||||||
if (err) { throw err; }
|
|
||||||
v.JSHINT(data); // Parser by jshint
|
|
||||||
|
|
||||||
if (v.JSHINT.errors.length == 0) {
|
|
||||||
console.log("Your configuration file doesn't contain syntax errors :)");
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
errors = v.JSHINT.data().errors;
|
|
||||||
for (idx in errors) {
|
|
||||||
error = errors[idx];
|
|
||||||
console.log("Line", error.line, "col", error.character, error.reason);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
// check permision
|
||||||
|
try {
|
||||||
|
fs.accessSync(configFileName, fs.F_OK);
|
||||||
|
} catch (e) {
|
||||||
|
console.log(Utils.colors.error(e));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate syntax of the configuration file.
|
||||||
|
// In case the there errors show messages and
|
||||||
|
// return
|
||||||
|
console.info(Utils.colors.info("Checking file... ", configFileName));
|
||||||
|
// I'm not sure if all ever is utf-8
|
||||||
|
fs.readFile(configFileName, "utf-8", function (err, data) {
|
||||||
|
if (err) { throw err; }
|
||||||
|
v.JSHINT(data); // Parser by jshint
|
||||||
|
|
||||||
|
if (v.JSHINT.errors.length == 0) {
|
||||||
|
console.log("Your configuration file doesn't contain syntax errors :)");
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
errors = v.JSHINT.data().errors;
|
||||||
|
for (idx in errors) {
|
||||||
|
error = errors[idx];
|
||||||
|
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