Check buildConfig before packaging the application
This commit is contained in:
11
package.json
11
package.json
@@ -27,12 +27,13 @@
|
|||||||
"serve": "gulp watch",
|
"serve": "gulp watch",
|
||||||
"test": "npm-run-all test:* lint:*",
|
"test": "npm-run-all test:* lint:*",
|
||||||
"test:app": "npm run build && mocha --reporter mocha-circleci-reporter --recursive test/specs",
|
"test:app": "npm run build && mocha --reporter mocha-circleci-reporter --recursive test/specs",
|
||||||
"package:all": "npm-run-all package:windows package:mac package:linux",
|
"package:all": "npm-run-all check-build-config package:windows package:mac package:linux",
|
||||||
"package:windows": "npm run build && build --win --x64 --ia32 --em.name=mattermost --publish=never && npm run manipulate-windows-zip",
|
"package:windows": "npm-run-all check-build-config build && build --win --x64 --ia32 --em.name=mattermost --publish=never && npm run manipulate-windows-zip",
|
||||||
"package:mac": "npm run build && build --mac --publish=never",
|
"package:mac": "npm-run-all check-build-config build && build --mac --publish=never",
|
||||||
"package:linux": "npm run build && build --linux --x64 --ia32 --em.name=mattermost-desktop --publish=never",
|
"package:linux": "npm-run-all check-build-config build && build --linux --x64 --ia32 --em.name=mattermost-desktop --publish=never",
|
||||||
"manipulate-windows-zip": "node scripts/manipulate_windows_zip.js",
|
"manipulate-windows-zip": "node scripts/manipulate_windows_zip.js",
|
||||||
"lint:js": "eslint --ext .js --ext .jsx ."
|
"lint:js": "eslint --ext .js --ext .jsx .",
|
||||||
|
"check-build-config": "node scripts/check_build_config.js"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"7zip-bin": "^2.0.4",
|
"7zip-bin": "^2.0.4",
|
||||||
|
16
scripts/check_build_config.js
Normal file
16
scripts/check_build_config.js
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
const buildConfig = require('../src/common/config/buildConfig');
|
||||||
|
|
||||||
|
function validateBuildConfig(config) {
|
||||||
|
if (config.enableServerManagement === false && config.defaultTeams && config.defaultTeams.length === 0) {
|
||||||
|
return {
|
||||||
|
result: false,
|
||||||
|
message: `When "enableServerManagement: false" is specified in buildConfig.js, "defaultTeams" must have one team at least.\n${JSON.stringify(config, null, 2)}`
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return {result: true};
|
||||||
|
}
|
||||||
|
|
||||||
|
const ret = validateBuildConfig(buildConfig);
|
||||||
|
if (ret.result === false) {
|
||||||
|
throw new Error(ret.message);
|
||||||
|
}
|
Reference in New Issue
Block a user