@symbo.ls/cli 2.27.18 → 2.28.2

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 (3) hide show
  1. package/bin/fetch.js +22 -12
  2. package/bin/sync.js +25 -10
  3. package/package.json +5 -5
package/bin/fetch.js CHANGED
@@ -8,20 +8,20 @@ import * as fetch from '@symbo.ls/fetch'
8
8
  import * as utils from '@domql/utils'
9
9
  import { convertFromCli } from './convert.js'
10
10
  import { createFs } from './fs.js'
11
- const { isObjectLike } = (utils.default || utils)
12
- const { fetchRemote } = (fetch.default || fetch)
11
+ const { isObjectLike } = utils.default || utils
12
+ const { fetchRemote } = fetch.default || fetch
13
13
 
14
14
  const RC_PATH = process.cwd() + '/symbols.json'
15
15
  const LOCAL_CONFIG_PATH =
16
16
  process.cwd() + '/node_modules/@symbo.ls/init/dynamic.json'
17
17
  const DEFAULT_REMOTE_REPOSITORY = 'https://github.com/symbo-ls/default-config/'
18
- const DEFAULT_REMOTE_CONFIG_PATH = "https://api.symbols.app/"; // eslint-disable-line
18
+ const DEFAULT_REMOTE_CONFIG_PATH = 'https://api.symbols.app/' // eslint-disable-line
19
19
 
20
20
  const API_URL_LOCAL = 'http://localhost:13335/get'
21
21
  const API_URL = 'https://api.symbols.app/get'
22
22
 
23
- const rcFile = loadModule(RC_PATH); // eslint-disable-line
24
- const localConfig = loadModule(LOCAL_CONFIG_PATH); // eslint-disable-line
23
+ const rcFile = loadModule(RC_PATH) // eslint-disable-line
24
+ const localConfig = loadModule(LOCAL_CONFIG_PATH) // eslint-disable-line
25
25
 
