@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 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 fs from 'fs'
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 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)')
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 repo to clone
32
- let cloneUrl = REPO_URLS.react
26
+ // Determine framework
27
+ let framework = 'react'
33
28
  if (options.domql) {
34
- cloneUrl = REPO_URLS.domql
29
+ framework = 'domql'
35
30
  } else if (options.angular) {
36
- cloneUrl = REPO_URLS.angular
31
+ framework = 'angular'
37
32
  } else if (options.vue2) {
38
- cloneUrl = REPO_URLS.vue2
33
+ framework = 'vue2'
39
34
  } else if (options.vue3) {
40
- cloneUrl = REPO_URLS.vue3
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
- // 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!')
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 [name]')
9
- .description('Initialize a repository')
10
- .option('--framework', 'Which Symbols to install (domql, react)')
11
- .action(async (framework) => {
12
- const packageName = `@symbo.ls/${framework || 'uikit'}`
13
- console.log('Creating', chalk.green.bold(packageName))
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
- // exec(`git clone git@github.com:symbo-ls/starter-kit.git`, (error, stdout, stderr) => {
16
- // if (error) {
17
- // console.log(`error: ${error.message}`)
18
- // return
19
- // }
20
- // if (stderr) {
21
- // console.warn(`stderr: ${stderr}`)
22
- // return
23
- // }
24
- // console.log(`stdout: ${stdout}`)
25
- // console.log(chalk.green.bold(packageName), 'successfuly added!')
26
- // console.log('')
27
- // console.log(chalk.dim.underline('Now you can import components like:'), `import { Button } from "${chalk.green.bold(packageName)}""`)
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.225",
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": "ab9664d8dfad6716978095254e3e3526f8cad696"
28
+ "gitHead": "4da2b1c77bd894f10cc5d85d9fcd84696614675f"
28
29
  }
File without changes