Skip to content

Commit 6d4d25a

Browse files
authored
fix: cleanup, update deps, remove deps (#512)
This PR tried to reduce the aegir node_modules weight but failed completely :( On the bright side all deps are up to date, some logic was simplified and direct deps number was reduced. Contributors feature now uses git-authors-cli which is faster, orders contributors, dedupes authors and removes bots. BREAKING CHANGE: hooks no longer support callbacks, eslint packages were updated so errors maybe appear and contributors list feature will change a bit.
1 parent 44109af commit 6d4d25a

15 files changed

+118
-210
lines changed

cmds/z-commitlint.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ module.exports = {
3636
...forwardOptions
3737
], {
3838
stdio: 'inherit',
39-
localDir: path.join(__dirname, '..')
39+
localDir: path.join(__dirname, '..'),
40+
preferLocal: true
4041
})
4142
}
4243
}

cmds/z-dependency-check.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ module.exports = {
3232
...forwardOptions
3333
], {
3434
stdio: 'inherit',
35-
localDir: path.join(__dirname, '..')
35+
localDir: path.join(__dirname, '..'),
36+
preferLocal: true
3637
})
3738
}
3839
}

cmds/z-lint-package-json.js

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
'use strict'
22

3-
const resolveBin = require('resolve-bin')
43
const execa = require('execa')
54
const path = require('path')
65
const { fromAegir, fromRoot } = require('../src/utils')
76