26
26
  const debugMsg = chalk.dim(
27
27
  'Use --verbose to debug the error or open the issue at https://github.com/symbo-ls/smbls'
@@ -29,24 +29,32 @@ const debugMsg = chalk.dim(
29
29
 
30
30
  let rc = {}
31
31
  try {
32
- rc = loadModule(RC_PATH); // eslint-disable-line
32
+ rc = loadModule(RC_PATH) // eslint-disable-line
33
33
  } catch (e) {
34
34
  console.error('Please include symbols.json to your root of respository')
35
35
  }
36
36
 
37
- export const fetchFromCli = async (opts) => {
38
- const { dev, verbose, prettify, convert: convertOpt, metadata: metadataOpt, update, force } = opts
39
- await rc.then(async (data) => {
37
+ export const fetchFromCli = async opts => {
38
+ const {
39
+ dev,
40
+ verbose,
41
+ prettify,
42
+ convert: convertOpt,
43
+ metadata: metadataOpt,
44
+ update,
45
+ force
46
+ } = opts
47
+ await rc.then(async data => {
40
48
  const { key, framework, distDir, metadata } = data
41
49
 
42
- const endpoint = dev ? API_URL_LOCAL : API_URL
50
+ const endpoint = dev || utils.isLocal() ? API_URL_LOCAL : API_URL
43
51
 
44
52
  console.log('\nFetching from:', chalk.bold(endpoint), '\n')
45
53
 
46
54
  const body = await fetchRemote(key, {
47
55
  endpoint,
48
56
  metadata: metadata || metadataOpt,
49
- onError: (e) => {
57
+ onError: e => {
50
58
  console.log(chalk.red('Failed to fetch:'), key)
51
59
  if (verbose) console.error(e)
52
60
  else console.log(debugMsg)
@@ -111,7 +119,9 @@ export const fetchFromCli = async (opts) => {
111
119
  }
112
120
 
113
121
  console.log()
114
- console.warn('No --dist-dir option or "distDir" in symbols.json provided. Saving in ./node_modules/@symbo.ls/init/dynamic.json.')
122
+ console.warn(
123
+ 'No --dist-dir option or "distDir" in symbols.json provided. Saving in ./node_modules/@symbo.ls/init/dynamic.json.'
124
+ )
115
125
  return {}
116
126
  }
117
127
 
package/bin/sync.js CHANGED
@@ -10,30 +10,37 @@ import * as socketClient from '@symbo.ls/socket/client.js'
10
10
  import { fetchFromCli } from './fetch.js'
11
11
  import { convertFromCli } from './convert.js'
12
12
 
13
- const { debounce } = (utils.default || utils)
13
+ const { debounce } = utils.default || utils
14
14
 
15
- const SOCKET_API_URL_LOCAL = 'http://localhost:13336/'
16
- const SOCKET_API_URL = 'https://socket.symbols.app/'
15
+ const SOCKET_API_URL_LOCAL = 'http://localhost:13335/'
16
+ const SOCKET_API_URL = 'https://api.symbols.app/'
17
17
 
18
- const debugMsg = chalk.dim('Use --verbose to debug the error or open the issue at https://github.com/symbo-ls/smbls')
18
+ const debugMsg = chalk.dim(
19
+ 'Use --verbose to debug the error or open the issue at https://github.com/symbo-ls/smbls'
20
+ )
19
21
 
20
22
  const RC_PATH = process.cwd() + '/symbols.json'
21
23
  let rc = {}
22
24
  try {
23
25
  rc = loadModule(RC_PATH) // eslint-disable-line
24
- } catch (e) { console.error('Please include symbols.json to your root of respository') }
26
+ } catch (e) {
27
+ console.error('Please include symbols.json to your root of respository')
28
+ }
25
29
 
26
30
  program
27
31
  .command('sync')
28
32
  .description('Realtime sync with Symbols')
29
33
  .option('-d, --dev', 'Running from local server')
30
34
  .option('-v, --verbose', 'Verbose errors and warnings')
31
- .option('-k, --key', 'Bypass the symbols.json key, overriding the key manually')
35
+ .option(
36
+ '-k, --key',
37
+ 'Bypass the symbols.json key, overriding the key manually'
38
+ )
32
39
  .option('-f, --fetch', 'Verbose errors and warnings', true)
33
40
  .option('--convert', 'Verbose errors and warnings', true)
34
41
  .option('--update', 'overriding changes from platform', true)
35
42
  .option('--verbose-code', 'Verbose errors and warnings')
36
- .action(async (opts) => {
43
+ .action(async opts => {
37
44
  const { dev, verbose, fetch: fetchOpt, convert: convertOpt } = opts
38
45
 
39
46
  if (fetchOpt) {
@@ -61,7 +68,13 @@ program
61
68
  source: 'cli',
62
69
  socketUrl,
63
70
  onConnect: (id, socket) => {
64
- console.log('Connected to', chalk.green(key), 'from', chalk.bold('Symbols'), 'socket server')
71
+ console.log(
72
+ 'Connected to',
73
+ chalk.green(key),
74
+ 'from',
75
+ chalk.bold('Symbols'),
76
+ 'socket server'
77
+ )
65
78
  console.log('Socket id:', id)
66
79
  console.log(chalk.dim('\nListening to updates...\n'))
67
80
  },
@@ -83,7 +96,8 @@ program
83
96
  console.log(chalk.dim('\n----------------\n'))
84
97
  console.log(chalk.dim('Received update:'))
85
98
  console.log(Object.keys(d).join(', '))
86
- if (verboseCode) console.log(chalk.dim(JSON.stringify(d, null, prettify ?? 2)))
99
+ if (verboseCode)
100
+ console.log(chalk.dim(JSON.stringify(d, null, prettify ?? 2)))
87
101
 
88
102
  if (distDir) {
89
103
  if (fetchOpt) {
@@ -98,7 +112,8 @@ program
98
112
 
99
113
  if (d.components && convertOpt && framework) {
100
114
  convertFromCli(d.components, {
101
- ...options, framework
115
+ ...options,
116
+ framework
102
117
  })
103
118
  }
104
119
  }, 1500),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@symbo.ls/cli",
3
- "version": "2.27.18",
3
+ "version": "2.28.2",
4
4
  "description": "Fetch your Symbols configuration",
5
5
  "main": "bin/fetch.js",
6
6
  "author": "Symbols",
@@ -15,9 +15,9 @@
15
15
  "vpatch": "npm version patch && npm publish"
16
16
  },
17
17
  "dependencies": {
18
- "@symbo.ls/fetch": "^2.27.18",
19
- "@symbo.ls/init": "^2.27.18",
20
- "@symbo.ls/socket": "^2.27.18",
18
+ "@symbo.ls/fetch": "^2.28.2",
19
+ "@symbo.ls/init": "^2.28.2",
20
+ "@symbo.ls/socket": "^2.28.2",
21
21
  "chalk": "^5.4.1",
22
22
  "commander": "^13.1.0",
23
23
  "diff": "^5.2.0",
@@ -26,5 +26,5 @@
26
26
  "node-fetch": "^3.3.2",
27
27
  "v8-compile-cache": "^2.4.0"
28
28
  },
29
- "gitHead": "0d6418dd1eabd119d4ef1b6bb07b7733151878a5"
29
+ "gitHead": "3c5e8b68269799a0e2382f9c79c51e41f33863bf"
30
30
  }