@symbo.ls/cli 0.6.7 → 0.6.8
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/bin/fetch.js +30 -16
- package/package.json +2 -2
package/bin/fetch.js
CHANGED
|
@@ -5,6 +5,7 @@ import { createRequire } from 'module'
|
|
|
5
5
|
import { Command } from 'commander'
|
|
6
6
|
import fetch from 'node-fetch'
|
|
7
7
|
import chalk from 'chalk'
|
|
8
|
+
import fs from 'fs'
|
|
8
9
|
|
|
9
10
|
const require = createRequire(import.meta.url)
|
|
10
11
|
const pkg = require('../package.json')
|
|
@@ -16,30 +17,43 @@ const DEFAULT_CONFIG = 'https://raw.githubusercontent.com/symbo-ls/uikit/8e7026a
|
|
|
16
17
|
program
|
|
17
18
|
.version(pkg.version)
|
|
18
19
|
|
|
19
|
-
program
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
20
|
+
// program
|
|
21
|
+
// .command('login [destination]')
|
|
22
|
+
// .description('Sign in to Symbols')
|
|
23
|
+
// .argument('<username>', 'user to login')
|
|
24
|
+
// .argument('[password]', 'password for user, if required', 'no password given')
|
|
25
|
+
// .action(async (username, password) => {
|
|
26
|
+
// console.log('username:', username)
|
|
27
|
+
// console.log('password:', password)
|
|
28
|
+
|
|
29
|
+
// const response = await fetch(API_URL)
|
|
30
|
+
// const body = await response.json()
|
|
31
|
+
// console.log(body)
|
|
32
|
+
// })
|
|
32
33
|
|
|
33
34
|
program
|
|
34
35
|
.command('fetch [destination]')
|
|
35
36
|
.description('Fetch symbols')
|
|
36
37
|
.action(async (source, destination) => {
|
|
37
38
|
const response = await fetch(DEFAULT_CONFIG)
|
|
38
|
-
const body = await response.
|
|
39
|
-
const
|
|
40
|
-
|
|
39
|
+
const body = await response.json()
|
|
40
|
+
const { version, ...config } = body
|
|
41
|
+
|
|
41
42
|
console.log('')
|
|
42
43
|
console.log(chalk.bold('Symbols'), 'config received: ', chalk.green(version))
|
|
44
|
+
|
|
45
|
+
const path = process.cwd() + '/.symbolsrc.json'
|
|
46
|
+
console.log(chalk.dim('Default config fetched: '), chalk.dim.underline(path))
|
|
47
|
+
console.log('')
|
|
48
|
+
|
|
49
|
+
fs.writeFile(path, JSON.stringify(body), err => {
|
|
50
|
+
if (err) {
|
|
51
|
+
console.log('Error writing file', err)
|
|
52
|
+
} else {
|
|
53
|
+
console.log('Successfully wrote file')
|
|
54
|
+
}
|
|
55
|
+
})
|
|
56
|
+
|
|
43
57
|
for (const t in config) {
|
|
44
58
|
const type = config[t]
|
|
45
59
|
console.log(chalk.bold(t))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@symbo.ls/cli",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.8",
|
|
4
4
|
"description": "Fetch your Symbols configuration",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"author": "Symbols",
|
|
@@ -21,5 +21,5 @@
|
|
|
21
21
|
"commander": "^8.3.0",
|
|
22
22
|
"v8-compile-cache": "^2.3.0"
|
|
23
23
|
},
|
|
24
|
-
"gitHead": "
|
|
24
|
+
"gitHead": "c287d28ceeac658e333cb8c29e7e68a251cc65bb"
|
|
25
25
|
}
|