@symbo.ls/cli 2.11.441 → 2.11.442

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/fs.js +12 -3
  2. package/package.json +2 -2
package/bin/fs.js CHANGED
@@ -6,7 +6,7 @@ import * as smblsUtils from '@symbo.ls/utils'
6
6
  import inquirer from 'inquirer'
7
7
  import { createPatch } from 'diff'
8
8
 
9
- const { removeChars, toCamelCase } = smblsUtils.default
9
+ const { removeChars, toCamelCase, toTitleCase } = smblsUtils.default
10
10
  const {
11
11
  deepDestringify,
12
12
  objectToString,
@@ -157,18 +157,27 @@ export async function createFs (
157
157
  return
158
158
  }
159
159
 
160
+ const itemKeyInvalid = itemKey.includes('.')
161
+ const validKey = itemKeyInvalid ? `const ${removeChars(toTitleCase(itemKey))}` : `export const ${itemKey}`
162
+
160
163
  let stringifiedContent
161
164
  if (isString(value)) {
162
- stringifiedContent = `export const ${itemKey} = ${value}`
165
+ stringifiedContent = `${validKey} = ${value}`
163
166
  } else {
164
167
  const content = deepDestringify(value)
165
168
  // console.log('ON DEEPDESTR:')
166
169
  // console.log(content.components.Configuration)
167
- stringifiedContent = `export const ${itemKey} = ${objectToString(
170
+ stringifiedContent = `${validKey} = ${objectToString(
168
171
  content
169
172
  )};`
170
173
  }
171
174
 
175
+ if (itemKeyInvalid) {
176
+ stringifiedContent += `
177
+
178
+ export { ${removeChars(toTitleCase(itemKey))} as '${itemKey}' }`
179
+ }
180
+
172
181
  await fs.promises.writeFile(filePath, stringifiedContent, 'utf8')
173
182
  }
174
183
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@symbo.ls/cli",
3
- "version": "2.11.441",
3
+ "version": "2.11.442",
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": "5bb17cac1f5da975187956aa73830103ca67976b"
29
+ "gitHead": "60703b95e42c583fd5cdae32cf3484197e9ccd69"
30
30
  }