@modernpoacher/deps 1.6.17 → 1.6.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/app.js +7 -11
- package/bin/deps.sh +5 -2
- package/bin/execute/app.js +44 -17
- package/bin/get-default-branch.sh +4 -0
- package/bin/head.sh +4 -0
- package/bin/install/app.js +6 -10
- package/bin/push.sh +4 -0
- package/bin/wipe.sh +4 -0
- package/lib/common/index.js +2 -2
- package/package.json +10 -10
- package/src/common/index.js +17 -6
package/bin/app.js
CHANGED
|
@@ -66,8 +66,6 @@ async function app () {
|
|
|
66
66
|
.option('-B, --save-bundle [bundleDependencies]', 'Install `bundleDependencies`', false)
|
|
67
67
|
.option('--registry [registry]', 'Installation registry')
|
|
68
68
|
.option('--force [force]', 'Force installation`', false)
|
|
69
|
-
.option('-m, --message [message]', 'Git commit message')
|
|
70
|
-
.option('-a, --author [author]', 'Git commit author')
|
|
71
69
|
.parse(argv)
|
|
72
70
|
|
|
73
71
|
/*
|
|
@@ -98,9 +96,7 @@ async function app () {
|
|
|
98
96
|
saveOptional: O,
|
|
99
97
|
saveBundle: B,
|
|
100
98
|
force,
|
|
101
|
-
registry
|
|
102
|
-
message,
|
|
103
|
-
author
|
|
99
|
+
registry
|
|
104
100
|
} = commander.opts()
|
|
105
101
|
|
|
106
102
|
log({
|
|
@@ -116,7 +112,7 @@ async function app () {
|
|
|
116
112
|
log('Prod')
|
|
117
113
|
|
|
118
114
|
try {
|
|
119
|
-
await executeProd(DEPS_PATH, getProdDependencies(PACKAGE), getProdDependencies(CONFIGURATION), registry, force
|
|
115
|
+
await executeProd(DEPS_PATH, getProdDependencies(PACKAGE), getProdDependencies(CONFIGURATION), registry, force)
|
|
120
116
|
} catch (e) {
|
|
121
117
|
handleError(e)
|
|
122
118
|
}
|
|
@@ -124,7 +120,7 @@ async function app () {
|
|
|
124
120
|
log('Dev')
|
|
125
121
|
|
|
126
122
|
try {
|
|
127
|
-
await executeDev(DEPS_PATH, getDevDependencies(PACKAGE), getDevDependencies(CONFIGURATION), registry, force
|
|
123
|
+
await executeDev(DEPS_PATH, getDevDependencies(PACKAGE), getDevDependencies(CONFIGURATION), registry, force)
|
|
128
124
|
} catch (e) {
|
|
129
125
|
handleError(e)
|
|
130
126
|
}
|
|
@@ -133,7 +129,7 @@ async function app () {
|
|
|
133
129
|
log('Prod')
|
|
134
130
|
|
|
135
131
|
try {
|
|
136
|
-
await executeProd(DEPS_PATH, getProdDependencies(PACKAGE), getProdDependencies(CONFIGURATION), registry, force
|
|
132
|
+
await executeProd(DEPS_PATH, getProdDependencies(PACKAGE), getProdDependencies(CONFIGURATION), registry, force)
|
|
137
133
|
} catch (e) {
|
|
138
134
|
handleError(e)
|
|
139
135
|
}
|
|
@@ -142,7 +138,7 @@ async function app () {
|
|
|
142
138
|
log('Dev')
|
|
143
139
|
|
|
144
140
|
try {
|
|
145
|
-
await executeDev(DEPS_PATH, getDevDependencies(PACKAGE), getDevDependencies(CONFIGURATION), registry, force
|
|
141
|
+
await executeDev(DEPS_PATH, getDevDependencies(PACKAGE), getDevDependencies(CONFIGURATION), registry, force)
|
|
146
142
|
} catch (e) {
|
|
147
143
|
handleError(e)
|
|
148
144
|
}
|
|
@@ -151,7 +147,7 @@ async function app () {
|
|
|
151
147
|
log('Optional')
|
|
152
148
|
|
|
153
149
|
try {
|
|
154
|
-
await executeOptional(DEPS_PATH, getOptionalDependencies(PACKAGE), getOptionalDependencies(CONFIGURATION), registry, force
|
|
150
|
+
await executeOptional(DEPS_PATH, getOptionalDependencies(PACKAGE), getOptionalDependencies(CONFIGURATION), registry, force)
|
|
155
151
|
} catch (e) {
|
|
156
152
|
handleError(e)
|
|
157
153
|
}
|
|
@@ -160,7 +156,7 @@ async function app () {
|
|
|
160
156
|
log('Bundle')
|
|
161
157
|
|
|
162
158
|
try {
|
|
163
|
-
await executeBundle(DEPS_PATH, getBundleDependencies(PACKAGE), getBundleDependencies(CONFIGURATION), registry, force
|
|
159
|
+
await executeBundle(DEPS_PATH, getBundleDependencies(PACKAGE), getBundleDependencies(CONFIGURATION), registry, force)
|
|
164
160
|
} catch (e) {
|
|
165
161
|
handleError(e)
|
|
166
162
|
}
|
package/bin/deps.sh
CHANGED
|
@@ -2,11 +2,14 @@
|
|
|
2
2
|
#
|
|
3
3
|
# https://google.github.io/styleguide/shellguide.html#s7-naming-conventions
|
|
4
4
|
|
|
5
|
+
export PATH=/usr/local/bin:$PATH
|
|
6
|
+
|
|
7
|
+
eval \`ssh-agent\`
|
|
8
|
+
|
|
5
9
|
EXP="[-0-9a-zA-Z]*$"
|
|
6
10
|
|
|
7
11
|
function update {
|
|
8
12
|
git checkout $default_branch
|
|
9
|
-
|
|
10
13
|
git pull
|
|
11
14
|
|
|
12
15
|
rm -rf node_modules package-lock.json
|
|
@@ -15,8 +18,8 @@ function update {
|
|
|
15
18
|
|
|
16
19
|
git add package.json package-lock.json
|
|
17
20
|
git commit -m "Updated \`package.json\` &/ \`package-lock.json\`"
|
|
18
|
-
|
|
19
21
|
git push
|
|
22
|
+
git push --tags
|
|
20
23
|
}
|
|
21
24
|
|
|
22
25
|
function can_update {
|
package/bin/execute/app.js
CHANGED
|
@@ -34,14 +34,17 @@ const {
|
|
|
34
34
|
} = require('@modernpoacher/deps/common/git')
|
|
35
35
|
|
|
36
36
|
const {
|
|
37
|
-
REGISTRY
|
|
37
|
+
REGISTRY,
|
|
38
|
+
getAuthor
|
|
38
39
|
} = require('@modernpoacher/deps/common')
|
|
39
40
|
|
|
40
41
|
const {
|
|
41
42
|
handleError,
|
|
42
43
|
rmrf,
|
|
43
44
|
npmi,
|
|
44
|
-
deps
|
|
45
|
+
deps,
|
|
46
|
+
hasConfiguration,
|
|
47
|
+
getConfiguration
|
|
45
48
|
} = require('~/bin/common')
|
|
46
49
|
|
|
47
50
|
const {
|
|
@@ -60,7 +63,7 @@ const DIRECTORY = process.cwd()
|
|
|
60
63
|
|
|
61
64
|
function handleCommandError (e) {
|
|
62
65
|
const {
|
|
63
|
-
code =
|
|
66
|
+
code = 0
|
|
64
67
|
} = e
|
|
65
68
|
|
|
66
69
|
if (code !== 128) {
|
|
@@ -68,13 +71,25 @@ function handleCommandError (e) {
|
|
|
68
71
|
message
|
|
69
72
|
} = e
|
|
70
73
|
|
|
71
|
-
log(
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
74
|
+
const log = debug('@modernpoacher/deps:error')
|
|
75
|
+
|
|
76
|
+
if (code > 1) log(code)
|
|
77
|
+
log(message)
|
|
75
78
|
}
|
|
76
79
|
}
|
|
77
80
|
|
|
81
|
+
async function getAuthorFromConfiguration (path) {
|
|
82
|
+
log('getAuthorFromConfiguration')
|
|
83
|
+
|
|
84
|
+
const CONFIGURATION = await hasConfiguration(path)
|
|
85
|
+
? await getConfiguration(path)
|
|
86
|
+
: {}
|
|
87
|
+
|
|
88
|
+
return (
|
|
89
|
+
getAuthor(CONFIGURATION)
|
|
90
|
+
)
|
|
91
|
+
}
|
|
92
|
+
|
|
78
93
|
const filterDeps = (v) => !!v // de-falsy
|
|
79
94
|
|
|
80
95
|
const reduceDeps = (a, v) => a.includes(v) ? a : a.concat(v) // de-dupe
|
|
@@ -118,19 +133,31 @@ async function mapRevParse (directory) {
|
|
|
118
133
|
}
|
|
119
134
|
}
|
|
120
135
|
|
|
121
|
-
async function iterate ([directory, ...directories] = [], registry
|
|
136
|
+
async function iterate ([directory, ...directories] = [], registry, force, message, author) {
|
|
122
137
|
log('iterate')
|
|
123
138
|
|
|
124
|
-
if (directory)
|
|
139
|
+
if (directory) {
|
|
140
|
+
const path = resolve(directory)
|
|
141
|
+
|
|
142
|
+
try {
|
|
143
|
+
if (path === await gitRevParse(path)) {
|
|
144
|
+
await execute(path, registry, force, message, author || await getAuthorFromConfiguration(path))
|
|
145
|
+
}
|
|
146
|
+
} catch (e) {
|
|
147
|
+
handleCommandError(e)
|
|
148
|
+
}
|
|
149
|
+
}
|
|
125
150
|
|
|
126
|
-
if (directories.length)
|
|
151
|
+
if (directories.length) {
|
|
152
|
+
await iterate(directories, registry, force, message, author)
|
|
153
|
+
}
|
|
127
154
|
}
|
|
128
155
|
|
|
129
156
|
async function execute (directory = DIRECTORY, registry = REGISTRY, force = false, message = MESSAGE, author = AUTHOR) {
|
|
130
157
|
log('execute')
|
|
131
158
|
|
|
132
159
|
try {
|
|
133
|
-
log({ directory, registry })
|
|
160
|
+
log({ directory, registry, force, message, author })
|
|
134
161
|
|
|
135
162
|
await gitCheckout(directory, await catGitRefsRemotesOriginHead(directory))
|
|
136
163
|
await gitPull(directory)
|
|
@@ -146,7 +173,7 @@ async function execute (directory = DIRECTORY, registry = REGISTRY, force = fals
|
|
|
146
173
|
}
|
|
147
174
|
}
|
|
148
175
|
|
|
149
|
-
async function executeFrom (directory
|
|
176
|
+
async function executeFrom (directory, registry, force, message, author) {
|
|
150
177
|
log('executeFrom')
|
|
151
178
|
|
|
152
179
|
const path = resolve(directory)
|
|
@@ -154,7 +181,7 @@ async function executeFrom (directory = DIRECTORY, registry = REGISTRY, force =
|
|
|
154
181
|
try {
|
|
155
182
|
if (path === await gitRevParse(path)) {
|
|
156
183
|
return (
|
|
157
|
-
await execute(path, registry, force, message, author)
|
|
184
|
+
await execute(path, registry, force, message, author || await getAuthorFromConfiguration(path))
|
|
158
185
|
)
|
|
159
186
|
}
|
|
160
187
|
} catch (e) {
|
|
@@ -162,7 +189,7 @@ async function executeFrom (directory = DIRECTORY, registry = REGISTRY, force =
|
|
|
162
189
|
}
|
|
163
190
|
}
|
|
164
191
|
|
|
165
|
-
async function executeOnly (directory
|
|
192
|
+
async function executeOnly (directory, registry, force, message, author) {
|
|
166
193
|
log('executeOnly')
|
|
167
194
|
|
|
168
195
|
const path = resolve(directory)
|
|
@@ -170,7 +197,7 @@ async function executeOnly (directory = DIRECTORY, registry = REGISTRY, force =
|
|
|
170
197
|
try {
|
|
171
198
|
if (path === await gitRevParse(path)) {
|
|
172
199
|
return (
|
|
173
|
-
await execute(path, registry, force, message, author)
|
|
200
|
+
await execute(path, registry, force, message, author || await getAuthorFromConfiguration(path))
|
|
174
201
|
)
|
|
175
202
|
}
|
|
176
203
|
} catch (e) {
|
|
@@ -178,7 +205,7 @@ async function executeOnly (directory = DIRECTORY, registry = REGISTRY, force =
|
|
|
178
205
|
}
|
|
179
206
|
}
|
|
180
207
|
|
|
181
|
-
async function executePath (directory
|
|
208
|
+
async function executePath (directory, registry, force, message, author) {
|
|
182
209
|
log('executePath')
|
|
183
210
|
|
|
184
211
|
const path = resolve(directory)
|
|
@@ -186,7 +213,7 @@ async function executePath (directory = DIRECTORY, registry = REGISTRY, force =
|
|
|
186
213
|
try {
|
|
187
214
|
if (path === await gitRevParse(path)) {
|
|
188
215
|
return (
|
|
189
|
-
await execute(path, registry, force, message, author)
|
|
216
|
+
await execute(path, registry, force, message, author || await getAuthorFromConfiguration(path))
|
|
190
217
|
)
|
|
191
218
|
}
|
|
192
219
|
} catch (e) {
|
package/bin/head.sh
CHANGED
package/bin/install/app.js
CHANGED
|
@@ -66,8 +66,6 @@ async function app () {
|
|
|
66
66
|
.option('-s, --save [save]', 'Install `peerDependencies`', false)
|
|
67
67
|
.option('--registry [registry]', 'Installation registry')
|
|
68
68
|
.option('--force [force]', 'Force installation`', false)
|
|
69
|
-
.option('-m, --message [message]', 'Git commit message')
|
|
70
|
-
.option('-a, --author [author]', 'Git commit author')
|
|
71
69
|
.parse(argv)
|
|
72
70
|
|
|
73
71
|
/*
|
|
@@ -100,9 +98,7 @@ async function app () {
|
|
|
100
98
|
peer: p,
|
|
101
99
|
save,
|
|
102
100
|
registry,
|
|
103
|
-
force
|
|
104
|
-
message,
|
|
105
|
-
author
|
|
101
|
+
force
|
|
106
102
|
} = commander.opts()
|
|
107
103
|
|
|
108
104
|
log({
|
|
@@ -120,7 +116,7 @@ async function app () {
|
|
|
120
116
|
log('Prod')
|
|
121
117
|
|
|
122
118
|
try {
|
|
123
|
-
await execute(DEPS_PATH, getProdDependencies(PACKAGE), getProdDependencies(CONFIGURATION), save, registry, force
|
|
119
|
+
await execute(DEPS_PATH, getProdDependencies(PACKAGE), getProdDependencies(CONFIGURATION), save, registry, force)
|
|
124
120
|
} catch (e) {
|
|
125
121
|
handleError(e)
|
|
126
122
|
}
|
|
@@ -129,7 +125,7 @@ async function app () {
|
|
|
129
125
|
log('Dev')
|
|
130
126
|
|
|
131
127
|
try {
|
|
132
|
-
await execute(DEPS_PATH, getDevDependencies(PACKAGE), getDevDependencies(CONFIGURATION), save, registry, force
|
|
128
|
+
await execute(DEPS_PATH, getDevDependencies(PACKAGE), getDevDependencies(CONFIGURATION), save, registry, force)
|
|
133
129
|
} catch (e) {
|
|
134
130
|
handleError(e)
|
|
135
131
|
}
|
|
@@ -138,7 +134,7 @@ async function app () {
|
|
|
138
134
|
log('Optional')
|
|
139
135
|
|
|
140
136
|
try {
|
|
141
|
-
await execute(DEPS_PATH, getOptionalDependencies(PACKAGE), getOptionalDependencies(CONFIGURATION), save, registry, force
|
|
137
|
+
await execute(DEPS_PATH, getOptionalDependencies(PACKAGE), getOptionalDependencies(CONFIGURATION), save, registry, force)
|
|
142
138
|
} catch (e) {
|
|
143
139
|
handleError(e)
|
|
144
140
|
}
|
|
@@ -147,7 +143,7 @@ async function app () {
|
|
|
147
143
|
log('Bundle')
|
|
148
144
|
|
|
149
145
|
try {
|
|
150
|
-
await execute(DEPS_PATH, getBundleDependencies(PACKAGE), getBundleDependencies(CONFIGURATION), save, registry, force
|
|
146
|
+
await execute(DEPS_PATH, getBundleDependencies(PACKAGE), getBundleDependencies(CONFIGURATION), save, registry, force)
|
|
151
147
|
} catch (e) {
|
|
152
148
|
handleError(e)
|
|
153
149
|
}
|
|
@@ -156,7 +152,7 @@ async function app () {
|
|
|
156
152
|
log('Peer')
|
|
157
153
|
|
|
158
154
|
try {
|
|
159
|
-
await execute(DEPS_PATH, getPeerDependencies(PACKAGE), getPeerDependencies(CONFIGURATION), save, registry, force
|
|
155
|
+
await execute(DEPS_PATH, getPeerDependencies(PACKAGE), getPeerDependencies(CONFIGURATION), save, registry, force)
|
|
160
156
|
} catch (e) {
|
|
161
157
|
handleError(e)
|
|
162
158
|
}
|
package/bin/push.sh
CHANGED
package/bin/wipe.sh
CHANGED
package/lib/common/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.getCommands=exports.getBundleDependencies=exports.REGISTRY=exports.NVM=exports.DIRECTORY=exports.AUTHOR=void 0;exports.getDeps=getDeps;exports.getDepsExact=getDepsExact;exports.isPreRelease=exports.isExact=exports.getSaveProdParameter=exports.getSaveOptionalParameter=exports.getSaveExactParameter=exports.getSaveDevParameter=exports.getSaveBundleParameter=exports.getRegistryParameter=exports.getProdDependencies=exports.getPeerDependencies=exports.getOptionalDependencies=exports.getNoSaveParameter=exports.getForceParameter=exports.getDevDependencies=void 0;exports.normalizeCommands=normalizeCommands;exports.transform=transform;exports.transformDependency=void 0;var _debug=_interopRequireDefault(require("debug"));var _path=require("path");var _env=require("./env");function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}const{path:MODULE_PATH}=module;const DIRECTORY='.';exports.DIRECTORY=DIRECTORY;const REGISTRY='https://registry.npmjs.org';exports.REGISTRY=REGISTRY;const AUTHOR='Modern Poacher Limited <modernpoacher@modernpoacher.com>';exports.AUTHOR=AUTHOR;const NVM=(0,_path.resolve)(MODULE_PATH,'../../nvm.sh');exports.NVM=NVM;const log=(0,_debug.default)('@modernpoacher/deps');log(`\`common\` (${_env.PLATFORM}) is awake`);const tidy=v=>v.replace(/\n\n/gm,String.fromCharCode(10)).trim();const getSaveProdParameter=commands=>commands.concat(' --save-prod');exports.getSaveProdParameter=getSaveProdParameter;const getSaveDevParameter=commands=>commands.concat(' --save-dev');exports.getSaveDevParameter=getSaveDevParameter;const getSaveBundleParameter=commands=>commands.concat(' --save-bundle');exports.getSaveBundleParameter=getSaveBundleParameter;const getSaveOptionalParameter=commands=>commands.concat(' --save-optional');exports.getSaveOptionalParameter=getSaveOptionalParameter;const getRegistryParameter=(r,commands)=>r?commands.concat(` --registry ${r}`):commands;exports.getRegistryParameter=getRegistryParameter;const getForceParameter=(f,commands)=>f?commands.concat(' --force'):commands;exports.getForceParameter=getForceParameter;const getNoSaveParameter=(s,commands)=>s?commands:commands.concat(' --no-save');exports.getNoSaveParameter=getNoSaveParameter;const getSaveExactParameter=commands=>commands.concat(' --save-exact');exports.getSaveExactParameter=getSaveExactParameter;const getCommands=_env.PLATFORM==='win32'?(directory=DIRECTORY,commands='npm i')=>tidy(commands):(directory=DIRECTORY,commands='npm i')=>tidy(`
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.getCommands=exports.getBundleDependencies=exports.getAuthor=exports.REGISTRY=exports.NVM=exports.DIRECTORY=exports.AUTHOR=void 0;exports.getDeps=getDeps;exports.getDepsExact=getDepsExact;exports.isPreRelease=exports.isExact=exports.getSaveProdParameter=exports.getSaveOptionalParameter=exports.getSaveExactParameter=exports.getSaveDevParameter=exports.getSaveBundleParameter=exports.getRegistryParameter=exports.getProdDependencies=exports.getPeerDependencies=exports.getOptionalDependencies=exports.getNoSaveParameter=exports.getForceParameter=exports.getDevDependencies=void 0;exports.normalizeCommands=normalizeCommands;exports.transform=transform;exports.transformDependency=void 0;var _debug=_interopRequireDefault(require("debug"));var _path=require("path");var _env=require("./env");function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}const{path:MODULE_PATH}=module;const DIRECTORY='.';exports.DIRECTORY=DIRECTORY;const REGISTRY='https://registry.npmjs.org';exports.REGISTRY=REGISTRY;const AUTHOR='Modern Poacher Limited <modernpoacher@modernpoacher.com>';exports.AUTHOR=AUTHOR;const NVM=(0,_path.resolve)(MODULE_PATH,'../../nvm.sh');exports.NVM=NVM;const log=(0,_debug.default)('@modernpoacher/deps');log(`\`common\` (${_env.PLATFORM}) is awake`);const tidy=v=>v.replace(/\n\n/gm,String.fromCharCode(10)).trim();const getSaveProdParameter=commands=>commands.concat(' --save-prod');exports.getSaveProdParameter=getSaveProdParameter;const getSaveDevParameter=commands=>commands.concat(' --save-dev');exports.getSaveDevParameter=getSaveDevParameter;const getSaveBundleParameter=commands=>commands.concat(' --save-bundle');exports.getSaveBundleParameter=getSaveBundleParameter;const getSaveOptionalParameter=commands=>commands.concat(' --save-optional');exports.getSaveOptionalParameter=getSaveOptionalParameter;const getRegistryParameter=(r,commands)=>r?commands.concat(` --registry ${r}`):commands;exports.getRegistryParameter=getRegistryParameter;const getForceParameter=(f,commands)=>f?commands.concat(' --force'):commands;exports.getForceParameter=getForceParameter;const getNoSaveParameter=(s,commands)=>s?commands:commands.concat(' --no-save');exports.getNoSaveParameter=getNoSaveParameter;const getSaveExactParameter=commands=>commands.concat(' --save-exact');exports.getSaveExactParameter=getSaveExactParameter;const getCommands=_env.PLATFORM==='win32'?(directory=DIRECTORY,commands='npm i')=>tidy(commands):(directory=DIRECTORY,commands='npm i')=>tidy(`
|
|
2
2
|
export PATH=/usr/local/bin:$PATH &> /dev/null
|
|
3
3
|
. "${NVM}" 2> /dev/null
|
|
4
4
|
${commands}
|
|
5
|
-
`);exports.getCommands=getCommands;const getProdDependencies=({dependencies={}}={})=>dependencies;exports.getProdDependencies=getProdDependencies;const getDevDependencies=({devDependencies={}}={})=>devDependencies;exports.getDevDependencies=getDevDependencies;const getOptionalDependencies=({optionalDependencies={}}={})=>optionalDependencies;exports.getOptionalDependencies=getOptionalDependencies;const getBundleDependencies=({bundleDependencies=[]}={})=>bundleDependencies;exports.getBundleDependencies=getBundleDependencies;const getPeerDependencies=({peerDependencies}={})=>peerDependencies;exports.getPeerDependencies=getPeerDependencies;const isPreRelease=v=>/-/.test(v);exports.isPreRelease=isPreRelease;const isExact=v=>/^\d/.test(v);exports.isExact=isExact;function getDepsExact(values,configuration){log('getDepsExact');return Object.entries(values).reduce((accumulator,[name,version])=>isExact(version)?accumulator.concat({name,version:Reflect.has(configuration,name)?Reflect.get(configuration,name):version}):accumulator,[]);}function getDeps(values){log('getDeps');return Object.entries(values).reduce((accumulator,[name,version])=>isExact(version)?accumulator:isPreRelease(version)?accumulator.concat({name,version}):accumulator.concat({name,version:'latest'}),[]);}function normalizeCommands(value){while(/\s\s|\n/.test(value)){value=value.replace(/\s\s/gm,String.fromCharCode(32)).replace(/\n/gm,String.fromCharCode(32));}return value.trim();}const transformDependency=({name='@modernpoacher/deps',version='latest'}={})=>`${name}@${version}`;exports.transformDependency=transformDependency;function transform(value){log('transform');return Array.isArray(value)?value.map(transformDependency).join(String.fromCharCode(32)).trim():transformDependency(value);}
|
|
5
|
+
`);exports.getCommands=getCommands;const getProdDependencies=({dependencies={}}={})=>dependencies;exports.getProdDependencies=getProdDependencies;const getDevDependencies=({devDependencies={}}={})=>devDependencies;exports.getDevDependencies=getDevDependencies;const getOptionalDependencies=({optionalDependencies={}}={})=>optionalDependencies;exports.getOptionalDependencies=getOptionalDependencies;const getBundleDependencies=({bundleDependencies=[]}={})=>bundleDependencies;exports.getBundleDependencies=getBundleDependencies;const getPeerDependencies=({peerDependencies}={})=>peerDependencies;exports.getPeerDependencies=getPeerDependencies;const getAuthor=({author}={})=>author;exports.getAuthor=getAuthor;const isPreRelease=v=>/-/.test(v);exports.isPreRelease=isPreRelease;const isExact=v=>/^\d/.test(v);exports.isExact=isExact;function getDepsExact(values,configuration){log('getDepsExact');return Object.entries(values).reduce((accumulator,[name,version])=>isExact(version)?accumulator.concat({name,version:Reflect.has(configuration,name)?Reflect.get(configuration,name):version}):accumulator,[]);}function getDeps(values){log('getDeps');return Object.entries(values).reduce((accumulator,[name,version])=>isExact(version)?accumulator:isPreRelease(version)?accumulator.concat({name,version}):accumulator.concat({name,version:'latest'}),[]);}function normalizeCommands(value){while(/\s\s|\n/.test(value)){value=value.replace(/\s\s/gm,String.fromCharCode(32)).replace(/\n/gm,String.fromCharCode(32));}return value.trim();}const transformDependency=({name='@modernpoacher/deps',version='latest'}={})=>`${name}@${version}`;exports.transformDependency=transformDependency;function transform(value){log('transform');return Array.isArray(value)?value.map(transformDependency).join(String.fromCharCode(32)).trim():transformDependency(value);}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@modernpoacher/deps",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.20",
|
|
4
4
|
"description": "Update NPM package dependencies from the command line",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"deps",
|
|
@@ -57,23 +57,23 @@
|
|
|
57
57
|
"supports-color": "8.1.1"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
|
-
"@babel/cli": "^7.17.
|
|
61
|
-
"@babel/core": "^7.
|
|
60
|
+
"@babel/cli": "^7.17.10",
|
|
61
|
+
"@babel/core": "^7.18.0",
|
|
62
62
|
"@babel/eslint-parser": "^7.17.0",
|
|
63
|
-
"@babel/preset-env": "^7.
|
|
63
|
+
"@babel/preset-env": "^7.18.0",
|
|
64
64
|
"@babel/register": "^7.17.7",
|
|
65
65
|
"babel-plugin-module-resolver": "^4.1.0",
|
|
66
66
|
"chai": "^4.3.6",
|
|
67
|
-
"core-js": "^3.22.
|
|
67
|
+
"core-js": "^3.22.5",
|
|
68
68
|
"cross-env": "^7.0.3",
|
|
69
|
-
"eslint": "
|
|
70
|
-
"eslint-config-standard": "^
|
|
69
|
+
"eslint": "^8.16.0",
|
|
70
|
+
"eslint-config-standard": "^17.0.0",
|
|
71
71
|
"eslint-import-resolver-babel-module": "^5.3.1",
|
|
72
72
|
"eslint-plugin-import": "^2.26.0",
|
|
73
73
|
"eslint-plugin-node": "^11.1.0",
|
|
74
|
-
"eslint-plugin-promise": "
|
|
75
|
-
"husky": "^
|
|
76
|
-
"mocha": "^
|
|
74
|
+
"eslint-plugin-promise": "^6.0.0",
|
|
75
|
+
"husky": "^8.0.1",
|
|
76
|
+
"mocha": "^10.0.0",
|
|
77
77
|
"rimraf": "^3.0.2"
|
|
78
78
|
},
|
|
79
79
|
"_moduleAliases": {
|
package/src/common/index.js
CHANGED
|
@@ -119,7 +119,7 @@ export const getNoSaveParameter = (s, commands) => s ? commands : commands.conca
|
|
|
119
119
|
export const getSaveExactParameter = (commands) => commands.concat(' --save-exact')
|
|
120
120
|
|
|
121
121
|
/**
|
|
122
|
-
* @function
|
|
122
|
+
* @function getCommands
|
|
123
123
|
*
|
|
124
124
|
* Get the installation shell script
|
|
125
125
|
*
|
|
@@ -140,7 +140,7 @@ ${commands}
|
|
|
140
140
|
/**
|
|
141
141
|
* @function getProdDependencies
|
|
142
142
|
*
|
|
143
|
-
* Get the production dependencies by destructuring the package
|
|
143
|
+
* Get the production dependencies by destructuring the package or configuration
|
|
144
144
|
*
|
|
145
145
|
* @param {Object} package
|
|
146
146
|
*
|
|
@@ -151,7 +151,7 @@ export const getProdDependencies = ({ dependencies = {} } = {}) => dependencies
|
|
|
151
151
|
/**
|
|
152
152
|
* @function getDevDependencies
|
|
153
153
|
*
|
|
154
|
-
* Get the development dependencies by destructuring the package
|
|
154
|
+
* Get the development dependencies by destructuring the package or configuration
|
|
155
155
|
*
|
|
156
156
|
* @param {Object} package
|
|
157
157
|
*
|
|
@@ -162,7 +162,7 @@ export const getDevDependencies = ({ devDependencies = {} } = {}) => devDependen
|
|
|
162
162
|
/**
|
|
163
163
|
* @function getOptionalDependencies
|
|
164
164
|
*
|
|
165
|
-
* Get the optional dependencies by destructuring the package
|
|
165
|
+
* Get the optional dependencies by destructuring the package or configuration
|
|
166
166
|
*
|
|
167
167
|
* @param {Object} package
|
|
168
168
|
*
|
|
@@ -173,7 +173,7 @@ export const getOptionalDependencies = ({ optionalDependencies = {} } = {}) => o
|
|
|
173
173
|
/**
|
|
174
174
|
* @function getBundleDependencies
|
|
175
175
|
*
|
|
176
|
-
* Get the bundle dependencies by destructuring the package
|
|
176
|
+
* Get the bundle dependencies by destructuring the package or configuration
|
|
177
177
|
*
|
|
178
178
|
* @param {Object} package
|
|
179
179
|
*
|
|
@@ -184,7 +184,7 @@ export const getBundleDependencies = ({ bundleDependencies = [] } = {}) => bundl
|
|
|
184
184
|
/**
|
|
185
185
|
* @function getPeerDependencies
|
|
186
186
|
*
|
|
187
|
-
* Get the peer dependencies by destructuring the package
|
|
187
|
+
* Get the peer dependencies by destructuring the package or configuration
|
|
188
188
|
*
|
|
189
189
|
* @param {Object} package
|
|
190
190
|
*
|
|
@@ -192,6 +192,17 @@ export const getBundleDependencies = ({ bundleDependencies = [] } = {}) => bundl
|
|
|
192
192
|
*/
|
|
193
193
|
export const getPeerDependencies = ({ peerDependencies } = {}) => peerDependencies
|
|
194
194
|
|
|
195
|
+
/**
|
|
196
|
+
* @function getAuthor
|
|
197
|
+
*
|
|
198
|
+
* Get the author by destructuring the package or configuration
|
|
199
|
+
*
|
|
200
|
+
* @param {Object} package
|
|
201
|
+
*
|
|
202
|
+
* @return {Object}
|
|
203
|
+
*/
|
|
204
|
+
export const getAuthor = ({ author } = {}) => author
|
|
205
|
+
|
|
195
206
|
/**
|
|
196
207
|
* @function isPreRelease
|
|
197
208
|
*
|