8-
const bin = resolveBin.sync('npm-package-json-lint', { executable: 'npmPkgJsonLint' })
9-
107
const EPILOG = `
118
Supports options forwarding with '--' for more info check https://github.com/tclindner/npm-package-json-lint#cli-commands-and-configuration
129
`
@@ -27,14 +24,15 @@ module.exports = {
2724
? ['-c', fromAegir('src/config/.npmpackagejsonlintrc.json')]
2825
: []
2926

30-
return execa(bin, [
27+
return execa('npmPkgJsonLint', [
3128
fromRoot('package.json'),
3229
...config,
3330
...input,
3431
...forwardOptions
3532
], {
3633
stdio: 'inherit',
37-
localDir: path.join(__dirname, '..')
34+
localDir: path.join(__dirname, '..'),
35+
preferLocal: true
3836
})
3937
}
4038
}

package.json

+41-51
Original file line numberDiff line numberDiff line change
@@ -39,106 +39,96 @@
3939
"release-major": "npm run test && node cli.js release --no-build --no-test --type major"
4040
},
4141
"dependencies": {
42-
"@babel/cli": "^7.7.5",
43-
"@babel/core": "^7.7.5",
44-
"@babel/plugin-transform-regenerator": "^7.7.5",
45-
"@babel/plugin-transform-runtime": "^7.7.6",
46-
"@babel/preset-env": "^7.7.6",
47-
"@babel/register": "^7.7.4",
48-
"@babel/runtime": "^7.7.6",
49-
"@commitlint/cli": "^8.0.0",
50-
"@commitlint/config-conventional": "^8.0.0",
51-
"@commitlint/lint": "^8.0.0",
52-
"@commitlint/load": "^8.0.0",
53-
"@commitlint/read": "^8.0.0",
54-
"@commitlint/travis-cli": "^8.0.0",
55-
"@hapi/joi": "^15.1.0",
56-
"arrify": "^2.0.1",
57-
"async": "^2.6.1",
42+
"@babel/cli": "^7.8.4",
43+
"@babel/core": "^7.8.4",
44+
"@babel/plugin-transform-regenerator": "^7.8.3",
45+
"@babel/plugin-transform-runtime": "^7.8.3",
46+
"@babel/preset-env": "^7.8.4",
47+
"@babel/register": "^7.8.3",
48+
"@babel/runtime": "^7.8.4",
49+
"@commitlint/cli": "^8.3.5",
50+
"@commitlint/config-conventional": "^8.3.4",
51+
"@commitlint/lint": "^8.3.5",
52+
"@commitlint/load": "^8.3.5",
53+
"@commitlint/read": "^8.3.4",
54+
"@commitlint/travis-cli": "^8.3.5",
5855
"babel-loader": "^8.0.5",
5956
"babel-plugin-transform-flow-comments": "^6.22.0",
60-
"browserify-zlib": "~0.2.0",
6157
"bundlesize": "~0.18.0",
58+
"camelcase": "^5.3.1",
6259
"chalk": "^3.0.0",
63-
"codecov": "^3.3.0",
64-
"conventional-changelog": "^3.1.15",
60+
"codecov": "^3.6.3",
61+
"conventional-changelog": "^3.1.18",
6562
"conventional-github-releaser": "^3.1.3",
66-
"del": "^5.1.0",
6763
"dependency-check": "^4.1.0",
68-
"detect-node": "^2.0.4",
6964
"documentation": "^12.1.4",
70-
"electron": "^6.0.9",
71-
"electron-mocha": "^8.1.2",
72-
"es6-promisify": "^6.0.2",
65+
"electron": "^8.0.0",
66+
"electron-mocha": "^8.2.0",
7367
"eslint": "^6.3.0",
7468
"eslint-config-standard": "^14.1.0",
7569
"eslint-plugin-import": "^2.19.1",
7670
"eslint-plugin-no-only-tests": "^2.4.0",
77-
"eslint-plugin-node": "^10.0.0",
71+
"eslint-plugin-node": "^11.0.0",
7872
"eslint-plugin-promise": "^4.2.1",
7973
"eslint-plugin-standard": "^4.0.1",
80-
"execa": "^1.0.0",
81-
"filesize": "^6.0.1",
74+
"execa": "^4.0.0",
8275
"findup-sync": "^4.0.0",
8376
"fs-extra": "^8.1.0",
84-
"gh-pages": "^2.1.1",
77+
"gh-pages": "^2.2.0",
78+
"git-authors-cli": "^1.0.20",
8579
"git-validate": "^2.2.4",
86-
"globby": "^10.0.1",
80+
"globby": "^11.0.0",
81+
"ipfs-utils": "^0.7.1",
8782
"it-glob": "~0.0.5",
8883
"json-loader": "~0.5.7",
8984
"karma": "^4.4.1",
9085
"karma-chrome-launcher": "^3.1.0",
9186
"karma-cli": "^2.0.0",
9287
"karma-edge-launcher": "~0.4.2",
93-
"karma-firefox-launcher": "^1.2.0",
88+
"karma-firefox-launcher": "^1.3.0",
9489
"karma-junit-reporter": "^2.0.1",
9590
"karma-mocha": "^1.3.0",
9691
"karma-mocha-reporter": "^2.2.5",
9792
"karma-mocha-webworker": "^1.3.0",
9893
"karma-sourcemap-loader": "~0.3.7",
9994
"karma-webpack": "4.0.2",
10095
"listr": "~0.14.2",
101-
"listr-verbose-renderer": "~0.6.0",
102-
"lodash": "^4.17.14",
103-
"mocha": "^6.2.2",
104-
"npm-package-json-lint": "^4.4.0",
105-
"npm-which": "^3.0.1",
106-
"nyc": "^14.1.0",
96+
"merge-options": "^2.0.0",
97+
"mocha": "^7.0.1",
98+
"npm-package-json-lint": "^4.5.1",
99+
"nyc": "^15.0.0",
107100
"p-map": "^3.0.0",
101+
"pascalcase": "^1.0.0",
108102
"pify": "^4.0.1",
109-
"pretty-hrtime": "^1.0.3",
110103
"prompt-promise": "^1.0.3",
111104
"read-pkg-up": "^7.0.1",
112-
"resolve-bin": "~0.4.0",
113-
"rimraf": "^3.0.0",
114-
"semver": "^6.3.0",
115-
"simple-git": "^1.128.0",
105+
"rimraf": "^3.0.1",
106+
"semver": "^7.1.2",
107+
"simple-git": "^1.131.0",
116108
"stats-webpack-plugin": "~0.7.0",
117109
"stream-array": "^1.1.2",
118-
"stream-http": "^3.1.0",
119-
"terser-webpack-plugin": "^2.2.3",
120-
"through": "^2.3.8",
110+
"terser-webpack-plugin": "^2.3.4",
121111
"transform-loader": "~0.2.4",
122-
"update-notifier": "^3.0.1",
112+
"update-notifier": "^4.0.0",
123113
"vinyl-fs": "^3.0.3",
124-
"webpack": "^4.41.2",
114+
"webpack": "^4.41.5",
125115
"webpack-bundle-analyzer": "^3.6.0",
126116
"webpack-cli": "^3.3.10",
127117
"webpack-merge": "^4.2.2",
128-
"yargs": "^15.0.2",
118+
"yargs": "^15.1.0",
129119
"yargs-parser": "^16.1.0"
130120
},
131121
"devDependencies": {
132122
"chai": "^4.2.0",
133123
"chai-as-promised": "^7.1.1",
134-
"cross-env": "^6.0.3",
124+
"cross-env": "^7.0.0",
135125
"dirty-chai": "^2.0.1",
136126
"mock-require": "^3.0.2",
137-
"sinon": "^7.4.2"
127+
"sinon": "^8.1.1"
138128
},
139129
"engines": {
140-
"node": ">=8.0.0",
141-
"npm": ">=5.0.0"
130+
"node": ">=10.0.0",
131+
"npm": ">=6.0.0"
142132
},
143133
"browserslist": [
144134
">1%",

src/build/index.js

+2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ module.exports = (argv) => {
3333
AEGIR_BUILD_ANALYZE: analyze || ''
3434
},
3535
localDir: path.join(__dirname, '../..'),
36+
preferLocal: true,
3637
stdio: 'inherit'
3738
})
3839

