@symbo.ls/cli 2.11.366 → 2.11.370
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 +8 -6
- package/bin/fs.js +15 -7
- package/package.json +2 -2
package/bin/fetch.js
CHANGED
|
@@ -18,8 +18,8 @@ const LOCAL_CONFIG_PATH =
|
|
|
18
18
|
const DEFAULT_REMOTE_REPOSITORY = 'https://github.com/symbo-ls/default-config/'
|
|
19
19
|
const DEFAULT_REMOTE_CONFIG_PATH = "https://api.symbols.app/"; // eslint-disable-line
|
|
20
20
|
|
|
21
|
-
const API_URL_LOCAL = 'http://localhost:13335/get
|
|
22
|
-
const API_URL = 'https://api.symbols.app/get
|
|
21
|
+
const API_URL_LOCAL = 'http://localhost:13335/get'
|
|
22
|
+
const API_URL = 'https://api.symbols.app/get'
|
|
23
23
|
|
|
24
24
|
const rcFile = loadModule(RC_PATH); // eslint-disable-line
|
|
25
25
|
const localConfig = loadModule(LOCAL_CONFIG_PATH); // eslint-disable-line
|
|
@@ -36,9 +36,9 @@ try {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
export const fetchFromCli = async (opts) => {
|
|
39
|
-
const { dev, verbose, prettify, convert: convertOpt, update } = opts
|
|
39
|
+
const { dev, verbose, prettify, convert: convertOpt, metadata: metadataOpt, update } = opts
|
|
40
40
|
await rc.then(async (data) => {
|
|
41
|
-
const { key, framework, distDir } = data
|
|
41
|
+
const { key, framework, distDir, metadata } = data
|
|
42
42
|
|
|
43
43
|
const endpoint = dev ? API_URL_LOCAL : API_URL
|
|
44
44
|
|
|
@@ -46,6 +46,7 @@ export const fetchFromCli = async (opts) => {
|
|
|
46
46
|
|
|
47
47
|
const body = await fetchRemote(key, {
|
|
48
48
|
endpoint,
|
|
49
|
+
metadata: metadata || metadataOpt,
|
|
49
50
|
onError: (e) => {
|
|
50
51
|
console.log(chalk.red('Failed to fetch:'), key)
|
|
51
52
|
if (verbose) console.error(e)
|
|
@@ -116,9 +117,9 @@ export const fetchFromCli = async (opts) => {
|
|
|
116
117
|
}
|
|
117
118
|
|
|
118
119
|
if (update) {
|
|
119
|
-
createFs(body, distDir, update)
|
|
120
|
+
createFs(body, distDir, { update: true, metadata })
|
|
120
121
|
} else {
|
|
121
|
-
createFs(body, distDir)
|
|
122
|
+
createFs(body, distDir, { metadata })
|
|
122
123
|
}
|
|
123
124
|
})
|
|
124
125
|
}
|
|
@@ -129,6 +130,7 @@ program
|
|
|
129
130
|
.option('-d, --dev', 'Running from local server')
|
|
130
131
|
.option('-v, --verbose', 'Verbose errors and warnings')
|
|
131
132
|
.option('--convert', 'Verbose errors and warnings', true)
|
|
133
|
+
.option('--metadata', 'Include metadata', false)
|
|
132
134
|
.option('--update', 'overriding changes from platform')
|
|
133
135
|
.option('--verbose-code', 'Verbose errors and warnings')
|
|
134
136
|
.action(fetchFromCli)
|
package/bin/fs.js
CHANGED
|
@@ -5,27 +5,35 @@ import utils from '@domql/utils'
|
|
|
5
5
|
import * as smblsUtils from '@symbo.ls/utils'
|
|
6
6
|
import inquirer from 'inquirer'
|
|
7
7
|
import { createPatch } from 'diff'
|
|
8
|
+
import { fileURLToPath } from 'url'
|
|
9
|
+
|
|
10
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
|
8
11
|
|
|
9
12
|
const { removeChars, toCamelCase } = smblsUtils.default
|
|
10
|
-
const { deepDestringify, objectToString, joinArrays, isString } = utils
|
|
13
|
+
const { deepDestringify, objectToString, joinArrays, isString, removeValueFromArray } = utils
|
|
11
14
|
|
|
12
|
-
const LOCAL_CONFIG_PATH =
|
|
13
|
-
|
|
15
|
+
const LOCAL_CONFIG_PATH = path.resolve(__dirname, '/node_modules/@symbo.ls/init/dynamic.json')
|
|
16
|
+
const LOCAL_CONFIG_PATH2 = process.cwd() + '/symbols.json'
|
|
14
17
|
|
|
18
|
+
let singleFileKeys = ['designSystem', 'state']
|
|
15
19
|
const keys = ['components', 'snippets', 'pages']
|
|
16
|
-
const
|
|
17
|
-
const defaultExports = ['pages', 'designSystem', 'state']
|
|
20
|
+
const defaultExports = ['pages', 'designSystem', 'state', 'schema']
|
|
18
21
|
|
|
19
22
|
export async function createFs (
|
|
20
23
|
body,
|
|
21
|
-
distDir = path.join(process.cwd(), '
|
|
22
|
-
|
|
24
|
+
distDir = path.join(process.cwd(), 'smbls'),
|
|
25
|
+
opts = {}
|
|
23
26
|
) {
|
|
24
27
|
if (!body) {
|
|
25
28
|
console.error('No JSON object provided. Exiting.')
|
|
26
29
|
return
|
|
27
30
|
}
|
|
28
31
|
|
|
32
|
+
const { update, metadata } = opts
|
|
33
|
+
|
|
34
|
+
singleFileKeys = removeValueFromArray(singleFileKeys, 'schema')
|
|
35
|
+
if (metadata) singleFileKeys.push('schema')
|
|
36
|
+
|
|
29
37
|
const targetDir = distDir
|
|
30
38
|
|
|
31
39
|
const filesExist = fs.existsSync(targetDir)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@symbo.ls/cli",
|
|
3
|
-
"version": "2.11.
|
|
3
|
+
"version": "2.11.370",
|
|
4
4
|
"description": "Fetch your Symbols configuration",
|
|
5
5
|
"main": "bin/fetch.js",
|
|
6
6
|
"author": "Symbols",
|
|
@@ -26,5 +26,5 @@
|
|
|
26
26
|
"node-fetch": "^3.1.0",
|
|
27
27
|
"v8-compile-cache": "^2.3.0"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "74a36a111e06c34c7eb17326f262de6c08b28c19"
|
|
30
30
|
}
|