@raccolta/cli 0.1.1 → 0.2.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.
@@ -1,16 +1,38 @@
1
1
  #!/usr/bin/env node
2
+ import fs from 'node:fs'
2
3
 
3
- const useColor = Boolean(process.stdout.isTTY) && !process.env.NO_COLOR
4
+ const useColor = !process.env.NO_COLOR && !process.env.CI
4
5
  const green = (text) => (useColor ? `\x1b[32m${text}\x1b[0m` : text)
5
6
  const bold = (text) => (useColor ? `\x1b[1m${text}\x1b[0m` : text)
6
7
  const dim = (text) => (useColor ? `\x1b[2m${text}\x1b[0m` : text)
7
8
 
8
- console.log('')
9
- console.log(`${green('[ok]')} ${bold('Raccolta CLI installed')}`)
10
- console.log('')
11
- console.log('Next steps:')
12
- console.log(` 1. Create an API key in ${bold('Raccolta -> Settings -> API')}`)
13
- console.log(` 2. Run ${bold('rac login')}`)
14
- console.log(` 3. Run ${bold('rac tasks')}`)
15
- console.log('')
16
- console.log(dim('Docs: run rac help'))
9
+ const message = [
10
+ '',
11
+ `${green('[ok]')} ${bold('Raccolta CLI installed')}`,
12
+ '',
13
+ 'Next steps:',
14
+ ` 1. Create an API key in ${bold('Raccolta -> Settings -> API')}`,
15
+ ` 2. Run ${bold('rac login --endpoint https://api.raccolta.dev/api')}`,
16
+ ` 3. Run ${bold('rac tasks')}`,
17
+ '',
18
+ dim('Help: rac help'),
19
+ '',
20
+ ].join('\n')
21
+
22
+ writeInstallMessage(message)
23
+
24
+ function writeInstallMessage(text) {
25
+ if (process.stdout.isTTY || process.env.npm_config_foreground_scripts === 'true') {
26
+ process.stdout.write(text)
27
+ return
28
+ }
29
+
30
+ const terminal = process.platform === 'win32' ? '\\\\.\\CONOUT$' : '/dev/tty'
31
+
32
+ try {
33
+ fs.writeFileSync(terminal, text)
34
+ return
35
+ } catch {
36
+ process.stdout.write(text)
37
+ }
38
+ }
package/bin/rac.js CHANGED
@@ -5,7 +5,7 @@ import path from 'node:path'
5
5
  import readline from 'node:readline/promises'
6
6
  import { stdin as input, stdout as output } from 'node:process'
7
7
 
8
- const VERSION = '0.1.1'
8
+ const VERSION = '0.1.2'
9
9
  const DEFAULT_ENDPOINT = 'https://api.raccolta.dev/api'
10
10
  const CONFIG_DIR = path.join(os.homedir(), '.raccolta')
11
11
  const CONFIG_FILE = path.join(CONFIG_DIR, 'config.json')
@@ -186,7 +186,8 @@ async function tasks({ flags }) {
186
186
  console.log('')
187
187
 
188
188
  if (rows.length === 0) {
189
- console.log(style('No tasks found.', 'dim'))
189
+ console.log(style(`No tasks found in ${workspaceName}.`, 'dim'))
190
+ console.log(style('Create the API key in the workspace that contains your cards, then run rac login again.', 'dim'))
190
191
  return
191
192
  }
192
193
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raccolta/cli",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "description": "Raccolta command line integration",
5
5
  "type": "module",
6
6
  "scripts": {