@modernpoacher/deps 1.6.26 → 2.0.0-beta.0
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/.depsrc +6 -0
- package/.nvmrc +1 -0
- package/{babel.config.js → babel.config.cjs} +1 -13
- package/bin/{app.js → app.mjs} +16 -17
- package/bin/common/{index.js → index.mjs} +21 -23
- package/bin/execute/{app.js → app.mjs} +24 -24
- package/bin/install/{app.js → app.mjs} +16 -17
- package/index.mjs +1 -0
- package/package.json +23 -25
- package/src/common/env/index.mjs +32 -0
- package/src/common/git/{index.js → index.mjs} +1 -1
- package/src/common/{index.js → index.mjs} +4 -6
- package/src/{index.js → index.mjs} +2 -2
- package/src/install/{index.js → index.mjs} +2 -2
- package/test/common/git/{index.spec.js → index.spec.mjs} +5 -3
- package/test/common/{index.spec.js → index.spec.mjs} +5 -3
- package/test/{index.spec.js → index.spec.mjs} +5 -3
- package/test/install/{index.spec.js → index.spec.mjs} +5 -3
- package/where-am-i.mjs +9 -0
- package/index.js +0 -3
- package/lib/common/env/index.js +0 -1
- package/lib/common/git/index.js +0 -5
- package/lib/common/index.js +0 -5
- package/lib/index.js +0 -1
- package/lib/install/index.js +0 -1
- package/src/common/env/index.js +0 -15
package/.depsrc
ADDED
package/.nvmrc
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
lts/*
|
|
@@ -31,19 +31,7 @@ const presets = [
|
|
|
31
31
|
]
|
|
32
32
|
]
|
|
33
33
|
|
|
34
|
-
const plugins = [
|
|
35
|
-
[
|
|
36
|
-
'module-resolver',
|
|
37
|
-
{
|
|
38
|
-
root: ['./src'],
|
|
39
|
-
cwd: 'babelrc',
|
|
40
|
-
alias: {
|
|
41
|
-
'~': '.',
|
|
42
|
-
'@modernpoacher/deps': './src'
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
]
|
|
46
|
-
]
|
|
34
|
+
const plugins = []
|
|
47
35
|
|
|
48
36
|
module.exports = (api) => {
|
|
49
37
|
if (api) api.cache.using(env)
|
package/bin/{app.js → app.mjs}
RENAMED
|
@@ -1,40 +1,37 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import debug from 'debug'
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
import {
|
|
6
|
+
Command
|
|
7
|
+
} from 'commander'
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const {
|
|
10
|
-
version: VERSION
|
|
11
|
-
} = require('~/package')
|
|
12
|
-
|
|
13
|
-
const {
|
|
9
|
+
import {
|
|
10
|
+
VERSION,
|
|
14
11
|
PLATFORM
|
|
15
|
-
}
|
|
12
|
+
} from '#deps/src/common/env'
|
|
16
13
|
|
|
17
|
-
|
|
14
|
+
import {
|
|
18
15
|
getProdDependencies,
|
|
19
16
|
getDevDependencies,
|
|
20
17
|
getOptionalDependencies,
|
|
21
18
|
getBundleDependencies
|
|
22
|
-
}
|
|
19
|
+
} from '#deps/src/common'
|
|
23
20
|
|
|
24
|
-
|
|
21
|
+
import {
|
|
25
22
|
handleError,
|
|
26
23
|
hasPackage,
|
|
27
24
|
getPackage,
|
|
28
25
|
hasConfiguration,
|
|
29
26
|
getConfiguration
|
|
30
|
-
}
|
|
27
|
+
} from '#deps/bin/common'
|
|
31
28
|
|
|
32
|
-
|
|
29
|
+
import {
|
|
33
30
|
executeProd,
|
|
34
31
|
executeDev,
|
|
35
32
|
executeOptional,
|
|
36
33
|
executeBundle
|
|
37
|
-
}
|
|
34
|
+
} from '#deps/src'
|
|
38
35
|
|
|
39
36
|
const {
|
|
40
37
|
env: {
|
|
@@ -51,6 +48,8 @@ log(`\`deps\` (${VERSION} - ${PLATFORM}) is awake`)
|
|
|
51
48
|
async function app () {
|
|
52
49
|
log('Deps')
|
|
53
50
|
|
|
51
|
+
const commander = new Command()
|
|
52
|
+
|
|
54
53
|
const {
|
|
55
54
|
argv
|
|
56
55
|
} = process
|
|
@@ -169,4 +168,4 @@ async function app () {
|
|
|
169
168
|
log('Done.')
|
|
170
169
|
}
|
|
171
170
|
|
|
172
|
-
|
|
171
|
+
export default app()
|
|
@@ -1,46 +1,39 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import debug from 'debug'
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const {
|
|
5
|
+
import {
|
|
8
6
|
exec
|
|
9
|
-
}
|
|
7
|
+
} from 'child_process'
|
|
10
8
|
|
|
11
|
-
|
|
9
|
+
import {
|
|
12
10
|
resolve,
|
|
13
11
|
relative,
|
|
14
12
|
normalize
|
|
15
|
-
}
|
|
13
|
+
} from 'path'
|
|
16
14
|
|
|
17
|
-
|
|
15
|
+
import {
|
|
18
16
|
constants
|
|
19
|
-
}
|
|
17
|
+
} from 'fs'
|
|
20
18
|
|
|
21
|
-
|
|
19
|
+
import {
|
|
22
20
|
access,
|
|
23
21
|
readFile
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const {
|
|
27
|
-
version: VERSION
|
|
28
|
-
} = require('~/package')
|
|
22
|
+
} from 'fs/promises'
|
|
29
23
|
|
|
30
|
-
|
|
24
|
+
import {
|
|
25
|
+
VERSION,
|
|
31
26
|
PLATFORM
|
|
32
|
-
}
|
|
27
|
+
} from '#deps/src/common/env'
|
|
33
28
|
|
|
34
|
-
|
|
29
|
+
import {
|
|
35
30
|
DIRECTORY,
|
|
36
31
|
REGISTRY,
|
|
37
32
|
AUTHOR,
|
|
38
|
-
|
|
39
33
|
NVM,
|
|
40
|
-
|
|
41
34
|
getRegistryParameter,
|
|
42
35
|
getForceParameter
|
|
43
|
-
}
|
|
36
|
+
} from '#deps/src/common'
|
|
44
37
|
|
|
45
38
|
const log = debug('@modernpoacher/deps')
|
|
46
39
|
|
|
@@ -107,10 +100,15 @@ function use (key) {
|
|
|
107
100
|
}
|
|
108
101
|
}
|
|
109
102
|
|
|
110
|
-
function handleError (
|
|
103
|
+
function handleError (e = {}) {
|
|
104
|
+
const {
|
|
105
|
+
code = CODE,
|
|
106
|
+
message = MESSAGE
|
|
107
|
+
} = e
|
|
111
108
|
const log = debug('@modernpoacher/deps:error')
|
|
112
109
|
if (code > 1) log(code)
|
|
113
110
|
log(message)
|
|
111
|
+
log(e)
|
|
114
112
|
}
|
|
115
113
|
|
|
116
114
|
const handlePackageError = ({ message = MESSAGE } = {}) => log(`Package error: "${message}"`)
|
|
@@ -305,7 +303,7 @@ function deps (directory = DIRECTORY, registry = REGISTRY, force = false) {
|
|
|
305
303
|
)
|
|
306
304
|
}
|
|
307
305
|
|
|
308
|
-
|
|
306
|
+
export {
|
|
309
307
|
DIRECTORY,
|
|
310
308
|
REGISTRY,
|
|
311
309
|
AUTHOR,
|
|
@@ -1,26 +1,23 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import debug from 'debug'
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const {
|
|
5
|
+
import {
|
|
8
6
|
resolve
|
|
9
|
-
}
|
|
7
|
+
} from 'path'
|
|
10
8
|
|
|
11
|
-
|
|
9
|
+
import glob from 'glob-all'
|
|
12
10
|
|
|
13
|
-
|
|
11
|
+
import {
|
|
12
|
+
Command
|
|
13
|
+
} from 'commander'
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
} = require('~/package')
|
|
18
|
-
|
|
19
|
-
const {
|
|
15
|
+
import {
|
|
16
|
+
VERSION,
|
|
20
17
|
PLATFORM
|
|
21
|
-
}
|
|
18
|
+
} from '#deps/src/common/env'
|
|
22
19
|
|
|
23
|
-
|
|
20
|
+
import {
|
|
24
21
|
MESSAGE,
|
|
25
22
|
AUTHOR,
|
|
26
23
|
catGitRefsRemotesOriginHead,
|
|
@@ -31,22 +28,22 @@ const {
|
|
|
31
28
|
gitPushTags,
|
|
32
29
|
gitAdd,
|
|
33
30
|
gitCommit
|
|
34
|
-
}
|
|
31
|
+
} from '#deps/src/common/git'
|
|
35
32
|
|
|
36
|
-
|
|
33
|
+
import {
|
|
37
34
|
REGISTRY,
|
|
38
35
|
getIgnore,
|
|
39
36
|
getAuthor
|
|
40
|
-
}
|
|
37
|
+
} from '#deps/src/common'
|
|
41
38
|
|
|
42
|
-
|
|
39
|
+
import {
|
|
43
40
|
handleError,
|
|
44
41
|
rmrf,
|
|
45
42
|
npmi,
|
|
46
43
|
deps,
|
|
47
44
|
hasConfiguration,
|
|
48
45
|
getConfiguration
|
|
49
|
-
}
|
|
46
|
+
} from '#deps/bin/common'
|
|
50
47
|
|
|
51
48
|
const {
|
|
52
49
|
env: {
|
|
@@ -75,6 +72,7 @@ function handleCommandError (e) {
|
|
|
75
72
|
const log = debug('@modernpoacher/deps:error')
|
|
76
73
|
if (code > 1) log(code)
|
|
77
74
|
log(message)
|
|
75
|
+
log(e)
|
|
78
76
|
}
|
|
79
77
|
}
|
|
80
78
|
|
|
@@ -152,7 +150,7 @@ async function iterate ([directory, ...directories] = [], registry, force, messa
|
|
|
152
150
|
const path = resolve(directory)
|
|
153
151
|
|
|
154
152
|
try {
|
|
155
|
-
log(
|
|
153
|
+
log(path)
|
|
156
154
|
|
|
157
155
|
if (path === await gitRevParse(path)) {
|
|
158
156
|
const ignore = await getIgnoreFromConfiguration(path)
|
|
@@ -196,7 +194,7 @@ async function executeFrom (directory, registry, force, message, author) {
|
|
|
196
194
|
const path = resolve(directory)
|
|
197
195
|
|
|
198
196
|
try {
|
|
199
|
-
log(
|
|
197
|
+
log(path)
|
|
200
198
|
|
|
201
199
|
if (path === await gitRevParse(path)) {
|
|
202
200
|
const ignore = await getIgnoreFromConfiguration(path)
|
|
@@ -217,7 +215,7 @@ async function executeOnly (directory, registry, force, message, author) {
|
|
|
217
215
|
const path = resolve(directory)
|
|
218
216
|
|
|
219
217
|
try {
|
|
220
|
-
log(
|
|
218
|
+
log(path)
|
|
221
219
|
|
|
222
220
|
if (path === await gitRevParse(path)) {
|
|
223
221
|
const ignore = await getIgnoreFromConfiguration(path)
|
|
@@ -238,7 +236,7 @@ async function executePath (directory, registry, force, message, author) {
|
|
|
238
236
|
const path = resolve(directory)
|
|
239
237
|
|
|
240
238
|
try {
|
|
241
|
-
log(
|
|
239
|
+
log(path)
|
|
242
240
|
|
|
243
241
|
if (path === await gitRevParse(path)) {
|
|
244
242
|
const ignore = await getIgnoreFromConfiguration(path)
|
|
@@ -268,6 +266,8 @@ async function executePath (directory, registry, force, message, author) {
|
|
|
268
266
|
async function app () {
|
|
269
267
|
log('Deps')
|
|
270
268
|
|
|
269
|
+
const commander = new Command()
|
|
270
|
+
|
|
271
271
|
const {
|
|
272
272
|
argv
|
|
273
273
|
} = process
|
|
@@ -337,4 +337,4 @@ async function app () {
|
|
|
337
337
|
log('Done.')
|
|
338
338
|
}
|
|
339
339
|
|
|
340
|
-
|
|
340
|
+
export default app()
|
|
@@ -1,38 +1,35 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import debug from 'debug'
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
import {
|
|
6
|
+
Command
|
|
7
|
+
} from 'commander'
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const {
|
|
10
|
-
version: VERSION
|
|
11
|
-
} = require('~/package')
|
|
12
|
-
|
|
13
|
-
const {
|
|
9
|
+
import {
|
|
10
|
+
VERSION,
|
|
14
11
|
PLATFORM
|
|
15
|
-
}
|
|
12
|
+
} from '#deps/src/common/env'
|
|
16
13
|
|
|
17
|
-
|
|
14
|
+
import {
|
|
18
15
|
getProdDependencies,
|
|
19
16
|
getDevDependencies,
|
|
20
17
|
getOptionalDependencies,
|
|
21
18
|
getBundleDependencies,
|
|
22
19
|
getPeerDependencies
|
|
23
|
-
}
|
|
20
|
+
} from '#deps/src/common'
|
|
24
21
|
|
|
25
|
-
|
|
22
|
+
import {
|
|
26
23
|
handleError,
|
|
27
24
|
hasPackage,
|
|
28
25
|
getPackage,
|
|
29
26
|
hasConfiguration,
|
|
30
27
|
getConfiguration
|
|
31
|
-
}
|
|
28
|
+
} from '#deps/bin/common'
|
|
32
29
|
|
|
33
|
-
|
|
30
|
+
import {
|
|
34
31
|
execute
|
|
35
|
-
}
|
|
32
|
+
} from '#deps/src/install'
|
|
36
33
|
|
|
37
34
|
const {
|
|
38
35
|
env: {
|
|
@@ -49,6 +46,8 @@ log(`\`install\` (${VERSION} - ${PLATFORM}) is awake`)
|
|
|
49
46
|
async function app () {
|
|
50
47
|
log('Deps')
|
|
51
48
|
|
|
49
|
+
const commander = new Command()
|
|
50
|
+
|
|
52
51
|
const {
|
|
53
52
|
argv
|
|
54
53
|
} = process
|
|
@@ -165,4 +164,4 @@ async function app () {
|
|
|
165
164
|
log('Done.')
|
|
166
165
|
}
|
|
167
166
|
|
|
168
|
-
|
|
167
|
+
export default app()
|
package/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '#deps/src'
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@modernpoacher/deps",
|
|
3
|
-
"
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "2.0.0-beta.0",
|
|
4
5
|
"description": "Update NPM package dependencies from the command line",
|
|
5
6
|
"keywords": [
|
|
6
7
|
"deps",
|
|
@@ -10,7 +11,7 @@
|
|
|
10
11
|
"bundleDependencies",
|
|
11
12
|
"peerDependencies"
|
|
12
13
|
],
|
|
13
|
-
"main": "./index.
|
|
14
|
+
"main": "./index.mjs",
|
|
14
15
|
"author": "Jonathan Perry for Modern Poacher Limited <modernpoacher@modernpoacher.com>",
|
|
15
16
|
"license": "MIT",
|
|
16
17
|
"engines": {
|
|
@@ -25,25 +26,18 @@
|
|
|
25
26
|
"url": "https://github.com/modernpoacher/deps/issues"
|
|
26
27
|
},
|
|
27
28
|
"scripts": {
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"dev-install": "cross-env DEBUG_COLORS=yes NODE_ENV=development node bin/install/app",
|
|
33
|
-
"build": "npm run babel",
|
|
34
|
-
"build:watch": "npm run babel:watch",
|
|
35
|
-
"clean": "rimraf lib",
|
|
36
|
-
"babel": "babel src -d lib",
|
|
37
|
-
"babel:watch": "npm run babel -- -w",
|
|
38
|
-
"lint": "eslint .",
|
|
29
|
+
"start": "cross-env DEBUG_COLORS=yes NODE_ENV=production node bin/app.mjs",
|
|
30
|
+
"dev": "cross-env DEBUG_COLORS=yes NODE_ENV=development node bin/app.mjs",
|
|
31
|
+
"dev-install": "cross-env DEBUG_COLORS=yes NODE_ENV=development node bin/install/app.mjs",
|
|
32
|
+
"lint": "eslint . --ext .cjs --ext .mjs",
|
|
39
33
|
"lint:fix": "npm run lint -- --fix",
|
|
40
34
|
"test": "cross-env DEBUG_COLORS=yes NODE_ENV=test mocha test --recursive -r @babel/register --verbose --color",
|
|
41
|
-
"pre-commit": "npm run lint && npm run test
|
|
35
|
+
"pre-commit": "npm run lint && npm run test"
|
|
42
36
|
},
|
|
43
37
|
"bin": {
|
|
44
|
-
"deps": "bin/app.
|
|
45
|
-
"deps-execute": "bin/execute/app.
|
|
46
|
-
"deps-install": "bin/install/app.
|
|
38
|
+
"deps": "bin/app.mjs",
|
|
39
|
+
"deps-execute": "bin/execute/app.mjs",
|
|
40
|
+
"deps-install": "bin/install/app.mjs",
|
|
47
41
|
"deps-deps": "bin/deps.sh",
|
|
48
42
|
"deps-wipe": "bin/wipe.sh",
|
|
49
43
|
"deps-push": "bin/push.sh",
|
|
@@ -53,7 +47,6 @@
|
|
|
53
47
|
"commander": "^10.0.0",
|
|
54
48
|
"debug": "^4.3.4",
|
|
55
49
|
"glob-all": "^3.3.1",
|
|
56
|
-
"module-alias": "^2.2.2",
|
|
57
50
|
"supports-color": "8.1.1"
|
|
58
51
|
},
|
|
59
52
|
"devDependencies": {
|
|
@@ -62,22 +55,27 @@
|
|
|
62
55
|
"@babel/eslint-parser": "^7.19.1",
|
|
63
56
|
"@babel/preset-env": "^7.20.2",
|
|
64
57
|
"@babel/register": "^7.18.9",
|
|
65
|
-
"babel-plugin-module-resolver": "^5.0.0",
|
|
66
58
|
"chai": "^4.3.7",
|
|
67
59
|
"core-js": "^3.27.2",
|
|
68
60
|
"cross-env": "^7.0.3",
|
|
69
61
|
"eslint": "^8.33.0",
|
|
70
62
|
"eslint-config-standard": "^17.0.0",
|
|
71
|
-
"eslint-import-resolver-babel-module": "^5.3.2",
|
|
72
63
|
"eslint-plugin-import": "^2.27.5",
|
|
73
64
|
"eslint-plugin-node": "^11.1.0",
|
|
74
65
|
"eslint-plugin-promise": "^6.1.1",
|
|
75
66
|
"husky": "^8.0.3",
|
|
76
|
-
"mocha": "^10.2.0"
|
|
77
|
-
"rimraf": "^4.1.2"
|
|
67
|
+
"mocha": "^10.2.0"
|
|
78
68
|
},
|
|
79
|
-
"
|
|
80
|
-
"
|
|
81
|
-
"
|
|
69
|
+
"imports": {
|
|
70
|
+
"#where-am-i": "./where-am-i.mjs",
|
|
71
|
+
"#deps/src/common/env": "./src/common/env/index.mjs",
|
|
72
|
+
"#deps/src/common/git": "./src/common/git/index.mjs",
|
|
73
|
+
"#deps/src/common": "./src/common/index.mjs",
|
|
74
|
+
"#deps/src/install": "./src/install/index.mjs",
|
|
75
|
+
"#deps/src/*": "./src/*.mjs",
|
|
76
|
+
"#deps/src": "./src/index.mjs",
|
|
77
|
+
"#deps/bin/common": "./bin/common/index.mjs",
|
|
78
|
+
"#deps/bin/*": "./bin/*.mjs",
|
|
79
|
+
"#deps/bin": "./bin/index.mjs"
|
|
82
80
|
}
|
|
83
81
|
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import debug from 'debug'
|
|
2
|
+
|
|
3
|
+
import PATH from '#where-am-i'
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
join
|
|
7
|
+
} from 'path'
|
|
8
|
+
|
|
9
|
+
import {
|
|
10
|
+
readFileSync
|
|
11
|
+
} from 'fs'
|
|
12
|
+
|
|
13
|
+
import {
|
|
14
|
+
platform
|
|
15
|
+
} from 'os'
|
|
16
|
+
|
|
17
|
+
const {
|
|
18
|
+
name: NAME,
|
|
19
|
+
version: VERSION
|
|
20
|
+
} = JSON.parse(readFileSync(join(PATH, 'package.json')))
|
|
21
|
+
|
|
22
|
+
const PLATFORM = platform()
|
|
23
|
+
|
|
24
|
+
const log = debug('@modernpoacher/deps')
|
|
25
|
+
|
|
26
|
+
log(`\`env\` (${NAME} - ${VERSION} - ${PLATFORM}) is awake`)
|
|
27
|
+
|
|
28
|
+
export {
|
|
29
|
+
NAME,
|
|
30
|
+
VERSION,
|
|
31
|
+
PLATFORM
|
|
32
|
+
}
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import debug from 'debug'
|
|
2
2
|
|
|
3
|
+
import PATH from '#where-am-i'
|
|
4
|
+
|
|
3
5
|
import {
|
|
4
6
|
resolve
|
|
5
7
|
} from 'path'
|
|
6
8
|
|
|
7
9
|
import {
|
|
8
10
|
PLATFORM
|
|
9
|
-
} from '
|
|
10
|
-
|
|
11
|
-
const {
|
|
12
|
-
path: MODULE_PATH
|
|
13
|
-
} = module
|
|
11
|
+
} from '#deps/src/common/env'
|
|
14
12
|
|
|
15
13
|
export const DIRECTORY = '.'
|
|
16
14
|
|
|
@@ -18,7 +16,7 @@ export const REGISTRY = 'https://registry.npmjs.org'
|
|
|
18
16
|
|
|
19
17
|
export const AUTHOR = 'Modern Poacher Limited <modernpoacher@modernpoacher.com>'
|
|
20
18
|
|
|
21
|
-
export const NVM = resolve(
|
|
19
|
+
export const NVM = resolve(PATH, 'nvm.sh')
|
|
22
20
|
|
|
23
21
|
const log = debug('@modernpoacher/deps')
|
|
24
22
|
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
|
|
11
11
|
import {
|
|
12
12
|
PLATFORM
|
|
13
|
-
} from '
|
|
13
|
+
} from '#deps/src/common/env'
|
|
14
14
|
|
|
15
15
|
import {
|
|
16
16
|
DIRECTORY,
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
transform,
|
|
28
28
|
getDepsExact,
|
|
29
29
|
getDeps
|
|
30
|
-
} from '
|
|
30
|
+
} from '#deps/src/common'
|
|
31
31
|
|
|
32
32
|
const log = debug('@modernpoacher/deps')
|
|
33
33
|
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
|
|
15
15
|
import {
|
|
16
16
|
PLATFORM
|
|
17
|
-
} from '
|
|
17
|
+
} from '#deps/src/common/env'
|
|
18
18
|
|
|
19
19
|
import {
|
|
20
20
|
DIRECTORY,
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
transform,
|
|
29
29
|
getDepsExact,
|
|
30
30
|
getDeps
|
|
31
|
-
} from '
|
|
31
|
+
} from '#deps/src/common'
|
|
32
32
|
|
|
33
33
|
const log = debug('@modernpoacher/deps:install')
|
|
34
34
|
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import debug from 'debug'
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
expect
|
|
5
|
+
} from 'chai'
|
|
4
6
|
|
|
5
7
|
import {
|
|
6
8
|
gitRevParse,
|
|
@@ -10,9 +12,9 @@ import {
|
|
|
10
12
|
gitPushTags,
|
|
11
13
|
gitAdd,
|
|
12
14
|
gitCommit
|
|
13
|
-
} from '
|
|
15
|
+
} from '#deps/src/common/git'
|
|
14
16
|
|
|
15
|
-
describe('
|
|
17
|
+
describe('#deps/src/common/git', () => {
|
|
16
18
|
before(() => {
|
|
17
19
|
const {
|
|
18
20
|
env: {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import debug from 'debug'
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
expect
|
|
5
|
+
} from 'chai'
|
|
4
6
|
|
|
5
7
|
import {
|
|
6
8
|
getSaveProdParameter,
|
|
@@ -22,9 +24,9 @@ import {
|
|
|
22
24
|
getOptionalDependencies,
|
|
23
25
|
getBundleDependencies,
|
|
24
26
|
getPeerDependencies
|
|
25
|
-
} from '
|
|
27
|
+
} from '#deps/src/common'
|
|
26
28
|
|
|
27
|
-
describe('
|
|
29
|
+
describe('#deps/src/common', () => {
|
|
28
30
|
before(() => {
|
|
29
31
|
const {
|
|
30
32
|
env: {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import debug from 'debug'
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
expect
|
|
5
|
+
} from 'chai'
|
|
4
6
|
|
|
5
7
|
import {
|
|
6
8
|
getInstallSaveProdSaveExactCommands,
|
|
@@ -25,9 +27,9 @@ import {
|
|
|
25
27
|
executeDev,
|
|
26
28
|
executeOptional,
|
|
27
29
|
executeBundle
|
|
28
|
-
} from '
|
|
30
|
+
} from '#deps/src'
|
|
29
31
|
|
|
30
|
-
describe('
|
|
32
|
+
describe('#deps/src', () => {
|
|
31
33
|
before(() => {
|
|
32
34
|
const {
|
|
33
35
|
env: {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import debug from 'debug'
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
expect
|
|
5
|
+
} from 'chai'
|
|
4
6
|
|
|
5
7
|
import {
|
|
6
8
|
getInstallSaveExactCommands,
|
|
@@ -8,9 +10,9 @@ import {
|
|
|
8
10
|
installSaveExact,
|
|
9
11
|
install,
|
|
10
12
|
execute
|
|
11
|
-
} from '
|
|
13
|
+
} from '#deps/src/install'
|
|
12
14
|
|
|
13
|
-
describe('
|
|
15
|
+
describe('#deps/src/install', () => {
|
|
14
16
|
before(() => {
|
|
15
17
|
const {
|
|
16
18
|
env: {
|
package/where-am-i.mjs
ADDED
package/index.js
DELETED
package/lib/common/env/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.PLATFORM=void 0;var _debug=_interopRequireDefault(require("debug"));var _os=require("os");function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}const PLATFORM=(0,_os.platform)();exports.PLATFORM=PLATFORM;const log=(0,_debug.default)('@modernpoacher/deps');log(`\`env\` (${PLATFORM}) is awake`);
|
package/lib/common/git/index.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.MESSAGE=exports.DIRECTORY=exports.AUTHOR=void 0;exports.catGitRefsRemotesOriginHead=catGitRefsRemotesOriginHead;exports.gitAdd=gitAdd;exports.gitCheckout=gitCheckout;exports.gitCommit=gitCommit;exports.gitPull=gitPull;exports.gitPush=gitPush;exports.gitPushTags=gitPushTags;exports.gitRevParse=gitRevParse;var _debug=_interopRequireDefault(require("debug"));var _path=require("path");var _child_process=require("child_process");var _env=require("../env");function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}const DIRECTORY='.';exports.DIRECTORY=DIRECTORY;const BRANCH='master';const ADD='package.json package-lock.json';const MESSAGE=_env.PLATFORM==='win32'?'Updated `package.json` &/ `package-lock.json`':'Updated \\`package.json\\` &/ \\`package-lock.json\\`';exports.MESSAGE=MESSAGE;const AUTHOR='Modern Poacher Limited <modernpoacher@modernpoacher.com>';exports.AUTHOR=AUTHOR;const OPTIONS={maxBuffer:1024*2000,shell:true,stdio:'inherit',env:{DEBUG_COLORS:'yes',FORCE_COLOR:_env.PLATFORM==='win32'?3:2}};const log=(0,_debug.default)('@modernpoacher/deps');log(`\`git\` (${_env.PLATFORM}) is awake`);const trim=v=>v.split('\n').map(v=>v.trimEnd()).join('\n').trim();function use(key){const log=(0,_debug.default)(`@modernpoacher/deps:${key}`);return function use(v){if(v.trim()==='')return;return log(trim(v));};}function out(key,directory){const log=(0,_debug.default)(`@modernpoacher/deps:${key}`);return function out(v){const s=v.trim();if(s===''||directory===s)return;return log(trim(s));};}function err(key,directory){const log=(0,_debug.default)(`@modernpoacher/deps:${key}`);return function err(v){const s=v.trim();if(s===''||directory===s||s.toLowerCase().startsWith('fatal: not a git repository'))return;return log(trim(s));};}const getErrorCode=({code=0}={})=>code;const getErrorMessage=({message=''}={})=>message;function getCatGitRefsRemotesOriginHeadCommands(){log('getCatGitRefsRemotesOriginHeadCommands');return`
|
|
2
|
-
DIR=$(echo "./.git/refs/remotes/origin/HEAD'" | sed -e "s/\\//\\\\\\/g" -e "s/://" | cat 2> /dev/null)
|
|
3
|
-
[[ $DIR =~ "[-0-9a-zA-Z]*$" ]]
|
|
4
|
-
echo "$\{BASH_REMATCH[0]}"
|
|
5
|
-
`;}function isCommandError(e){log('isCommandError');return getErrorCode(e)===1&&getErrorMessage(e).toLowerCase().startsWith('command failed:');}function catGitRefsRemotesOriginHead(directory=DIRECTORY){log('catGitRefsRemotesOriginHead');return new Promise((resolve,reject)=>{const commands=getCatGitRefsRemotesOriginHeadCommands();const{stdout,stderr}=(0,_child_process.exec)(commands,{...OPTIONS,cwd:(0,_path.normalize)(directory)},(e,v='')=>!e?resolve(trim(v)):reject(e));stdout.on('data',out('cat-git-refs-remotes-origin-head',directory.trim()));stderr.on('data',err('cat-git-refs-remotes-origin-head',directory.trim()));});}function gitRevParse(directory=DIRECTORY){log('gitRevParse');return new Promise((resolve,reject)=>{const commands='git rev-parse --show-toplevel';const{stdout,stderr}=(0,_child_process.exec)(commands,{...OPTIONS,cwd:(0,_path.normalize)(directory)},(e,v='')=>!e?resolve(trim(v)):reject(e));stdout.on('data',out('git-rev-parse',directory.trim()));stderr.on('data',err('git-rev-parse',directory.trim()));});}function gitCheckout(directory=DIRECTORY,branch=BRANCH){log('gitCheckout');return new Promise((resolve,reject)=>{const log=use('git-checkout');const commands=`git checkout ${branch}`;const{stdout,stderr}=(0,_child_process.exec)(commands,{...OPTIONS,cwd:(0,_path.normalize)(directory)},(e,v)=>e?isCommandError(e)?resolve(v):reject(e):resolve(v));stdout.on('data',log);stderr.on('data',log);});}function gitPull(directory=DIRECTORY){log('gitPull');return new Promise((resolve,reject)=>{const log=use('git-pull');const commands='git pull';const{stdout,stderr}=(0,_child_process.exec)(commands,{...OPTIONS,cwd:(0,_path.normalize)(directory)},(e,v)=>e?isCommandError(e)?resolve(v):reject(e):resolve(v));stdout.on('data',log);stderr.on('data',log);});}function gitPush(directory=DIRECTORY){log('gitPush');return new Promise((resolve,reject)=>{const log=use('git-push');const commands='git push';const{stdout,stderr}=(0,_child_process.exec)(commands,{...OPTIONS,cwd:(0,_path.normalize)(directory)},(e,v)=>e?isCommandError(e)?resolve(v):reject(e):resolve(v));stdout.on('data',log);stderr.on('data',log);});}function gitPushTags(directory=DIRECTORY){log('gitPushTags');return new Promise((resolve,reject)=>{const log=use('git-push-tags');const commands='git push --tags';const{stdout,stderr}=(0,_child_process.exec)(commands,{...OPTIONS,cwd:(0,_path.normalize)(directory)},(e,v)=>e?isCommandError(e)?resolve(v):reject(e):resolve(v));stdout.on('data',log);stderr.on('data',log);});}function gitAdd(directory=DIRECTORY,add=ADD){log('gitAdd');return new Promise((resolve,reject)=>{const log=use('git-add');const commands=`git add ${add}`;const{stdout,stderr}=(0,_child_process.exec)(commands,{...OPTIONS,cwd:(0,_path.normalize)(directory)},(e,v)=>e?isCommandError(e)?resolve(v):reject(e):resolve(v));stdout.on('data',log);stderr.on('data',log);});}function gitCommit(directory=DIRECTORY,message=MESSAGE,author=AUTHOR){log('gitCommit');return new Promise((resolve,reject)=>{const log=use('git-commit');const commands=`git commit -m "${message}" --author "${author}"`;const{stdout,stderr}=(0,_child_process.exec)(commands,{...OPTIONS,cwd:(0,_path.normalize)(directory)},(e,v)=>e?isCommandError(e)?resolve(v):reject(e):resolve(v));stdout.on('data',log);stderr.on('data',log);});}
|
package/lib/common/index.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
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.getIgnore=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
|
-
export PATH=/usr/local/bin:$PATH &> /dev/null
|
|
3
|
-
. "${NVM}" 2> /dev/null
|
|
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 getIgnore=({ignore=false}={})=>ignore===true;exports.getIgnore=getIgnore;const getAuthor=({author}={})=>String(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/lib/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.executeBundle=executeBundle;exports.executeDev=executeDev;exports.executeOptional=executeOptional;exports.executeProd=executeProd;exports.getInstallCommands=getInstallCommands;exports.getInstallSaveBundleCommands=getInstallSaveBundleCommands;exports.getInstallSaveBundleSaveExactCommands=getInstallSaveBundleSaveExactCommands;exports.getInstallSaveDevCommands=getInstallSaveDevCommands;exports.getInstallSaveDevSaveExactCommands=getInstallSaveDevSaveExactCommands;exports.getInstallSaveExactCommands=getInstallSaveExactCommands;exports.getInstallSaveOptionalCommands=getInstallSaveOptionalCommands;exports.getInstallSaveOptionalSaveExactCommands=getInstallSaveOptionalSaveExactCommands;exports.getInstallSaveProdCommands=getInstallSaveProdCommands;exports.getInstallSaveProdSaveExactCommands=getInstallSaveProdSaveExactCommands;exports.installSaveBundle=installSaveBundle;exports.installSaveBundleSaveExact=installSaveBundleSaveExact;exports.installSaveDev=installSaveDev;exports.installSaveDevSaveExact=installSaveDevSaveExact;exports.installSaveOptional=installSaveOptional;exports.installSaveOptionalSaveExact=installSaveOptionalSaveExact;exports.installSaveProd=installSaveProd;exports.installSaveProdSaveExact=installSaveProdSaveExact;var _debug=_interopRequireDefault(require("debug"));var _path=require("path");var _child_process=require("child_process");var _env=require("./common/env");var _common=require("./common");function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}const log=(0,_debug.default)('@modernpoacher/deps');log(`\`deps\` (${_env.PLATFORM}) is awake`);const OPTIONS={maxBuffer:1024*2000,shell:true,stdio:'inherit',env:{DEBUG_COLORS:'yes',FORCE_COLOR:_env.PLATFORM==='win32'?3:2}};function use(key){const log=(0,_debug.default)(`@modernpoacher/deps:${key}`);return function use(v){const s=v.trim();if(s==='')return;return log(s);};}function getInstallSaveExactCommands(p,r,f){log('getInstallSaveExactCommands');const c=(0,_common.transform)(p);const commands=`npm i ${c}`;return(0,_common.normalizeCommands)((0,_common.getRegistryParameter)(r,(0,_common.getForceParameter)(f,(0,_common.getSaveExactParameter)(commands))));}function getInstallCommands(p,r,f){log('getInstallCommands');const c=(0,_common.transform)(p);const commands=`npm i ${c}`;return(0,_common.normalizeCommands)((0,_common.getRegistryParameter)(r,(0,_common.getForceParameter)(f,commands)));}function getInstallSaveBundleSaveExactCommands(p,r,f){log('getInstallSaveBundleSaveExactCommands');const commands=getInstallSaveExactCommands(p,r,f);return(0,_common.normalizeCommands)((0,_common.getSaveBundleParameter)(commands));}function getInstallSaveBundleCommands(p,r,f){log('getInstallSaveBundleCommands');const commands=getInstallCommands(p,r,f);return(0,_common.normalizeCommands)((0,_common.getSaveBundleParameter)(commands));}function getInstallSaveOptionalSaveExactCommands(p,r,f){log('getInstallSaveOptionalSaveExactCommands');const commands=getInstallSaveExactCommands(p,r,f);return(0,_common.normalizeCommands)((0,_common.getSaveOptionalParameter)(commands));}function getInstallSaveOptionalCommands(p,r,f){log('getInstallSaveOptionalCommands');const commands=getInstallCommands(p,r,f);return(0,_common.normalizeCommands)((0,_common.getSaveOptionalParameter)(commands));}function getInstallSaveDevSaveExactCommands(p,r,f){log('getInstallSaveDevSaveExactCommands');const commands=getInstallSaveExactCommands(p,r,f);return(0,_common.normalizeCommands)((0,_common.getSaveDevParameter)(commands));}function getInstallSaveDevCommands(p,r,f){log('getInstallSaveDevCommands');const commands=getInstallCommands(p,r,f);return(0,_common.normalizeCommands)((0,_common.getSaveDevParameter)(commands));}function getInstallSaveProdSaveExactCommands(p,r,f){log('getInstallSaveProdSaveExactCommands');const commands=getInstallSaveExactCommands(p,r,f);return(0,_common.normalizeCommands)((0,_common.getSaveProdParameter)(commands));}function getInstallSaveProdCommands(p,r,f){log('getInstallSaveProdCommands');const commands=getInstallCommands(p,r,f);return(0,_common.normalizeCommands)((0,_common.getSaveProdParameter)(commands));}function installSaveBundleSaveExact(d,p,r,f){log('installSaveBundleSaveExact');return new Promise((resolve,reject)=>{const log=use('install-save-bundle-save-exact');const commands=(0,_common.getCommands)(d,getInstallSaveBundleSaveExactCommands(p,r,f));const{stdout,stderr}=(0,_child_process.exec)(commands,{...OPTIONS,cwd:(0,_path.normalize)(d)},(e,v)=>!e?resolve(v):reject(e));stdout.on('data',log);stderr.on('data',log);});}function installSaveBundle(d,p,r,f){log('installSaveBundle');return new Promise((resolve,reject)=>{const log=use('install-save-bundle');const commands=(0,_common.getCommands)(d,getInstallSaveBundleCommands(p,r,f));const{stdout,stderr}=(0,_child_process.exec)(commands,{...OPTIONS,cwd:(0,_path.normalize)(d)},(e,v)=>!e?resolve(v):reject(e));stdout.on('data',log);stderr.on('data',log);});}function installSaveOptionalSaveExact(d,p,r,f){log('installSaveOptionalSaveExact');return new Promise((resolve,reject)=>{const log=use('install-save-otional-save-exact');const commands=(0,_common.getCommands)(d,getInstallSaveOptionalSaveExactCommands(p,r,f));const{stdout,stderr}=(0,_child_process.exec)(commands,{...OPTIONS,cwd:(0,_path.normalize)(d)},(e,v)=>!e?resolve(v):reject(e));stdout.on('data',log);stderr.on('data',log);});}function installSaveOptional(d,p,r,f){log('installSaveOptional');return new Promise((resolve,reject)=>{const log=use('install-save-otional');const commands=(0,_common.getCommands)(d,getInstallSaveOptionalCommands(p,r,f));const{stdout,stderr}=(0,_child_process.exec)(commands,{...OPTIONS,cwd:(0,_path.normalize)(d)},(e,v)=>!e?resolve(v):reject(e));stdout.on('data',log);stderr.on('data',log);});}function installSaveDevSaveExact(d,p,r,f){log('installSaveDevSaveExact');return new Promise((resolve,reject)=>{const log=use('install-save-dev-save-exact');const commands=(0,_common.getCommands)(d,getInstallSaveDevSaveExactCommands(p,r,f));const{stdout,stderr}=(0,_child_process.exec)(commands,{...OPTIONS,cwd:(0,_path.normalize)(d)},(e,v)=>!e?resolve(v):reject(e));stdout.on('data',log);stderr.on('data',log);});}function installSaveDev(d,p,r,f){log('installSaveDev');return new Promise((resolve,reject)=>{const log=use('install-save-dev');const commands=(0,_common.getCommands)(d,getInstallSaveDevCommands(p,r,f));const{stdout,stderr}=(0,_child_process.exec)(commands,{...OPTIONS,cwd:(0,_path.normalize)(d)},(e,v)=>!e?resolve(v):reject(e));stdout.on('data',log);stderr.on('data',log);});}function installSaveProdSaveExact(d,p,r,f){log('installSaveProdSaveExact');return new Promise((resolve,reject)=>{const log=use('install-save-prod-save-exact');const commands=(0,_common.getCommands)(d,getInstallSaveProdSaveExactCommands(p,r,f));const{stdout,stderr}=(0,_child_process.exec)(commands,{...OPTIONS,cwd:(0,_path.normalize)(d)},(e,v)=>!e?resolve(v):reject(e));stdout.on('data',log);stderr.on('data',log);});}function installSaveProd(d,p,r,f){log('installSaveProd');return new Promise((resolve,reject)=>{const log=use('install-save-prod');const commands=(0,_common.getCommands)(d,getInstallSaveProdCommands(p,r,f));const{stdout,stderr}=(0,_child_process.exec)(commands,{...OPTIONS,cwd:(0,_path.normalize)(d)},(e,v)=>!e?resolve(v):reject(e));stdout.on('data',log);stderr.on('data',log);});}async function executeBundle(directory=_common.DIRECTORY,packages={},configuration={},registry=_common.REGISTRY,force=false){log('executeBundle');const depsExact=(0,_common.getDepsExact)(packages,configuration);if(depsExact.length)await installSaveBundleSaveExact(directory,depsExact,registry,force);const deps=(0,_common.getDeps)(packages);if(deps.length)await installSaveBundle(directory,deps,registry,force);}async function executeOptional(directory=_common.DIRECTORY,packages={},configuration={},registry=_common.REGISTRY,force=false){log('executeOptional');const depsExact=(0,_common.getDepsExact)(packages,configuration);if(depsExact.length)await installSaveOptionalSaveExact(directory,depsExact,registry,force);const deps=(0,_common.getDeps)(packages);if(deps.length)await installSaveOptional(directory,deps,registry,force);}async function executeDev(directory=_common.DIRECTORY,packages={},configuration={},registry=_common.REGISTRY,force=false){log('executeDev');const depsExact=(0,_common.getDepsExact)(packages,configuration);if(depsExact.length)await installSaveDevSaveExact(directory,depsExact,registry,force);const deps=(0,_common.getDeps)(packages);if(deps.length)await installSaveDev(directory,deps,registry,force);}async function executeProd(directory=_common.DIRECTORY,packages={},configuration={},registry=_common.REGISTRY,force=false){log('executeProd');const depsExact=(0,_common.getDepsExact)(packages,configuration);if(depsExact.length)await installSaveProdSaveExact(directory,depsExact,registry,force);const deps=(0,_common.getDeps)(packages);if(deps.length)await installSaveProd(directory,deps,registry,force);}
|
package/lib/install/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.execute=execute;exports.getInstallCommands=getInstallCommands;exports.getInstallSaveExactCommands=getInstallSaveExactCommands;exports.install=install;exports.installSaveExact=installSaveExact;var _debug=_interopRequireDefault(require("debug"));var _path=require("path");var _os=require("os");var _child_process=require("child_process");var _env=require("../common/env");var _common=require("../common");function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}const log=(0,_debug.default)('@modernpoacher/deps:install');log(`\`install\` (${_os.platform}) is awake`);const OPTIONS={maxBuffer:1024*2000,shell:true,stdio:'inherit',env:{DEBUG_COLORS:'yes',FORCE_COLOR:_env.PLATFORM==='win32'?3:2}};function getInstallSaveExactCommands(p,s,r,f){log('getInstallSaveExactCommands');const c=(0,_common.transform)(p);const commands=`npm i ${c}`;return(0,_common.normalizeCommands)((0,_common.getNoSaveParameter)(s,(0,_common.getRegistryParameter)(r,(0,_common.getForceParameter)(f,(0,_common.getSaveExactParameter)(commands)))));}function getInstallCommands(p,s,r,f){log('getInstallCommands');const c=(0,_common.transform)(p);const commands=`npm i ${c}`;return(0,_common.normalizeCommands)((0,_common.getNoSaveParameter)(s,(0,_common.getRegistryParameter)(r,(0,_common.getForceParameter)(f,commands))));}function installSaveExact(d,p,s,r,f){log('installSaveExact');return new Promise((resolve,reject)=>{const commands=(0,_common.getCommands)(d,getInstallSaveExactCommands(p,s,r,f));const{stdout,stderr}=(0,_child_process.exec)(commands,{...OPTIONS,cwd:(0,_path.normalize)(d)},(e,v)=>!e?resolve(v):reject(e));stdout.on('data',log);stderr.on('data',log);});}function install(d,p,s,r,f){log('install');return new Promise((resolve,reject)=>{const commands=(0,_common.getCommands)(d,getInstallCommands(p,s,r,f));const{stdout,stderr}=(0,_child_process.exec)(commands,{...OPTIONS,cwd:(0,_path.normalize)(d)},(e,v)=>!e?resolve(v):reject(e));stdout.on('data',log);stderr.on('data',log);});}async function execute(directory=_common.DIRECTORY,packages={},configuration={},save=false,registry=_common.REGISTRY,force=false){log('execute');const depsExact=(0,_common.getDepsExact)(packages,configuration);if(depsExact.length)await installSaveExact(directory,depsExact,save,registry,force);const deps=(0,_common.getDeps)(packages);if(deps.length)await install(directory,deps,save,registry,force);}
|
package/src/common/env/index.js
DELETED