feat: more normalization

- remove config.commitizen
- remove left over devDependencies[babel-eslint]
- remove scripts.commitmsg
This commit is contained in:
Julien Fontanet 2017-11-21 14:54:51 +01:00
parent 084e96be0e
commit e24cba9684
9 changed files with 28 additions and 27 deletions

View File

@ -11,6 +11,7 @@
"husky": "^0.14.3",
"jest": "^21.2.1",
"lint-staged": "^5.0.0",
"lodash": "^4.17.4",
"promise-toolbox": "^0.9.5"
},
"engines": {

View File

@ -43,7 +43,6 @@
},
"scripts": {
"build": "cross-env NODE_ENV=production babel --source-maps --out-dir=dist/ src/",
"commitmsg": "npm test",
"dev": "cross-env NODE_ENV=development babel --watch --source-maps --out-dir=dist/ src/",
"posttest": "dependency-check ./package.json",
"prebuild": "rimraf dist/",

View File

@ -62,7 +62,6 @@
},
"scripts": {
"build": "cross-env NODE_ENV=production babel --source-maps --out-dir=dist/ src/",
"commitmsg": "npm test",
"dev": "cross-env NODE_ENV=development babel --watch --source-maps --out-dir=dist/ src/",
"plot": "gnuplot -p memory-test.gnu",
"posttest": "dependency-check ./package.json",

View File

@ -60,17 +60,11 @@
},
"scripts": {
"build": "cross-env NODE_ENV=production babel --source-maps --out-dir=dist/ src/",
"commitmsg": "npm test",
"dev": "cross-env NODE_ENV=development babel --watch --source-maps --out-dir=dist/ src/",
"posttest": "dependency-check ./package.json",
"prebuild": "rimraf dist/",
"predev": "npm run prebuild",
"prepublish": "npm run build",
"pretest": "flow status"
},
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
}
}

View File

@ -43,7 +43,6 @@
},
"scripts": {
"build": "cross-env NODE_ENV=production babel --source-maps --out-dir=dist/ src/",
"commitmsg": "npm test",
"dev": "cross-env NODE_ENV=development babel --watch --source-maps --out-dir=dist/ src/",
"posttest": "dependency-check ./package.json",
"prebuild": "rimraf dist/",

View File

@ -47,7 +47,6 @@
},
"scripts": {
"build": "cross-env NODE_ENV=production babel --source-maps --out-dir=dist/ src/",
"commitmsg": "npm test",
"dev": "cross-env NODE_ENV=development babel --watch --source-maps --out-dir=dist/ src/",
"posttest": "dependency-check ./package.json",
"prebuild": "rimraf dist/",

View File

@ -53,7 +53,6 @@
},
"scripts": {
"build": "cross-env NODE_ENV=production babel --source-maps --out-dir=dist/ src/",
"commitmsg": "npm test",
"dev": "cross-env NODE_ENV=development babel --watch --source-maps --out-dir=dist/ src/",
"posttest": "dependency-check ./package.json",
"prebuild": "rimraf dist/",

View File

@ -41,7 +41,6 @@
},
"devDependencies": {
"babel-cli": "^6.24.1",
"babel-eslint": "^8.0.1",
"babel-plugin-lodash": "^3.3.2",
"babel-preset-env": "^1.5.2",
"cross-env": "^5.0.1",

View File

@ -1,7 +1,21 @@
#!/usr/bin/env node
const isEmpty = require('lodash/isEmpty')
const { getPackages, writeFile, unlink } = require('./utils')
const deleteProperties = (object, property, properties) => {
const nestedObject = object[property]
if (nestedObject === undefined) {
return
}
properties.forEach(property => {
delete nestedObject[property]
})
if (isEmpty(object[property])) {
delete object[property]
}
}
require('exec-promise')(() =>
getPackages(true).map(({ dir, name, package: pkg }) => {
pkg.name = name
@ -9,25 +23,23 @@ require('exec-promise')(() =>
pkg.bugs = `https://github.com/vatesfr/xo-web/issues`
pkg.repository = {
type: 'git',
url: 'https://github.com/vatesfr/xen-orchestra.git'
url: 'https://github.com/vatesfr/xen-orchestra.git',
}
delete pkg.jest
delete pkg.standard
const { devDependencies, scripts } = pkg
if (devDependencies !== undefined) {
delete devDependencies.commitizen
delete devDependencies.ghooks
delete devDependencies.husky
delete devDependencies.jest
delete devDependencies.standard
delete devDependencies['babel-eslint']
delete devDependencies['cz-conventional-changelog']
}
if (scripts !== undefined) {
delete scripts.cz
}
deleteProperties(pkg, 'config', [ 'commitizen' ])
deleteProperties(pkg, 'devDependencies', [
'commitizen',
'ghooks',
'husky',
'jest',
'standard',
'babel-eslint',
'cz-conventional-changelog',
])
deleteProperties(pkg, 'scripts', [ 'commitmsg', 'cz' ])
return Promise.all([
writeFile(
@ -37,7 +49,7 @@ require('exec-promise')(() =>
unlink(`${dir}/.editorconfig`),
unlink(`${dir}/.gitignore`),
unlink(`${dir}/.jshintrc`),
unlink(`${dir}/yarn.lock`)
unlink(`${dir}/yarn.lock`),
])
})
)