@platformatic/watt-extra 1.9.1 → 1.10.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.
@@ -14,7 +14,8 @@
14
14
  "Bash(do echo \"Run $i:\")",
15
15
  "Bash(done)",
16
16
  "Bash(git stash:*)",
17
- "Bash(echo:*)"
17
+ "Bash(echo:*)",
18
+ "Bash(grep:*)"
18
19
  ],
19
20
  "deny": [],
20
21
  "ask": []
package/cli.js CHANGED
@@ -20,14 +20,20 @@ const pkg = JSON.parse(readFileSync(new URL('./package.json', import.meta.url),
20
20
  const commistInstance = commist()
21
21
 
22
22
  function version () {
23
- console.log(getSimpleBanner(pkg.version))
24
- logger.info(`WattExtra v${pkg.version}`)
23
+ if (process.stdout.isTTY) {
24
+ console.log(getSimpleBanner(pkg.version))
25
+ } else {
26
+ logger.info(`WattExtra v${pkg.version}`)
27
+ }
25
28
  }
26
29
 
27
30
  // Handle start command
28
31
  async function startCommand (argv) {
29
- const banner = getSimpleBanner(pkg.version)
30
- console.log(banner)
32
+ if (process.stdout.isTTY) {
33
+ console.log(getSimpleBanner(pkg.version))
34
+ } else {
35
+ logger.info(`WattExtra v${pkg.version}`)
36
+ }
31
37
 
32
38
  const args = minimist(argv, {
33
39
  alias: {
package/index.js CHANGED
@@ -4,13 +4,15 @@ import { fileURLToPath } from 'node:url'
4
4
 
5
5
  const logger = pino({
6
6
  level: process.env.PLT_LOG_LEVEL || 'info',
7
- transport: {
8
- target: 'pino-pretty',
9
- options: {
10
- colorize: true,
11
- translateTime: true
7
+ ...(process.stdout.isTTY && {
8
+ transport: {
9
+ target: 'pino-pretty',
10
+ options: {
11
+ colorize: true,
12
+ translateTime: true
13
+ }
12
14
  }
13
- }
15
+ })
14
16
  })
15
17
 
16
18
  // This starts the app and sends the info to ICC, so it's the main entry point
package/lib/watt.js CHANGED
@@ -156,7 +156,7 @@ class Watt {
156
156
  this.#logger.info('Creating runtime')
157
157
  const { create, transform } = this.#require('@platformatic/runtime')
158
158
 
159
- this.#logger.info('Building runtime')
159
+ this.#logger.info('Creating runtime')
160
160
 
161
161
  const runtime = await create(this.#appDir, null, {
162
162
  isProduction: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platformatic/watt-extra",
3
- "version": "1.9.1",
3
+ "version": "1.10.0",
4
4
  "description": "The Platformatic runtime manager",
5
5
  "type": "module",
6
6
  "scripts": {
package/test/cli.test.js CHANGED
@@ -73,3 +73,20 @@ test('CLI should show version with version command', async (t) => {
73
73
  'Version output should include version number'
74
74
  )
75
75
  })
76
+
77
+ test('CLI should output JSON log without banner in non-TTY mode (version command)', async (t) => {
78
+ const { code, stdout } = await runCLI(['version'])
79
+ assert.strictEqual(code, 0, 'Process should exit with code 0')
80
+
81
+ // In non-TTY mode, should NOT have the banner box characters
82
+ assert.ok(
83
+ !stdout.includes('+======'),
84
+ 'Non-TTY output should not include banner box'
85
+ )
86
+
87
+ // Should have JSON log with version
88
+ assert.ok(
89
+ stdout.includes('"msg":"WattExtra v'),
90
+ 'Non-TTY output should include JSON log with version'
91
+ )
92
+ })