@toa.io/cli 0.1.1-dev.3 → 0.2.0-alpha.4
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/package.json +3 -6
- package/src/commands/deploy/export.js +7 -3
- package/src/commands/deploy.js +8 -0
- package/src/handlers/compose.js +4 -1
- package/src/handlers/deploy/export.js +1 -1
- package/src/handlers/deploy.js +8 -3
- package/src/program.js +5 -6
- package/src/util/find.js +9 -3
- package/bin/toa +0 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toa.io/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0-alpha.4+5884c85",
|
|
4
4
|
"description": "Toa CLI",
|
|
5
5
|
"author": "temich <tema.gurtovoy@gmail.com>",
|
|
6
6
|
"homepage": "https://github.com/toa-io/toa#readme",
|
|
@@ -11,10 +11,7 @@
|
|
|
11
11
|
"bugs": {
|
|
12
12
|
"url": "https://github.com/toa-io/toa/issues"
|
|
13
13
|
},
|
|
14
|
-
"main": "
|
|
15
|
-
"bin": {
|
|
16
|
-
"toa": "bin/toa"
|
|
17
|
-
},
|
|
14
|
+
"main": "src/program.js",
|
|
18
15
|
"publishConfig": {
|
|
19
16
|
"access": "public"
|
|
20
17
|
},
|
|
@@ -25,5 +22,5 @@
|
|
|
25
22
|
"find-up": "5.0.0",
|
|
26
23
|
"yargs": "17.2.1"
|
|
27
24
|
},
|
|
28
|
-
"gitHead": "
|
|
25
|
+
"gitHead": "5884c8590499e85e701c41e54b9d20a47e8a4ec5"
|
|
29
26
|
}
|
|
@@ -9,10 +9,14 @@ const builder = (yargs) => {
|
|
|
9
9
|
desc: 'Path to context',
|
|
10
10
|
default: '.'
|
|
11
11
|
})
|
|
12
|
-
.
|
|
12
|
+
.positional('target', {
|
|
13
|
+
type: 'string',
|
|
14
|
+
desc: 'Export target path'
|
|
15
|
+
})
|
|
16
|
+
.usage('Usage: toa deploy export /path/to/context /export/path')
|
|
13
17
|
}
|
|
14
18
|
|
|
15
|
-
exports.command = 'export [path]'
|
|
16
|
-
exports.desc = 'Export context deployment'
|
|
19
|
+
exports.command = 'export [path] [target]'
|
|
20
|
+
exports.desc = 'Export context deployment chart'
|
|
17
21
|
exports.builder = builder
|
|
18
22
|
exports.handler = dump
|
package/src/commands/deploy.js
CHANGED
|
@@ -9,6 +9,14 @@ const builder = (yargs) => {
|
|
|
9
9
|
desc: 'Path to context',
|
|
10
10
|
default: '.'
|
|
11
11
|
})
|
|
12
|
+
.option('dry', {
|
|
13
|
+
boolean: true,
|
|
14
|
+
desc: 'Dry run'
|
|
15
|
+
})
|
|
16
|
+
.option('no-wait', {
|
|
17
|
+
boolean: true,
|
|
18
|
+
desc: 'Disable waiting for deployment ready state'
|
|
19
|
+
})
|
|
12
20
|
.usage('Usage: toa deploy /path/to/context')
|
|
13
21
|
.commandDir('./deploy')
|
|
14
22
|
}
|
package/src/handlers/compose.js
CHANGED
|
@@ -5,7 +5,10 @@ const boot = require('@toa.io/boot')
|
|
|
5
5
|
const { manifest: find } = require('../util/find')
|
|
6
6
|
|
|
7
7
|
async function compose (argv) {
|
|
8
|
-
const paths =
|
|
8
|
+
const paths = find(argv.paths)
|
|
9
|
+
|
|
10
|
+
if (paths === undefined) throw new Error(`No components found in ${argv.paths}`)
|
|
11
|
+
|
|
9
12
|
const composition = await boot.composition(paths, argv)
|
|
10
13
|
|
|
11
14
|
await composition.connect()
|
|
@@ -8,7 +8,7 @@ const { context: find } = require('../../util/find')
|
|
|
8
8
|
const dump = async (argv) => {
|
|
9
9
|
const context = find(argv.path)
|
|
10
10
|
const deployment = await boot.deployment(context)
|
|
11
|
-
const path = await deployment.export()
|
|
11
|
+
const path = await deployment.export(argv.target)
|
|
12
12
|
|
|
13
13
|
console.log(path)
|
|
14
14
|
}
|
package/src/handlers/deploy.js
CHANGED
|
@@ -5,10 +5,15 @@ const boot = require('@toa.io/boot')
|
|
|
5
5
|
const { context: find } = require('../util/find')
|
|
6
6
|
|
|
7
7
|
const deploy = async (argv) => {
|
|
8
|
-
const
|
|
9
|
-
const deployment = await boot.deployment(
|
|
8
|
+
const path = find(argv.path)
|
|
9
|
+
const deployment = await boot.deployment(path)
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
const options = {
|
|
12
|
+
wait: argv['no-wait'] !== true,
|
|
13
|
+
dry: argv.dry === true
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
await deployment.install(options)
|
|
12
17
|
}
|
|
13
18
|
|
|
14
19
|
exports.deploy = deploy
|
package/src/program.js
CHANGED
|
@@ -6,19 +6,18 @@ const { console } = require('@toa.io/gears')
|
|
|
6
6
|
const { version } = require('../package.json')
|
|
7
7
|
|
|
8
8
|
yargs(process.argv.slice(2))
|
|
9
|
+
.parserConfiguration({
|
|
10
|
+
'boolean-negation': false
|
|
11
|
+
})
|
|
9
12
|
.middleware((argv) => {
|
|
10
|
-
if (argv.log === undefined)
|
|
11
|
-
if (process.env.TOA_ENV === 'dev') argv.log = 'info'
|
|
12
|
-
else argv.log = 'warn'
|
|
13
|
-
}
|
|
13
|
+
if (argv.log === undefined) argv.log = 'info'
|
|
14
14
|
|
|
15
15
|
console.level(argv.log)
|
|
16
16
|
})
|
|
17
17
|
.fail((msg, err) => {
|
|
18
18
|
const actual = err || new Error(msg)
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
else console.error(actual.message)
|
|
20
|
+
console.error(process.env.TOA_ENV === 'local' ? actual : actual.message)
|
|
22
21
|
|
|
23
22
|
process.exit(actual.exitCode > 0 ? actual.exitCode : 1)
|
|
24
23
|
})
|
package/src/util/find.js
CHANGED
|
@@ -4,11 +4,17 @@ const { dirname, resolve } = require('node:path')
|
|
|
4
4
|
const findUp = require('find-up')
|
|
5
5
|
|
|
6
6
|
const find = (from = '.', filename) => {
|
|
7
|
-
|
|
7
|
+
if (from instanceof Array) {
|
|
8
|
+
const found = new Set(from.map((path) => find(path, filename)))
|
|
9
|
+
|
|
10
|
+
found.delete(undefined)
|
|
8
11
|
|
|
9
|
-
|
|
12
|
+
return found.size > 0 ? [...found] : undefined
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const path = findUp.sync(filename, { cwd: resolve(process.cwd(), from) })
|
|
10
16
|
|
|
11
|
-
return dirname(path)
|
|
17
|
+
return path === undefined ? undefined : dirname(path)
|
|
12
18
|
}
|
|
13
19
|
|
|
14
20
|
const manifest = (from = '.') => find(from, MANIFEST)
|
package/bin/toa
DELETED