@toa.io/cli 0.24.0-alpha.18 → 0.24.0-alpha.19

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.24.0-alpha.18",
3
+ "version": "0.24.0-alpha.19",
4
4
  "description": "Toa CLI",
5
5
  "author": "temich <tema.gurtovoy@gmail.com>",
6
6
  "homepage": "https://github.com/toa-io/toa#readme",
@@ -22,16 +22,16 @@
22
22
  "@toa.io/runtime": "*"
23
23
  },
24
24
  "dependencies": {
25
- "@toa.io/console": "0.24.0-alpha.18",
26
- "@toa.io/generic": "0.24.0-alpha.18",
27
- "@toa.io/kubernetes": "0.24.0-alpha.18",
28
- "@toa.io/norm": "0.24.0-alpha.18",
29
- "@toa.io/operations": "0.24.0-alpha.18",
30
- "@toa.io/yaml": "0.24.0-alpha.18",
25
+ "@toa.io/console": "0.24.0-alpha.19",
26
+ "@toa.io/generic": "0.24.0-alpha.19",
27
+ "@toa.io/kubernetes": "0.24.0-alpha.19",
28
+ "@toa.io/norm": "0.24.0-alpha.19",
29
+ "@toa.io/operations": "0.24.0-alpha.19",
30
+ "@toa.io/yaml": "0.24.0-alpha.19",
31
31
  "dotenv": "16.1.1",
32
32
  "find-up": "5.0.0",
33
33
  "paseto": "3.1.4",
34
34
  "yargs": "17.6.2"
35
35
  },
36
- "gitHead": "d5bd28a7152bbd99724c54740abea2cc2de8e98e"
36
+ "gitHead": "5e251e2f9ec49448c0a038d7aa07b01ba2b8d065"
37
37
  }
package/readme.md CHANGED
@@ -100,7 +100,8 @@ found and replayed sequentially.
100
100
  <dd>Print normalized manifest.
101
101
 
102
102
  <code>--path</code> path to component (default <code>.</code>)<br/>
103
- <code>--error</code> print errors only
103
+ <code>--error</code> print errors only<br/>
104
+ <code>--output</code> output format (default <code>yaml</code>)
104
105
  </dd>
105
106
  </dl>
106
107
 
@@ -17,6 +17,13 @@ const builder = (yargs) => {
17
17
  desc: 'Path to component',
18
18
  default: '.'
19
19
  })
20
+ .option('output', {
21
+ alias: 'o',
22
+ group: 'Command options:',
23
+ choices: ['yaml', 'json'],
24
+ desc: 'Output format',
25
+ default: 'yaml'
26
+ })
20
27
  }
21
28
 
22
29
  exports.command = ['manifest', 'man']
@@ -6,11 +6,6 @@ const { deployment: { Factory } } = require('@toa.io/operations')
6
6
 
7
7
  const find = require('../../util/find')
8
8
 
9
- /**
10
- * @param {string} contextPath
11
- * @param {string[]} componentPatterns
12
- * @return {Promise<string>}
13
- */
14
9
  async function build (contextPath, componentPatterns) {
15
10
  const context = await createContext(contextPath, componentPatterns)
16
11
  const factory = new Factory(context)
@@ -23,11 +18,6 @@ async function build (contextPath, componentPatterns) {
23
18
  return `${context.registry.base === undefined ? '' : context.registry.base + '/'}${context.name}/composition-${composition}`
24
19
  }
25
20
 
26
- /**
27
- * @param {string} contextPath
28
- * @param {string[]} componentPatterns
29
- * @return {Promise<toa.norm.Context>}
30
- */
31
21
  async function createContext (contextPath, componentPatterns) {
32
22
  const contextRoot = find.context(contextPath)
33
23
  const context = await norm.context(contextRoot, 'docker')
@@ -27,11 +27,11 @@ async function run (repository, command, envFile) {
27
27
  const args = ['run', '--rm', ...envArgs, id, 'sh', '-c', command]
28
28
  const done = promex()
29
29
 
30
- const running = await spawn('docker', args, { stdio: 'inherit' })
30
+ const running = spawn('docker', args, { stdio: 'inherit' })
31
31
 
32
32
  running.on('exit', done.resolve)
33
33
 
34
- await done
34
+ const code = await done
35
35
 
36
36
  await execute(`docker rmi --force ${id}`)
37
37
  }
@@ -1,8 +1,8 @@
1
1
  'use strict'
2
2
 
3
3
  const { component } = require('@toa.io/norm')
4
- const { dump } = require('@toa.io/yaml')
5
4
  const { console } = require('@toa.io/console')
5
+ const yaml = require('@toa.io/yaml')
6
6
 
7
7
  const { components: find } = require('../../util/find')
8
8
 
@@ -13,7 +13,13 @@ const print = async (argv) => {
13
13
 
14
14
  const manifest = await component(path)
15
15
 
16
- if (argv.error !== true) console.log(dump(manifest))
16
+ if (argv.error !== true) {
17
+ const result = argv.output === 'json'
18
+ ? JSON.stringify(manifest, null, 2)
19
+ : yaml.dump(manifest)
20
+
21
+ console.log(result)
22
+ }
17
23
  }
18
24
 
19
25
  exports.manifest = print