@symbo.ls/cli 2.10.225 → 2.10.227
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 +1 -1
- package/bin/create.js +20 -35
- package/bin/init-helpers/init-repo.js +37 -0
- package/bin/init.js +25 -22
- package/package.json +3 -2
- /package/bin/{create → init-helpers}/DesignSystem.js +0 -0
package/bin/convert.js
CHANGED
|
@@ -28,7 +28,7 @@ async function mkdirp(dir) {
|
|
|
28
28
|
program
|
|
29
29
|
.command('convert')
|
|
30
30
|
.description('Recursively convert and copy all DomQL components under a directory')
|
|
31
|
-
.argument('[src]', 'Source directory. By default, it is "
|
|
31
|
+
.argument('[src]', 'Source directory. By default, it is "src/"')
|
|
32
32
|
.argument('[dest]', 'Destination directory. By default, it becomes the name of the desired format')
|
|
33
33
|
.option('--react', 'Convert all DomQL components to React')
|
|
34
34
|
.option('--angular', 'Convert all DomQL components to Angular')
|
package/bin/create.js
CHANGED
|
@@ -2,59 +2,44 @@
|
|
|
2
2
|
|
|
3
3
|
import { execSync } from 'child_process'
|
|
4
4
|
import { program } from './program.js'
|
|
5
|
-
import
|
|
5
|
+
import { initRepo } from './init-helpers/init-repo.js'
|
|
6
6
|
import path from 'path'
|
|
7
|
-
import { fileURLToPath } from 'url';
|
|
8
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
9
|
-
const __dirname = path.dirname(__filename);
|
|
10
7
|
|
|
11
|
-
const DESIGN_SYSTEM_FILE_PATH = path.join(
|
|
12
|
-
__dirname, 'create', 'DesignSystem.js')
|
|
13
8
|
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',
|
|
9
|
+
'domql': 'https://github.com/symbo-ls/create-domql-app.git',
|
|
10
|
+
'react': 'https://github.com/symbo-ls/create-react-app.git',
|
|
11
|
+
'angular': 'https://github.com/symbo-ls/create-angular-app.git',
|
|
12
|
+
'vue2': 'https://github.com/symbo-ls/create-vue2-app.git',
|
|
13
|
+
'vue3': 'https://github.com/symbo-ls/create-vue3-app.git',
|
|
19
14
|
}
|
|
20
15
|
|
|
21
16
|
program
|
|
22
17
|
.command('create')
|
|
23
|
-
.description('Create a new project
|
|
24
|
-
.argument('dest', 'Project directory
|
|
25
|
-
.option('--domql', 'Use Domql in the project
|
|
26
|
-
.option('--react', 'Use React in the project (default)')
|
|
18
|
+
.description('Create and initialize a new project')
|
|
19
|
+
.argument('dest', 'Project directory')
|
|
20
|
+
.option('--domql', 'Use Domql in the project')
|
|
21
|
+
.option('--react', 'Use React in the project (default)', true)
|
|
27
22
|
.option('--angular', 'Use Angular in the project')
|
|
28
23
|
.option('--vue2', 'Use Vue2 in the project')
|
|
29
24
|
.option('--vue3', 'Use Vue3 in the project')
|
|
30
25
|
.action(async (dest, options) => {
|
|
31
|
-
// Determine
|
|
32
|
-
let
|
|
26
|
+
// Determine framework
|
|
27
|
+
let framework = 'react'
|
|
33
28
|
if (options.domql) {
|
|
34
|
-
|
|
29
|
+
framework = 'domql'
|
|
35
30
|
} else if (options.angular) {
|
|
36
|
-
|
|
31
|
+
framework = 'angular'
|
|
37
32
|
} else if (options.vue2) {
|
|
38
|
-
|
|
33
|
+
framework = 'vue2'
|
|
39
34
|
} else if (options.vue3) {
|
|
40
|
-
|
|
35
|
+
framework = 'vue3'
|
|
41
36
|
}
|
|
37
|
+
let cloneUrl = REPO_URLS[framework]
|
|
42
38
|
|
|
43
39
|
// Clone
|
|
44
|
-
console.log(`Cloning ${cloneUrl} into ${dest}...`)
|
|
40
|
+
console.log(`Cloning ${cloneUrl} into '${dest}'...`)
|
|
45
41
|
execSync(`git clone ${cloneUrl} ${dest}`)
|
|
46
42
|
|
|
47
|
-
//
|
|
48
|
-
|
|
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!')
|
|
43
|
+
// Leave the rest to init
|
|
44
|
+
return await initRepo(dest, framework)
|
|
60
45
|
})
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
import { execSync } from 'child_process'
|
|
4
|
+
import fs from 'fs'
|
|
5
|
+
import path from 'path'
|
|
6
|
+
import { fileURLToPath } from 'url';
|
|
7
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
8
|
+
const __dirname = path.dirname(__filename);
|
|
9
|
+
const DESIGN_SYSTEM_FILE_PATH = path.join(
|
|
10
|
+
__dirname, 'DesignSystem.js')
|
|
11
|
+
|
|
12
|
+
export async function initRepo(dest, framework) {
|
|
13
|
+
const cwd = process.cwd()
|
|
14
|
+
|
|
15
|
+
// Init NPM if necessary
|
|
16
|
+
if (!fs.existsSync(path.join(dest, 'package.json'))) {
|
|
17
|
+
process.chdir(dest)
|
|
18
|
+
console.log('Running npm init')
|
|
19
|
+
execSync(`npm init -y`)
|
|
20
|
+
process.chdir(cwd)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// TODO: inject smbls dependencies into package.json
|
|
24
|
+
|
|
25
|
+
// Install
|
|
26
|
+
console.log('Installing NPM dependencies...')
|
|
27
|
+
process.chdir(dest)
|
|
28
|
+
execSync(`npm install`, { stdio: ['inherit', 'inherit', 'ignore'] })
|
|
29
|
+
process.chdir(cwd)
|
|
30
|
+
|
|
31
|
+
// Copy design system file
|
|
32
|
+
const filePath = path.join(dest, 'DesignSystem.js')
|
|
33
|
+
console.log(`Writing DesignSystem.js to ${filePath}`)
|
|
34
|
+
await fs.promises.copyFile(DESIGN_SYSTEM_FILE_PATH, filePath)
|
|
35
|
+
|
|
36
|
+
console.log('Done!')
|
|
37
|
+
}
|
package/bin/init.js
CHANGED
|
@@ -1,29 +1,32 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
import { exec } from 'child_process'
|
|
4
|
-
import chalk from 'chalk'
|
|
5
3
|
import { program } from './program.js'
|
|
4
|
+
import { initRepo } from './init-helpers/init-repo.js'
|
|
6
5
|
|
|
7
6
|
program
|
|
8
|
-
.command('init
|
|
9
|
-
.description('Initialize a
|
|
10
|
-
.
|
|
11
|
-
.
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
.command('init')
|
|
8
|
+
.description('Initialize a project')
|
|
9
|
+
.argument('[dest]', 'Project directory. By default, it is "."')
|
|
10
|
+
.option('--domql', 'Use Domql in the project')
|
|
11
|
+
.option('--react', 'Use React in the project (default)', true)
|
|
12
|
+
.option('--angular', 'Use Angular in the project')
|
|
13
|
+
.option('--vue2', 'Use Vue2 in the project')
|
|
14
|
+
.option('--vue3', 'Use Vue3 in the project')
|
|
15
|
+
.action(async (dest, options) => {
|
|
16
|
+
if (!dest) dest = '.'
|
|
14
17
|
|
|
15
|
-
//
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
//
|
|
28
|
-
|
|
18
|
+
// Determine framework
|
|
19
|
+
let framework = 'react'
|
|
20
|
+
if (options.domql) {
|
|
21
|
+
framework = 'domql'
|
|
22
|
+
} else if (options.angular) {
|
|
23
|
+
framework = 'angular'
|
|
24
|
+
} else if (options.vue2) {
|
|
25
|
+
framework = 'vue2'
|
|
26
|
+
} else if (options.vue3) {
|
|
27
|
+
framework = 'vue3'
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Leave the rest to init
|
|
31
|
+
return await initRepo(dest, framework)
|
|
29
32
|
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@symbo.ls/cli",
|
|
3
|
-
"version": "2.10.
|
|
3
|
+
"version": "2.10.227",
|
|
4
4
|
"description": "Fetch your Symbols configuration",
|
|
5
5
|
"main": "bin/fetch.js",
|
|
6
6
|
"author": "Symbols",
|
|
@@ -19,10 +19,11 @@
|
|
|
19
19
|
"@symbo.ls/socket": "latest",
|
|
20
20
|
"chalk": "^5.0.0",
|
|
21
21
|
"commander": "latest",
|
|
22
|
+
"domql-to-mitosis": "^1.4.15",
|
|
22
23
|
"esbuild": "latest",
|
|
23
24
|
"jsdom": "^21.1.0",
|
|
24
25
|
"node-fetch": "^3.1.0",
|
|
25
26
|
"v8-compile-cache": "^2.3.0"
|
|
26
27
|
},
|
|
27
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "4da2b1c77bd894f10cc5d85d9fcd84696614675f"
|
|
28
29
|
}
|
|
File without changes
|