Skip to content

Instantly share code, notes, and snippets.

@arnaudmolo
Last active September 8, 2016 08:58
Show Gist options
  • Save arnaudmolo/0b991c7fd14b6f9edef12543704c853f to your computer and use it in GitHub Desktop.
Save arnaudmolo/0b991c7fd14b6f9edef12543704c853f to your computer and use it in GitHub Desktop.
const fs = require('fs')
const path = require('path')
const exec = require('child_process').exec
const standardConfig = {
standard: {
parser: 'babel-eslint',
ignore: [
'*.test.js',
'/build',
'/dist',
'/internals/scripts'
]
}
}
exec('git clone --depth=1 https://github.com/mxstbr/react-boilerplate.git ./client && cd client && npm i --save-dev standard && npm run setup && npm run clean', (error, stdout, stderr) => {
if (error) {
console.log('hooooo une erreur !')
console.log(stderr)
console.error(error)
throw error
}
console.log(stdout)
console.log('CLI done')
const file = path.resolve(process.cwd(), 'client/package.json')
const pkg = require(file)
Object.assign(pkg.scripts, {fix: 'standard --fix'})
fs.writeFile(file, JSON.stringify(Object.assign(pkg, standardConfig)), err => {
if (err) {
throw err
}
console.log('Rewrote package')
exec('cd client && npm run fix && rm -rf .git', err => {
if (err) {
console.log(err)
throw err
}
console.log('et ben on à tout fixé')
})
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment