@toa.io/cli 0.2.0-dev.2 → 0.2.0-dev.3
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toa.io/cli",
|
|
3
|
-
"version": "0.2.0-dev.
|
|
3
|
+
"version": "0.2.0-dev.3+8334154",
|
|
4
4
|
"description": "Toa CLI",
|
|
5
5
|
"author": "temich <tema.gurtovoy@gmail.com>",
|
|
6
6
|
"homepage": "https://github.com/toa-io/toa#readme",
|
|
@@ -22,5 +22,5 @@
|
|
|
22
22
|
"find-up": "5.0.0",
|
|
23
23
|
"yargs": "17.2.1"
|
|
24
24
|
},
|
|
25
|
-
"gitHead": "
|
|
25
|
+
"gitHead": "8334154c1b8a8268ad90adfb15b43a876459014f"
|
|
26
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,8 +9,13 @@ 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
|
+
})
|
|
12
16
|
.option('no-wait', {
|
|
13
|
-
boolean: true
|
|
17
|
+
boolean: true,
|
|
18
|
+
desc: 'Disable waiting for deployment ready state'
|
|
14
19
|
})
|
|
15
20
|
.usage('Usage: toa deploy /path/to/context')
|
|
16
21
|
.commandDir('./deploy')
|
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
|
@@ -7,10 +7,13 @@ const { context: find } = require('../util/find')
|
|
|
7
7
|
const deploy = async (argv) => {
|
|
8
8
|
const path = find(argv.path)
|
|
9
9
|
const deployment = await boot.deployment(path)
|
|
10
|
-
const images = await boot.images(path)
|
|
11
10
|
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
const options = {
|
|
12
|
+
wait: argv['no-wait'] !== true,
|
|
13
|
+
dry: argv.dry === true
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
await deployment.install(options)
|
|
14
17
|
}
|
|
15
18
|
|
|
16
19
|
exports.deploy = deploy
|
package/src/program.js
CHANGED
|
@@ -17,7 +17,7 @@ yargs(process.argv.slice(2))
|
|
|
17
17
|
.fail((msg, err) => {
|
|
18
18
|
const actual = err || new Error(msg)
|
|
19
19
|
|
|
20
|
-
console.error(actual)
|
|
20
|
+
console.error(process.env.TOA_ENV === 'local' ? actual : actual.message)
|
|
21
21
|
|
|
22
22
|
process.exit(actual.exitCode > 0 ? actual.exitCode : 1)
|
|
23
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)
|