@symbo.ls/cli 2.11.61 → 2.11.97

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/convert.js +28 -20
  2. package/package.json +2 -2
package/bin/convert.js CHANGED
@@ -21,7 +21,9 @@ const EXCLUDED_FROM_INTERNAL_UIKIT = [
21
21
  'splitTransition',
22
22
  'transformDuration',
23
23
  'transformShadow',
24
- 'transformTransition'
24
+ 'transformTransition',
25
+ 'DatePickerDay',
26
+ 'DatePickerGrid',
25
27
  ]
26
28
  const TMP_DIR_NAME = '.smbls_convert_tmp'
27
29
  const TMP_DIR_PACKAGE_JSON_STR = JSON.stringify({
@@ -65,7 +67,6 @@ function convertDomqlModule (domqlModule, desiredFormat, options) {
65
67
  const uniqueImports = []
66
68
  const first = true
67
69
  let currentExportIdx = 0
68
- let removeUseContextImport = false
69
70
  const exportCount = Object.keys(domqlModule).length
70
71
  for (const key in domqlModule) {
71
72
  // Skip if not found in whitelist
@@ -78,16 +79,11 @@ function convertDomqlModule (domqlModule, desiredFormat, options) {
78
79
  continue
79
80
  }
80
81
 
81
- try {
82
- convert()
83
- } catch (err) {
84
- throw new Error('`domql-to-mitosis` is not found.')
85
- }
86
- // import('domql-to-mitosis').then(({ convert }) => {
87
82
  if (convert) {
88
83
  console.group()
89
84
  const component = domqlModule[key]
90
85
  component.__name = key
86
+ console.log(key) // NOTE: @nikoloza don't remove this (again)
91
87
 
92
88
  const isSingleComponent = exportCount === 1
93
89
  const isFirst = currentExportIdx === 0
@@ -98,8 +94,7 @@ function convertDomqlModule (domqlModule, desiredFormat, options) {
98
94
  exportDefault: isSingleComponent,
99
95
  returnMitosisIR: true,
100
96
  importsToRemove: uniqueImports,
101
- removeReactImport: !isFirst,
102
- removeUseContextImport
97
+ removeReactImport: !isFirst
103
98
  })
104
99
 
105
100
  convertedStr = convertedStr + out.str
@@ -108,11 +103,12 @@ function convertDomqlModule (domqlModule, desiredFormat, options) {
108
103
  }
109
104
 
110
105
  uniqueImports.push(...out.mitosisIR.imports)
111
- if (out.mitosisIR._useContext) { removeUseContextImport = true }
112
106
  console.groupEnd()
113
107
  currentExportIdx++
114
108
  } else {
115
- throw new Error('Convert from `domql-to-mitosis` is not defined. Try to install `domql-to-mitosis` and run this command again.')
109
+ throw new Error(
110
+ 'Convert from `domql-to-mitosis` is not defined. Try to install' +
111
+ '`domql-to-mitosis` and run this command again.')
116
112
  }
117
113
  }
118
114
  console.groupEnd()
@@ -122,16 +118,24 @@ function convertDomqlModule (domqlModule, desiredFormat, options) {
122
118
 
123
119
  program
124
120
  .command('convert')
125
- .description('Recursively convert and copy all DomQL components under a directory')
121
+ .description('Convert and copy all DomQL components under a directory')
126
122
  .argument('[src]', 'Source directory/file. By default, it is "src/"')
127
- .argument('[dest]', 'Destination directory/file. Will be overwritten. By default, it becomes the name of the desired format')
123
+ .argument('[dest]',
124
+ 'Destination directory/file. Will be overwritten. By ' +
125
+ 'default, it becomes the name of the desired format')
128
126
  .option('--react', 'Convert all DomQL components to React')
129
127
  .option('--angular', 'Convert all DomQL components to Angular')
130
128
  .option('--vue2', 'Convert all DomQL components to Vue2')
131
129
  .option('--vue3', 'Convert all DomQL components to Vue3')
132
- .option('-t, --tmp-dir <path>', `Use this directory for storing intermediate & build files instead of the default (dest/${TMP_DIR_NAME})`)
133
- .option('-o, --only <components>', 'Only convert these components; comma separated (for example: --only=Flex,Img)')
134
- .option('--internal-uikit', '(For internal use only). Excludes particular components from the conversion')
130
+ .option('-t, --tmp-dir <path>',
131
+ 'Use this directory for storing intermediate & build files instead of ' +
132
+ `the default (dest/${TMP_DIR_NAME})`)
133
+ .option('-o, --only <components>',
134
+ 'Only convert these components; comma separated ' +
135
+ '(for example: --only=Flex,Img)')
136
+ .option('--internal-uikit',
137
+ '(For internal use only). ' +
138
+ 'Excludes particular components from the conversion')
135
139
  .action(async (src, dest, options) => {
136
140
  // Desired format
137
141
  let desiredFormat = 'react'
@@ -159,7 +163,8 @@ program
159
163
  // Put a package.json file so that when we import() the modules from the
160
164
  // directory, node doesn't recognize them as ES modules (in case the parent
161
165
  // directory of the tmp dir has "type": "module" in its package.json
162
- const pj = await fs.promises.open(path.resolve(tmpDirPath, 'package.json'), 'w')
166
+ const pj = await fs.promises.open(
167
+ path.resolve(tmpDirPath, 'package.json'), 'w')
163
168
  await pj.writeFile(TMP_DIR_PACKAGE_JSON_STR, 'utf8')
164
169
  await pj.close()
165
170
 
@@ -233,7 +238,9 @@ program
233
238
  destDirPath = path.resolve(dest)
234
239
  } else {
235
240
  // dest exists and is not a directory.
236
- console.error(`The destination ('${path.resolve(dest)}') must be a directory when the source ('${srcPath}') is a directory`)
241
+ console.error(
242
+ `The destination ('${path.resolve(dest)}') must be a directory when` +
243
+ `the source ('${srcPath}') is a directory`)
237
244
  return 1
238
245
  }
239
246
 
@@ -242,7 +249,8 @@ program
242
249
 
243
250
  // Bundle components
244
251
  await esbuild.build({
245
- entryPoints: origFiles.map(file => path.join(srcPath, file, './index.js')),
252
+ entryPoints: origFiles.map(file =>
253
+ path.join(srcPath, file,'./index.js')),
246
254
  bundle: true,
247
255
  sourcemap: true,
248
256
  target: 'node12',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@symbo.ls/cli",
3
- "version": "2.11.61",
3
+ "version": "2.11.97",
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": "8e1db51c5601f1d344cfbaea5adbfd6a91e7407f"
30
+ "gitHead": "d5b73e4c431d30798a999c5077b446472f0a6ac4"
31
31
  }