Commit 7d4cd5c3 authored by Emiliano Balbuena's avatar Emiliano Balbuena

(feat): Check core.autocrlf value when running script

1 merge request!175WIP: Local stack tweaks
const yargs = require('yargs');
const getMissingDeps = require('./helpers/get-missing-deps');
const repoHealth = require('./helpers/repo-health');
return (async () => {
const missingDeps = await getMissingDeps();
......@@ -11,6 +12,8 @@ return (async () => {
return process.exit(1);
}
await repoHealth();
return yargs
.option('verbose', {
description: 'Verbose output',
......@@ -20,8 +23,8 @@ return (async () => {
description: 'Silent output',
boolean: true
})
.command('up', 'Start the containers', require('./commands/up'))
.command('down', 'Stop the containers', require('./commands/down'))
.command(['up', 'start'], 'Start the containers', require('./commands/up'))
.command(['down', 'stop'], 'Stop the containers', require('./commands/down'))
.command('restart', 'Restart the containers', require('./commands/restart'))
.command('rebuild', 'Rebuild the containers', require('./commands/rebuild'))
.command('install', 'Installs and provisions the compose stack', require('./commands/install'))
......
const exec = require('../lib/exec');
module.exports = async function() {
const getAutoCrLf = async dir => {
try {
const subprocess = await exec.in(dir, 'git', ['config', '--get', 'core.autocrlf']);
return (subprocess.stdout || '').trim().toLowerCase();
} catch (e) {
return false;
}
}
const badAutoCrLfValue = 'true';
const willCauseIssues = (await Promise.all([
getAutoCrLf(''),
getAutoCrLf('front'),
getAutoCrLf('engine'),
getAutoCrLf('sockets'),
])).some(autocrlf => autocrlf === badAutoCrLfValue);
if (willCauseIssues) {
process.stderr.write(
`\nWARNING: One or more repositories have 'core.autocrlf' set to '${badAutoCrLfValue}'. ` +
'This will cause issues with containerized scripts and provisioners. Please check ' +
'Minds Developers documentation.\n\n'
);
}
};
Please register or to comment