@symbo.ls/cli 2.10.208 → 2.10.209
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 +2 -3
- package/bin/create/DesignSystem.js +14 -0
- package/bin/create.js +60 -0
- package/bin/fetch.js +6 -1
- package/bin/index.js +1 -0
- package/bin/require.js +6 -1
- package/bin/sync.js +4 -0
- package/package.json +2 -2
package/bin/convert.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
import * as esbuild from 'esbuild'
|
|
4
|
-
import { loadModule } from './require.js'
|
|
5
4
|
import { program } from './program.js'
|
|
6
5
|
import { convert } from 'domql-to-mitosis'
|
|
7
6
|
import fs from 'fs'
|
|
@@ -58,7 +57,7 @@ program
|
|
|
58
57
|
|
|
59
58
|
// Bundle components
|
|
60
59
|
await esbuild.build({
|
|
61
|
-
entryPoints: origFiles.map(file => path.join(srcPath, file, '
|
|
60
|
+
entryPoints: origFiles.map(file => path.join(srcPath, file, './index.js')),
|
|
62
61
|
bundle: true,
|
|
63
62
|
sourcemap: true,
|
|
64
63
|
target: 'node12',
|
|
@@ -94,7 +93,7 @@ program
|
|
|
94
93
|
const component = domqlModule[key]
|
|
95
94
|
component.__name = key
|
|
96
95
|
const out = convert(component, desiredFormat, {
|
|
97
|
-
verbose:
|
|
96
|
+
verbose: (key === "ParentMode"),
|
|
98
97
|
exportDefault: exportCount === 1,
|
|
99
98
|
returnMitosisIR: true,
|
|
100
99
|
importsToRemove: uniqueImports,
|
package/bin/create.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
import { execSync } from 'child_process'
|
|
4
|
+
import { program } from './program.js'
|
|
5
|
+
import fs from 'fs'
|
|
6
|
+
import path from 'path'
|
|
7
|
+
import { fileURLToPath } from 'url';
|
|
8
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
9
|
+
const __dirname = path.dirname(__filename);
|
|
10
|
+
|
|
11
|
+
const DESIGN_SYSTEM_FILE_PATH = path.join(
|
|
12
|
+
__dirname, 'create', 'DesignSystem.js')
|
|
13
|
+
const REPO_URLS = {
|
|
14
|
+
domql: 'https://github.com/symbo-ls/create-domql-app.git',
|
|
15
|
+
react: 'https://github.com/symbo-ls/create-react-app.git',
|
|
16
|
+
angular: 'https://github.com/symbo-ls/create-angular-app.git',
|
|
17
|
+
vue2: 'https://github.com/symbo-ls/create-vue2-app.git',
|
|
18
|
+
vue3: 'https://github.com/symbo-ls/create-vue3-app.git',
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
program
|
|
22
|
+
.command('create')
|
|
23
|
+
.description('Create a new project that uses Symbols')
|
|
24
|
+
.argument('dest', 'Project directory name')
|
|
25
|
+
.option('--domql', 'Use Domql in the project (default)')
|
|
26
|
+
.option('--react', 'Use React in the project (default)')
|
|
27
|
+
.option('--angular', 'Use Angular in the project')
|
|
28
|
+
.option('--vue2', 'Use Vue2 in the project')
|
|
29
|
+
.option('--vue3', 'Use Vue3 in the project')
|
|
30
|
+
.action(async (dest, options) => {
|
|
31
|
+
// Determine repo to clone
|
|
32
|
+
let cloneUrl = REPO_URLS.react
|
|
33
|
+
if (options.domql) {
|
|
34
|
+
cloneUrl = REPO_URLS.domql
|
|
35
|
+
} else if (options.angular) {
|
|
36
|
+
cloneUrl = REPO_URLS.angular
|
|
37
|
+
} else if (options.vue2) {
|
|
38
|
+
cloneUrl = REPO_URLS.vue2
|
|
39
|
+
} else if (options.vue3) {
|
|
40
|
+
cloneUrl = REPO_URLS.vue3
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Clone
|
|
44
|
+
console.log(`Cloning ${cloneUrl} into ${dest}...`)
|
|
45
|
+
execSync(`git clone ${cloneUrl} ${dest}`)
|
|
46
|
+
|
|
47
|
+
// Install
|
|
48
|
+
const cwd = process.cwd()
|
|
49
|
+
console.log('Installing NPM dependencies...')
|
|
50
|
+
process.chdir(dest)
|
|
51
|
+
execSync(`npm install`)
|
|
52
|
+
process.chdir(cwd)
|
|
53
|
+
|
|
54
|
+
// Copy design system file
|
|
55
|
+
const filePath = path.join(dest, 'DesignSystem.js')
|
|
56
|
+
console.log(`Writing DesignSystem.js to ${filePath}`)
|
|
57
|
+
await fs.promises.copyFile(DESIGN_SYSTEM_FILE_PATH, filePath)
|
|
58
|
+
|
|
59
|
+
console.log('Done!')
|
|
60
|
+
})
|
package/bin/fetch.js
CHANGED
|
@@ -27,13 +27,18 @@ try {
|
|
|
27
27
|
} catch (e) { console.error('Please include symbols.json to your root of respository') }
|
|
28
28
|
|
|
29
29
|
program
|
|
30
|
-
.version(pkg.version)
|
|
30
|
+
.version(pkg.version ?? 'unknown')
|
|
31
31
|
|
|
32
32
|
program
|
|
33
33
|
.command('install')
|
|
34
34
|
.description('Install Symbols')
|
|
35
35
|
.option('--framework', 'Which Symbols to install (domql, react)')
|
|
36
36
|
.action(async (framework) => {
|
|
37
|
+
if (!rc_file || !local_config) {
|
|
38
|
+
console.error('symbols.json not found in the root of the repository')
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
|
|
37
42
|
// const packageName = `@symbo.ls/${mode || 'uikit'}`
|
|
38
43
|
const packageName = 'smbls'
|
|
39
44
|
console.log('Adding', chalk.green.bold(packageName))
|
package/bin/index.js
CHANGED
package/bin/require.js
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { createRequire } from 'module'
|
|
2
|
+
import path from 'path'
|
|
3
|
+
import fs from 'fs'
|
|
2
4
|
|
|
3
5
|
class ImportError extends Error {} /* Bring in the ability to create the 'require' method */ // eslint-disable-line
|
|
4
6
|
const require = createRequire(import.meta.url) // construct the require method
|
|
5
7
|
|
|
6
8
|
export const loadModule = async (modulePath) => {
|
|
7
|
-
|
|
9
|
+
if (fs.existsSync(modulePath))
|
|
10
|
+
return require(modulePath) // use the require method
|
|
11
|
+
else
|
|
12
|
+
return null
|
|
8
13
|
}
|
package/bin/sync.js
CHANGED
|
@@ -17,6 +17,10 @@ program
|
|
|
17
17
|
.option('-l, --live', 'Bypass the local build')
|
|
18
18
|
.option('--key', 'Bypass the local build')
|
|
19
19
|
.action(async (options) => {
|
|
20
|
+
if (!rc) {
|
|
21
|
+
console.error('symbols.json not found in the root of the repository')
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
20
24
|
rc.then(data => {
|
|
21
25
|
const opts = { ...data, ...options }
|
|
22
26
|
const key = data.key || options.key
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@symbo.ls/cli",
|
|
3
|
-
"version": "2.10.
|
|
3
|
+
"version": "2.10.209",
|
|
4
4
|
"description": "Fetch your Symbols configuration",
|
|
5
5
|
"main": "bin/fetch.js",
|
|
6
6
|
"author": "Symbols",
|
|
@@ -24,5 +24,5 @@
|
|
|
24
24
|
"node-fetch": "^3.1.0",
|
|
25
25
|
"v8-compile-cache": "^2.3.0"
|
|
26
26
|
},
|
|
27
|
-
"gitHead": "
|
|
27
|
+
"gitHead": "35746d7c15665b6bf65866553b251a4c6fff71bf"
|
|
28
28
|
}
|