@symbo.ls/cli 0.6.6 → 0.6.10
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 +50 -0
- package/bin/login.js +15 -0
- package/bin/require.js +9 -0
- package/package.json +24 -2
package/bin/fetch.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import 'v8-compile-cache'
|
|
4
|
+
import { loadModule } from './require.js'
|
|
5
|
+
import { Command } from 'commander'
|
|
6
|
+
import fetch from 'node-fetch'
|
|
7
|
+
import chalk from 'chalk'
|
|
8
|
+
|
|
9
|
+
const pkg = loadModule('../package.json')
|
|
10
|
+
const program = new Command()
|
|
11
|
+
|
|
12
|
+
const API_URL = 'https://api.symbols.app/' // eslint-disable-line
|
|
13
|
+
const DEFAULT_CONFIG = 'https://raw.githubusercontent.com/symbo-ls/uikit/8e7026a2216c68efad260961a77c9302d34c7aa4/packages/config-default/src/config.json'
|
|
14
|
+
|
|
15
|
+
program
|
|
16
|
+
.version(pkg.version)
|
|
17
|
+
|
|
18
|
+
program
|
|
19
|
+
.command('fetch [destination]')
|
|
20
|
+
.description('Fetch symbols')
|
|
21
|
+
.action(async (source, destination) => {
|
|
22
|
+
const response = await fetch(DEFAULT_CONFIG)
|
|
23
|
+
const body = await response.json()
|
|
24
|
+
const { version, ...config } = body
|
|
25
|
+
|
|
26
|
+
console.log('')
|
|
27
|
+
console.log(chalk.bold('Symbols'), 'config received: ', chalk.green(version))
|
|
28
|
+
|
|
29
|
+
const path = process.cwd() + '/.symbolsrc.json'
|
|
30
|
+
console.log(chalk.dim('Default config fetched: '), chalk.dim.underline(path))
|
|
31
|
+
console.log('')
|
|
32
|
+
|
|
33
|
+
fs.writeFile(path, JSON.stringify(body), err => {
|
|
34
|
+
if (err) {
|
|
35
|
+
console.log('Error writing file', err)
|
|
36
|
+
} else {
|
|
37
|
+
console.log('Successfully wrote file')
|
|
38
|
+
}
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
for (const t in config) {
|
|
42
|
+
const type = config[t]
|
|
43
|
+
console.log(chalk.bold(t))
|
|
44
|
+
// for (const v in type) console.log(' ', chalk.dim(v))
|
|
45
|
+
console.log(Object.keys(type))
|
|
46
|
+
}
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
var args = process.argv
|
|
50
|
+
program.parse(args)
|
package/bin/login.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
program
|
|
4
|
+
.command('login [destination]')
|
|
5
|
+
.description('Sign in to Symbols')
|
|
6
|
+
.argument('<username>', 'user to login')
|
|
7
|
+
.argument('[password]', 'password for user, if required', 'no password given')
|
|
8
|
+
.action(async (username, password) => {
|
|
9
|
+
console.log('username:', username)
|
|
10
|
+
console.log('password:', password)
|
|
11
|
+
|
|
12
|
+
const response = await fetch(API_URL)
|
|
13
|
+
const body = await response.json()
|
|
14
|
+
console.log(body)
|
|
15
|
+
})
|
package/bin/require.js
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,28 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@symbo.ls/cli",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.10",
|
|
4
|
+
"description": "Fetch your Symbols configuration",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"author": "Symbols",
|
|
4
7
|
"license": "MIT",
|
|
5
|
-
"
|
|
8
|
+
"private": false,
|
|
9
|
+
"type": "module",
|
|
10
|
+
"bin": {
|
|
11
|
+
"symbo-ls": "dist/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
|
+
"v8-compile-cache": "^2.3.0"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"commander": "^8.3.0"
|
|
23
|
+
},
|
|
24
|
+
"env": {
|
|
25
|
+
"process": true
|
|
26
|
+
},
|
|
27
|
+
"gitHead": "6123989a3672237d094929300016f72da7edf822"
|
|
6
28
|
}
|