@symbo.ls/cli 0.6.6 → 0.6.7

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.
Files changed (2) hide show
  1. package/bin/fetch.js +52 -0
  2. package/package.json +21 -2
package/bin/fetch.js ADDED
@@ -0,0 +1,52 @@
1
+ #!/usr/bin/env node
2
+
3
+ import 'v8-compile-cache'
4
+ import { createRequire } from 'module'
5
+ import { Command } from 'commander'
6
+ import fetch from 'node-fetch'
7
+ import chalk from 'chalk'
8
+
9
+ const require = createRequire(import.meta.url)
10
+ const pkg = require('../package.json')
11
+ const program = new Command()
12
+
13
+ const API_URL = 'https://api.symbols.app/'
14
+ const DEFAULT_CONFIG = 'https://raw.githubusercontent.com/symbo-ls/uikit/8e7026a2216c68efad260961a77c9302d34c7aa4/packages/config-default/src/config.json'
15
+
16
+ program
17
+ .version(pkg.version)
18
+
19
+ program
20
+ .command('login [destination]')
21
+ .description('Sign in to Symbols')
22
+ .argument('<username>', 'user to login')
23
+ .argument('[password]', 'password for user, if required', 'no password given')
24
+ .action(async (username, password) => {
25
+ console.log('username:', username)
26
+ console.log('password:', password)
27
+
28
+ const response = await fetch(API_URL)
29
+ const body = await response.json()
30
+ console.log(body)
31
+ })
32
+
33
+ program
34
+ .command('fetch [destination]')
35
+ .description('Fetch symbols')
36
+ .action(async (source, destination) => {
37
+ const response = await fetch(DEFAULT_CONFIG)
38
+ const body = await response.text()
39
+ const parsed = JSON.parse(body)
40
+ const { version, ...config } = parsed
41
+ console.log('')
42
+ console.log(chalk.bold('Symbols'), 'config received: ', chalk.green(version))
43
+ for (const t in config) {
44
+ const type = config[t]
45
+ console.log(chalk.bold(t))
46
+ // for (const v in type) console.log(' ', chalk.dim(v))
47
+ console.log(Object.keys(type))
48
+ }
49
+ })
50
+
51
+ var args = process.argv
52
+ program.parse(args)
package/package.json CHANGED
@@ -1,6 +1,25 @@
1
1
  {
2
2
  "name": "@symbo.ls/cli",
3
- "version": "0.6.6",
3
+ "version": "0.6.7",
4
+ "description": "Fetch your Symbols configuration",
5
+ "main": "index.js",
6
+ "author": "Symbols",
4
7
  "license": "MIT",
5
- "gitHead": "a321718ab6aeb4f29a2d5d90de52ca4c64882b47"
8
+ "private": false,
9
+ "type": "module",
10
+ "bin": {
11
+ "symbo-ls": "bin/fetch.js"
12
+ },
13
+ "scripts": {
14
+ "start": "node bin/fetch.js"
15
+ },
16
+ "dependencies": {
17
+ "chalk": "^5.0.0",
18
+ "node-fetch": "^3.1.0"
19
+ },
20
+ "devDependencies": {
21
+ "commander": "^8.3.0",
22
+ "v8-compile-cache": "^2.3.0"
23
+ },
24
+ "gitHead": "6123989a3672237d094929300016f72da7edf822"
6
25
  }