@symbo.ls/cli 2.11.41 → 2.11.59

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/convert.js CHANGED
@@ -63,14 +63,13 @@ function convertDomqlModule (domqlModule, desiredFormat, options) {
63
63
 
64
64
  console.group()
65
65
  const uniqueImports = []
66
- let first = true
66
+ const first = true
67
67
  let currentExportIdx = 0
68
68
  let removeUseContextImport = false
69
69
  const exportCount = Object.keys(domqlModule).length
70
70
  for (const key in domqlModule) {
71
71
  // Skip if not found in whitelist
72
- if (whitelist && !whitelist.includes(key))
73
- continue
72
+ if (whitelist && !whitelist.includes(key)) { continue }
74
73
 
75
74
  // Skip some components if converting smbls uikit
76
75
  if (options.internalUikit &&
@@ -79,42 +78,41 @@ function convertDomqlModule (domqlModule, desiredFormat, options) {
79
78
  continue
80
79
  }
81
80
 
82
- console.log(key)
83
81
  try {
82
+ convert()
83
+ } catch (err) {
84
+ throw new Error('`domql-to-mitosis` is not found.')
85
+ }
84
86
  // import('domql-to-mitosis').then(({ convert }) => {
85
- if (convert) {
86
- console.group()
87
- const component = domqlModule[key]
88
- component.__name = key
89
-
90
- const isSingleComponent = exportCount === 1
91
- const isFirst = currentExportIdx === 0
92
- const isLast = currentExportIdx === exportCount - 1
93
-
94
- const out = convert(component, desiredFormat, {
95
- verbose: false,
96
- exportDefault: isSingleComponent,
97
- returnMitosisIR: true,
98
- importsToRemove: uniqueImports,
99
- removeReactImport: !isFirst,
100
- removeUseContextImport
101
- })
102
-
103
- convertedStr = convertedStr + out.str
104
- if (options.trailingNewLine && !isLast) {
105
- convertedStr += '\n'
106
- }
87
+ if (convert) {
88
+ console.group()
89
+ const component = domqlModule[key]
90
+ component.__name = key
91
+
92
+ const isSingleComponent = exportCount === 1
93
+ const isFirst = currentExportIdx === 0
94
+ const isLast = currentExportIdx === exportCount - 1
95
+
96
+ const out = convert(component, desiredFormat, {
97
+ verbose: false,
98
+ exportDefault: isSingleComponent,
99
+ returnMitosisIR: true,
100
+ importsToRemove: uniqueImports,
101
+ removeReactImport: !isFirst,
102
+ removeUseContextImport
103
+ })
107
104
 
108
- uniqueImports.push(...out.mitosisIR.imports)
109
- if (out.mitosisIR._useContext) { removeUseContextImport = true }
110
- console.groupEnd()
111
- currentExportIdx++
112
- } else {
113
- throw new Error('Convert from `domql-to-mitosis` is not defined. Try to install `domql-to-mitosis` and run this command again.')
105
+ convertedStr = convertedStr + out.str
106
+ if (options.trailingNewLine && !isLast) {
107
+ convertedStr += '\n'
114
108
  }
115
- // })
116
- } catch (err) {
117
- throw new Error('`domql-to-mitosis` is not found.')
109
+
110
+ uniqueImports.push(...out.mitosisIR.imports)
111
+ if (out.mitosisIR._useContext) { removeUseContextImport = true }
112
+ console.groupEnd()
113
+ currentExportIdx++
114
+ } else {
115
+ throw new Error('Convert from `domql-to-mitosis` is not defined. Try to install `domql-to-mitosis` and run this command again.')
118
116
  }
119
117
  }
120
118
  console.groupEnd()
@@ -132,7 +130,7 @@ program
132
130
  .option('--vue2', 'Convert all DomQL components to Vue2')
133
131
  .option('--vue3', 'Convert all DomQL components to Vue3')
134
132
  .option('-t, --tmp-dir <path>', `Use this directory for storing intermediate & build files instead of the default (dest/${TMP_DIR_NAME})`)
135
- .option('-o, --only <components>', `Only convert these components; comma separated (for example: --only=Flex,Img)`)
133
+ .option('-o, --only <components>', 'Only convert these components; comma separated (for example: --only=Flex,Img)')
136
134
  .option('--internal-uikit', '(For internal use only). Excludes particular components from the conversion')
137
135
  .action(async (src, dest, options) => {
138
136
  // Desired format
@@ -269,7 +267,7 @@ program
269
267
  const convertedStr = convertDomqlModule(
270
268
  domqlModule,
271
269
  desiredFormat,
272
- {...options, trailingNewLine: true }
270
+ { ...options, trailingNewLine: true }
273
271
  )
274
272
 
275
273
  // Write file
package/bin/create.js CHANGED
@@ -16,16 +16,16 @@ program
16
16
  .command('create')
17
17
  .description('Create and initialize a new project')
18
18
  .argument('dest', 'Project directory')
19
- .option('--domql', 'Use Domql in the project')
19
+ .option('--domql', 'Use DOMQL in the project')
20
20
  .option('--react', 'Use React in the project (default)', true)
21
21
  .option('--angular', 'Use Angular in the project')
22
22
  .option('--vue2', 'Use Vue2 in the project')
23
23
  .option('--vue3', 'Use Vue3 in the project')
24
24
  .action(async (dest, options) => {
25
25
  // Determine framework
26
- let framework = 'react'
27
- if (options.domql) {
28
- framework = 'domql'
26
+ let framework = 'domql'
27
+ if (options.react) {
28
+ framework = 'react'
29
29
  } else if (options.angular) {
30
30
  framework = 'angular'
31
31
  } else if (options.vue2) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@symbo.ls/cli",
3
- "version": "2.11.41",
3
+ "version": "2.11.59",
4
4
  "description": "Fetch your Symbols configuration",
5
5
  "main": "bin/fetch.js",
6
6
  "author": "Symbols",
@@ -27,5 +27,5 @@
27
27
  "peerDependencies": {
28
28
  "domql-to-mitosis": "latest"
29
29
  },
30
- "gitHead": "16a11ea1e0d141165130ac295dcdd80728d8c492"
30
+ "gitHead": "285850864e56374f450c1f18e497b3886aa70e03"
31
31
  }