bloom-context-forms
Version:
context-wrapped form functionality for your bloom projects
26 lines (22 loc) • 840 B
JavaScript
var path = require('path');
var execSync = require('child_process').execSync;
var SEPARATOR = process.platform === 'win32' ? ';' : ':';
var env = Object.assign({}, process.env);
env.PATH = path.resolve('./node_modules/.bin') + SEPARATOR + env.PATH;
function myExecSync(cmd) {
var output = execSync(cmd, {
cwd: process.cwd(),
env: env
});
console.log('\x1b[37m', output.toString('utf8'));
}
if (process.platform === 'win32') {
console.log('\x1b[32m', 'running prettier on windows platform');
return myExecSync('prettier --config .prettierrc --write **/*.{js,jsx,scss}');
} else {
console.log('\x1b[32m', 'running prettier on non-windows platform');
var prettierScript =
"./node_modules/.bin/prettier --config .prettierrc --write '**/*.{js,jsx,scss}'";
return myExecSync(prettierScript);
}