@symbo.ls/cli 2.11.56 → 2.11.60

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/create.js +28 -9
  2. package/package.json +2 -2
package/bin/create.js CHANGED
@@ -1,8 +1,18 @@
1
1
  'use strict'
2
2
 
3
+ import chalk from 'chalk'
4
+ import fs from 'fs'
3
5
  import { execSync } from 'child_process'
4
6
  import { program } from './program.js'
5
- import { initRepo } from './init-helpers/init-repo.js'
7
+
8
+ function folderExists (path) {
9
+ try {
10
+ fs.accessSync(path, fs.constants.F_OK)
11
+ return true // The folder exists
12
+ } catch (err) {
13
+ return false // The folder does not exist
14
+ }
15
+ }
6
16
 
7
17
  const REPO_URLS = {
8
18
  domql: 'https://github.com/symbo-ls/starter-kit',
@@ -16,16 +26,16 @@ program
16
26
  .command('create')
17
27
  .description('Create and initialize a new project')
18
28
  .argument('dest', 'Project directory')
19
- .option('--domql', 'Use Domql in the project')
20
- .option('--react', 'Use React in the project (default)', true)
29
+ .option('--domql', 'Use DOMQL in the project', true)
30
+ .option('--react', 'Use React in the project (default)')
21
31
  .option('--angular', 'Use Angular in the project')
22
32
  .option('--vue2', 'Use Vue2 in the project')
23
33
  .option('--vue3', 'Use Vue3 in the project')
24
34
  .action(async (dest, options) => {
25
35
  // Determine framework
26
- let framework = 'react'
27
- if (options.domql) {
28
- framework = 'domql'
36
+ let framework = 'domql'
37
+ if (options.react) {
38
+ framework = 'react'
29
39
  } else if (options.angular) {
30
40
  framework = 'angular'
31
41
  } else if (options.vue2) {
@@ -35,10 +45,19 @@ program
35
45
  }
36
46
  const cloneUrl = REPO_URLS[framework]
37
47
 
38
- // Clone
48
+ if (folderExists(dest)) {
49
+ console.error(`Folder ${dest} already exists!`)
50
+ return
51
+ }
52
+
39
53
  console.log(`Cloning ${cloneUrl} into '${dest}'...`)
40
54
  execSync(`git clone ${cloneUrl} ${dest}`)
41
55
 
42
- // Leave the rest to init
43
- return await initRepo(dest, framework)
56
+ process.chdir(dest)
57
+ console.log('Installing Dependencies...')
58
+ console.log()
59
+ execSync('npm i')
60
+ console.log()
61
+ console.log(chalk.green.bold(dest), 'successfuly created!')
62
+ console.log(`Done! run \`${chalk.bold('npm start')}\` to start the development server.`)
44
63
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@symbo.ls/cli",
3
- "version": "2.11.56",
3
+ "version": "2.11.60",
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": "f69acac1d0a3b53b8c6d7caac06964b830174cec"
30
+ "gitHead": "3ba5ee704005367abf07a342904d9b99d1c4ae81"
31
31
  }