@@ -41,6 +42,7 @@ module.exports = (argv) => {
4142
.then(r => {
4243
return execa('bundlesize', ['-f', config.bundlesize.path, '-s', config.bundlesize.maxSize], {
4344
localDir: path.join(__dirname, '..'),
45+
preferLocal: true,
4446
stdio: 'inherit'
4547
})
4648
})

src/config/intro-template.md.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict'
22

3-
const _ = require('lodash')
3+
const camelCase = require('camelcase')
44

55
function exampleTmpl (example) {
66
if (!example) {
@@ -34,19 +34,19 @@ $ npm install --save ${name}
3434
You can then \`require()\` ${name} as normal:
3535
3636
\`\`\`js
37-
const ${_.camelCase(name.replace(/-/g, ' '))} = require('${name}')
37+
const ${camelCase(name)} = require('${name}')
3838
\`\`\`
3939
4040
## In the Browser
41-
${_.upperFirst(name)} should work in any ES2015 environment out of the box.
41+
\`${name}\` should work in any ECMAScript 2018 environment out of the box.
4242
4343
Usage:
4444
4545
\`\`\`html
4646
<script type="text/javascript" src="index.js"></script>
4747
\`\`\`
4848
49-
The portable versions of ${name}, including \`index.js\` and \`index.min.js\`, are included in the \`/dist\` folder. ${_.upperFirst(name)} can also be found on [unpkg.com](https://unpkg.com) under
49+
The portable versions of \`${name}\`, including \`index.js\` and \`index.min.js\`, are included in the \`/dist\` folder. \`${name}\` can also be found on [unpkg.com](https://unpkg.com) under
5050
5151
- https://unpkg.com/${name}/dist/index.min.js
5252
- https://unpkg.com/${name}/dist/index.js

src/config/user.js

+32-70
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,48 @@
11
'use strict'
22

3-
const _ = require('lodash')
4-
const Joi = require('@hapi/joi')
5-
const { promisify } = require('es6-promisify')
3+
const merge = require('merge-options')
64
const utils = require('../utils')
75

8-
const hookSchema = Joi.object().keys({
9-
pre: Joi.func(),
10-
post: Joi.func()
11-
}).unknown(false)
12-
13-
const envSchema = Joi.object().keys({
14-
browser: hookSchema,
15-
node: hookSchema
16-
}).unknown(false)
17-
18-
const HOOK_ENVS = [
19-
'browser',
20-
'node'
21-
]
22-
23-
const HOOK_STAGES = [
24-
'pre',
25-
'post'
26-
]
27-
28-
function promisifyHooks (hooks) {
29-
Object.keys(hooks).forEach((key) => {
30-
if (hooks[key].length) {
31-
// hook takes args, is expecting a callback so promisify it
32-
hooks[key] = promisify(hooks[key])
6+
function normalizeHooks (hooks = {}) {
7+
const result = {
8+
browser: {
9+
pre: () => Promise.resolve(),
10+
post: () => Promise.resolve()
11+
},
12+
node: {
13+
pre: () => Promise.resolve(),
14+
post: () => Promise.resolve()
3315
}
34-
})
35-
36-
return hooks
37-
}
38-
39-
function normalizeHooks (hooks) {
40-
const keys = Object.keys(hooks)
41-
42-
// no hooks provided
43-
if (keys.length === 0) {
44-
return hooks
4516
}
4617

47-
// same hooks for all envs
48-
if (_.every(keys, (k) => _.includes(HOOK_STAGES, k))) {
49-
const v = promisifyHooks(Joi.attempt(hooks, hookSchema))
50-
51-
const res = {}
52-
HOOK_ENVS.forEach((env) => {
53-
res[env] = v
54-
})
55-
56-
return res
57-
}
18+
if (hooks.pre && hooks.post) {
19+
result.browser.pre = hooks.pre
20+
result.browser.post = hooks.post
21+
result.node.pre = hooks.pre
22+
result.node.post = hooks.post
5823

59-
// regular per env hook specification
60-
if (_.every(keys, (k) => _.includes(HOOK_ENVS, k))) {
61-
const res = Joi.attempt(hooks, envSchema)
62-
keys.forEach((key) => {
63-
res[key] = promisifyHooks(res[key])
64-
})
65-
return res
24+
return result
6625
}
6726

68-
throw new Error(`Found unknown keys in hook definiton: "${keys.join(' ')}"`)
27+
return merge(result, hooks)
6928
}
7029

7130
function userConfig () {
72-
const config = utils.getUserConfig()
73-
74-
const user = _.defaultsDeep({}, config, {
75-
webpack: {},
76-
karma: {},
77-
hooks: {},
78-
entry: utils.fromRoot('src', 'index.js'),
79-
bundlesize: {
80-
path: './dist/index.min.js',
81-
maxSize: '100kB'
82-
}
83-
})
31+
const userConfig = utils.getUserConfig()
32+
33+
const user = merge(
34+
{
35+
webpack: {},
36+
karma: {},
37+
hooks: {},
38+
entry: utils.fromRoot('src', 'index.js'),
39+
bundlesize: {
40+
path: './dist/index.min.js',
41+
maxSize: '100kB'
42+
}
43+
},
44+
userConfig
45+
)
8446

8547
user.hooks = normalizeHooks(user.hooks)
8648

src/fixtures.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* global self */
22
'use strict'
33

4-
const isNode = require('detect-node')
4+
const { isNode } = require('ipfs-utils/src/env')
55
const path = require('path')
66

77
// note: filePath needs to be relative to the module root

0 commit comments

Comments
 (0)