@modernpoacher/deps 2.1.18 → 2.1.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/common/index.mjs +5 -2
- package/bin/deps/deps.mjs +5 -5
- package/bin/deps/head.mjs +5 -5
- package/bin/deps/install.mjs +19 -19
- package/bin/deps/push.mjs +5 -5
- package/bin/deps/wipe.mjs +5 -5
- package/package.json +2 -3
- package/src/common/env/index.mjs +1 -1
- package/src/common/git/index.mjs +4 -4
- package/src/common/index.mjs +1 -38
- package/src/common/options/index.mjs +53 -0
- package/src/index.mjs +4 -1
- package/src/install/index.mjs +4 -1
package/bin/common/index.mjs
CHANGED
|
@@ -32,6 +32,10 @@ import {
|
|
|
32
32
|
PLATFORM
|
|
33
33
|
} from '#deps/src/common/env'
|
|
34
34
|
|
|
35
|
+
import {
|
|
36
|
+
getOptions
|
|
37
|
+
} from '#deps/src/common/options'
|
|
38
|
+
|
|
35
39
|
import {
|
|
36
40
|
DIRECTORY,
|
|
37
41
|
REGISTRY,
|
|
@@ -40,8 +44,7 @@ import {
|
|
|
40
44
|
getRegistryParameter,
|
|
41
45
|
getForceParameter,
|
|
42
46
|
getExportPath,
|
|
43
|
-
getNvm
|
|
44
|
-
getOptions
|
|
47
|
+
getNvm
|
|
45
48
|
} from '#deps/src/common'
|
|
46
49
|
|
|
47
50
|
const log = debug('@modernpoacher/deps')
|
package/bin/deps/deps.mjs
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import debug from 'debug'
|
|
4
4
|
|
|
5
|
+
import PATH from '#where-am-i'
|
|
6
|
+
|
|
5
7
|
import {
|
|
6
8
|
exec
|
|
7
9
|
} from 'node:child_process'
|
|
@@ -16,15 +18,13 @@ import {
|
|
|
16
18
|
handleComplete
|
|
17
19
|
} from '#deps/bin/common'
|
|
18
20
|
|
|
19
|
-
import {
|
|
20
|
-
getOptions
|
|
21
|
-
} from '#deps/src/common'
|
|
22
|
-
|
|
23
21
|
import {
|
|
24
22
|
PLATFORM
|
|
25
23
|
} from '#deps/src/common/env'
|
|
26
24
|
|
|
27
|
-
import
|
|
25
|
+
import {
|
|
26
|
+
getOptions
|
|
27
|
+
} from '#deps/src/common/options'
|
|
28
28
|
|
|
29
29
|
const {
|
|
30
30
|
env: {
|
package/bin/deps/head.mjs
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import debug from 'debug'
|
|
4
4
|
|
|
5
|
+
import PATH from '#where-am-i'
|
|
6
|
+
|
|
5
7
|
import {
|
|
6
8
|
exec
|
|
7
9
|
} from 'node:child_process'
|
|
@@ -16,15 +18,13 @@ import {
|
|
|
16
18
|
handleComplete
|
|
17
19
|
} from '#deps/bin/common'
|
|
18
20
|
|
|
19
|
-
import {
|
|
20
|
-
getOptions
|
|
21
|
-
} from '#deps/src/common'
|
|
22
|
-
|
|
23
21
|
import {
|
|
24
22
|
PLATFORM
|
|
25
23
|
} from '#deps/src/common/env'
|
|
26
24
|
|
|
27
|
-
import
|
|
25
|
+
import {
|
|
26
|
+
getOptions
|
|
27
|
+
} from '#deps/src/common/options'
|
|
28
28
|
|
|
29
29
|
const {
|
|
30
30
|
env: {
|
package/bin/deps/install.mjs
CHANGED
|
@@ -74,25 +74,6 @@ async function app () {
|
|
|
74
74
|
* Any other command will continue
|
|
75
75
|
*/
|
|
76
76
|
|
|
77
|
-
const {
|
|
78
|
-
env: {
|
|
79
|
-
PWD,
|
|
80
|
-
DEPS_PATH = PWD
|
|
81
|
-
}
|
|
82
|
-
} = process
|
|
83
|
-
|
|
84
|
-
const PACKAGE = (
|
|
85
|
-
await hasPackage(DEPS_PATH)
|
|
86
|
-
? await getPackage(DEPS_PATH)
|
|
87
|
-
: {}
|
|
88
|
-
)
|
|
89
|
-
|
|
90
|
-
const CONFIGURATION = (
|
|
91
|
-
await hasConfiguration(DEPS_PATH)
|
|
92
|
-
? await getConfiguration(DEPS_PATH)
|
|
93
|
-
: {}
|
|
94
|
-
)
|
|
95
|
-
|
|
96
77
|
const {
|
|
97
78
|
prod: P,
|
|
98
79
|
dev: D,
|
|
@@ -115,6 +96,25 @@ async function app () {
|
|
|
115
96
|
...(force ? { force } : {})
|
|
116
97
|
})
|
|
117
98
|
|
|
99
|
+
const {
|
|
100
|
+
env: {
|
|
101
|
+
PWD,
|
|
102
|
+
DEPS_PATH = PWD
|
|
103
|
+
}
|
|
104
|
+
} = process
|
|
105
|
+
|
|
106
|
+
const PACKAGE = (
|
|
107
|
+
await hasPackage(DEPS_PATH)
|
|
108
|
+
? await getPackage(DEPS_PATH)
|
|
109
|
+
: {}
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
const CONFIGURATION = (
|
|
113
|
+
await hasConfiguration(DEPS_PATH)
|
|
114
|
+
? await getConfiguration(DEPS_PATH)
|
|
115
|
+
: {}
|
|
116
|
+
)
|
|
117
|
+
|
|
118
118
|
if (P) {
|
|
119
119
|
log('Prod')
|
|
120
120
|
|
package/bin/deps/push.mjs
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import debug from 'debug'
|
|
4
4
|
|
|
5
|
+
import PATH from '#where-am-i'
|
|
6
|
+
|
|
5
7
|
import {
|
|
6
8
|
exec
|
|
7
9
|
} from 'node:child_process'
|
|
@@ -16,15 +18,13 @@ import {
|
|
|
16
18
|
handleComplete
|
|
17
19
|
} from '#deps/bin/common'
|
|
18
20
|
|
|
19
|
-
import {
|
|
20
|
-
getOptions
|
|
21
|
-
} from '#deps/src/common'
|
|
22
|
-
|
|
23
21
|
import {
|
|
24
22
|
PLATFORM
|
|
25
23
|
} from '#deps/src/common/env'
|
|
26
24
|
|
|
27
|
-
import
|
|
25
|
+
import {
|
|
26
|
+
getOptions
|
|
27
|
+
} from '#deps/src/common/options'
|
|
28
28
|
|
|
29
29
|
const {
|
|
30
30
|
env: {
|
package/bin/deps/wipe.mjs
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import debug from 'debug'
|
|
4
4
|
|
|
5
|
+
import PATH from '#where-am-i'
|
|
6
|
+
|
|
5
7
|
import {
|
|
6
8
|
exec
|
|
7
9
|
} from 'node:child_process'
|
|
@@ -16,15 +18,13 @@ import {
|
|
|
16
18
|
handleComplete
|
|
17
19
|
} from '#deps/bin/common'
|
|
18
20
|
|
|
19
|
-
import {
|
|
20
|
-
getOptions
|
|
21
|
-
} from '#deps/src/common'
|
|
22
|
-
|
|
23
21
|
import {
|
|
24
22
|
PLATFORM
|
|
25
23
|
} from '#deps/src/common/env'
|
|
26
24
|
|
|
27
|
-
import
|
|
25
|
+
import {
|
|
26
|
+
getOptions
|
|
27
|
+
} from '#deps/src/common/options'
|
|
28
28
|
|
|
29
29
|
const {
|
|
30
30
|
env: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@modernpoacher/deps",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.20",
|
|
4
4
|
"description": "Update NPM package dependencies from the command line",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"deps",
|
|
@@ -79,8 +79,7 @@
|
|
|
79
79
|
"#deps/src": "./src/index.mjs",
|
|
80
80
|
"#deps/src/*": "./src/*.mjs",
|
|
81
81
|
"#deps/src/common": "./src/common/index.mjs",
|
|
82
|
-
"#deps/src/common
|
|
83
|
-
"#deps/src/common/git": "./src/common/git/index.mjs",
|
|
82
|
+
"#deps/src/common/*": "./src/common/*/index.mjs",
|
|
84
83
|
"#deps/src/install": "./src/install/index.mjs",
|
|
85
84
|
"#where-am-i": "./where-am-i.mjs"
|
|
86
85
|
}
|
package/src/common/env/index.mjs
CHANGED
package/src/common/git/index.mjs
CHANGED
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
|
|
18
18
|
import {
|
|
19
19
|
getOptions
|
|
20
|
-
} from '#deps/src/common'
|
|
20
|
+
} from '#deps/src/common/options'
|
|
21
21
|
|
|
22
22
|
export const DIRECTORY = '.'
|
|
23
23
|
|
|
@@ -57,7 +57,7 @@ eval $(ssh-agent -k) 1> /dev/null
|
|
|
57
57
|
|
|
58
58
|
const log = debug('@modernpoacher/deps')
|
|
59
59
|
|
|
60
|
-
log(`\`git\` (${VERSION} - ${PLATFORM}) is awake`)
|
|
60
|
+
log(`\`common/git\` (${VERSION} - ${PLATFORM}) is awake`)
|
|
61
61
|
|
|
62
62
|
const trim = (v) => v.split(String.fromCharCode(10)).map((v) => v.trimEnd()).join(String.fromCharCode(10)).trim()
|
|
63
63
|
|
|
@@ -65,13 +65,13 @@ function filter (v) {
|
|
|
65
65
|
return Boolean(stripAnsi(v).trim())
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
|
|
68
|
+
function getIsDirectory (directory) {
|
|
69
69
|
return function isDirectory (s) {
|
|
70
70
|
return directory === s
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
|
|
74
|
+
function isFatal (s) {
|
|
75
75
|
return s.toLowerCase().startsWith('fatal: not a git repository')
|
|
76
76
|
}
|
|
77
77
|
|
package/src/common/index.mjs
CHANGED
|
@@ -54,21 +54,9 @@ export const AUTHOR = 'Modern Poacher Limited <modernpoacher@modernpoacher.com>'
|
|
|
54
54
|
|
|
55
55
|
export const NVM = resolve(PATH, 'nvm.sh')
|
|
56
56
|
|
|
57
|
-
export const OPTIONS = {
|
|
58
|
-
maxBuffer: 1024 * 2000,
|
|
59
|
-
stdio: 'inherit',
|
|
60
|
-
env: {
|
|
61
|
-
DEBUG_COLORS: 'yes',
|
|
62
|
-
FORCE_COLOR: PLATFORM === 'win32'
|
|
63
|
-
? 3
|
|
64
|
-
: 2,
|
|
65
|
-
PATH: process.env.PATH
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
57
|
const log = debug('@modernpoacher/deps')
|
|
70
58
|
|
|
71
|
-
log(`\`common\` (${VERSION} - ${PLATFORM}) is awake
|
|
59
|
+
log(`\`common\` (${VERSION} - ${PLATFORM}) is awake`)
|
|
72
60
|
|
|
73
61
|
export const tidy = (v) => v.replace(/\n{2,}}/gm, String.fromCharCode(10)).trim()
|
|
74
62
|
|
|
@@ -206,31 +194,6 @@ export const getCommands = PLATFORM === 'win32'
|
|
|
206
194
|
? (commands = 'npm i') => tidy(commands)
|
|
207
195
|
: (commands = 'npm i') => tidy(getExportPath(getNvm(commands)))
|
|
208
196
|
|
|
209
|
-
/**
|
|
210
|
-
* @function getOptions
|
|
211
|
-
*
|
|
212
|
-
* Get the installation `exec` child process options
|
|
213
|
-
*
|
|
214
|
-
* @param {string} cwd normalized directory
|
|
215
|
-
*
|
|
216
|
-
* @return {{
|
|
217
|
-
* maxBuffer: number,
|
|
218
|
-
* stdio: string
|
|
219
|
-
* env: {
|
|
220
|
-
* DEBUG_COLORS: string,
|
|
221
|
-
* FORCE_COLOR: number,
|
|
222
|
-
* PROCESS: string
|
|
223
|
-
* }
|
|
224
|
-
* cwd: string
|
|
225
|
-
* }}
|
|
226
|
-
*/
|
|
227
|
-
export function getOptions (cwd) {
|
|
228
|
-
return {
|
|
229
|
-
...OPTIONS,
|
|
230
|
-
cwd
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
|
|
234
197
|
/**
|
|
235
198
|
* @function getProdDependencies
|
|
236
199
|
*
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import debug from 'debug'
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
VERSION,
|
|
5
|
+
PLATFORM
|
|
6
|
+
} from '#deps/src/common/env'
|
|
7
|
+
|
|
8
|
+
const {
|
|
9
|
+
env: {
|
|
10
|
+
PATH
|
|
11
|
+
}
|
|
12
|
+
} = process
|
|
13
|
+
|
|
14
|
+
export const OPTIONS = {
|
|
15
|
+
maxBuffer: 1024 * 2000,
|
|
16
|
+
stdio: 'inherit',
|
|
17
|
+
env: {
|
|
18
|
+
DEBUG_COLORS: 'yes',
|
|
19
|
+
FORCE_COLOR: PLATFORM === 'win32'
|
|
20
|
+
? 3
|
|
21
|
+
: 2,
|
|
22
|
+
PATH
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const log = debug('@modernpoacher/deps')
|
|
27
|
+
|
|
28
|
+
log(`\`common/options\` (${VERSION} - ${PLATFORM}) is awake`)
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* @function getOptions
|
|
32
|
+
*
|
|
33
|
+
* Get the installation `exec` child process options
|
|
34
|
+
*
|
|
35
|
+
* @param {string} cwd normalized directory
|
|
36
|
+
*
|
|
37
|
+
* @return {{
|
|
38
|
+
* maxBuffer: number,
|
|
39
|
+
* stdio: string
|
|
40
|
+
* env: {
|
|
41
|
+
* DEBUG_COLORS: string,
|
|
42
|
+
* FORCE_COLOR: number,
|
|
43
|
+
* PROCESS: string
|
|
44
|
+
* }
|
|
45
|
+
* cwd: string
|
|
46
|
+
* }}
|
|
47
|
+
*/
|
|
48
|
+
export function getOptions (cwd) {
|
|
49
|
+
return {
|
|
50
|
+
...OPTIONS,
|
|
51
|
+
cwd
|
|
52
|
+
}
|
|
53
|
+
}
|
package/src/index.mjs
CHANGED
|
@@ -25,6 +25,10 @@ import {
|
|
|
25
25
|
PLATFORM
|
|
26
26
|
} from '#deps/src/common/env'
|
|
27
27
|
|
|
28
|
+
import {
|
|
29
|
+
getOptions
|
|
30
|
+
} from '#deps/src/common/options'
|
|
31
|
+
|
|
28
32
|
import {
|
|
29
33
|
DIRECTORY,
|
|
30
34
|
REGISTRY,
|
|
@@ -36,7 +40,6 @@ import {
|
|
|
36
40
|
getSaveDevParameter,
|
|
37
41
|
getSaveProdParameter,
|
|
38
42
|
getCommands,
|
|
39
|
-
getOptions,
|
|
40
43
|
normalizeCommands,
|
|
41
44
|
transform,
|
|
42
45
|
getDepsExact,
|
package/src/install/index.mjs
CHANGED
|
@@ -23,6 +23,10 @@ import {
|
|
|
23
23
|
PLATFORM
|
|
24
24
|
} from '#deps/src/common/env'
|
|
25
25
|
|
|
26
|
+
import {
|
|
27
|
+
getOptions
|
|
28
|
+
} from '#deps/src/common/options'
|
|
29
|
+
|
|
26
30
|
import {
|
|
27
31
|
DIRECTORY,
|
|
28
32
|
REGISTRY,
|
|
@@ -31,7 +35,6 @@ import {
|
|
|
31
35
|
getForceParameter,
|
|
32
36
|
getSaveExactParameter,
|
|
33
37
|
getCommands,
|
|
34
|
-
getOptions,
|
|
35
38
|
normalizeCommands,
|
|
36
39
|
transform,
|
|
37
40
|
getDepsExact,
|