@symbo.ls/cli 2.11.329 → 2.11.330

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 +26 -8
  2. package/package.json +2 -2
package/bin/create.js CHANGED
@@ -3,7 +3,7 @@
3
3
  import chalk from 'chalk'
4
4
  import fs from 'fs'
5
5
  import path from 'path'
6
- import { execSync, spawnSync } from 'child_process'
6
+ import { exec, execSync } from 'child_process'
7
7
  import { program } from './program.js'
8
8
  import { addToJson } from './init-helpers/addToJson.js'
9
9
 
@@ -28,13 +28,14 @@ program
28
28
  .command('create')
29
29
  .description('Create and initialize a new project')
30
30
  .argument('dest', 'Project directory')
31
+ .option('--verbose', 'Verbose output')
31
32
  .option('--remote', 'Fetch from platform', true)
32
33
  .option('--domql', 'Use DOMQL in the project', true)
33
34
  .option('--react', 'Use React in the project (default)')
34
35
  .option('--angular', 'Use Angular in the project')
35
36
  .option('--vue2', 'Use Vue2 in the project')
36
37
  .option('--vue3', 'Use Vue3 in the project')
37
- .option('--yarn', 'Install via yarn', true)
38
+ .option('--package-manager <manager>', 'Choose the package manager (e.g., npm, yarn)', 'npm')
38
39
  .option('--clean-from-git', 'remove starter-kit git repository', true)
39
40
  .action(async (dest = 'symbols-starter-kit', options) => {
40
41
  // Determine framework
@@ -49,6 +50,7 @@ program
49
50
  framework = 'vue3'
50
51
  }
51
52
  const cloneUrl = REPO_URLS[framework]
53
+ const packageManager = options.packageManager || 'yarn'
52
54
 
53
55
  if (folderExists(dest)) {
54
56
  console.error(`Folder ${dest} already exists!`)
@@ -62,14 +64,30 @@ program
62
64
 
63
65
  const SYMBOLS_FILE_PATH = path.join(process.cwd(), 'symbols.json')
64
66
  addToJson(SYMBOLS_FILE_PATH, 'key', `${dest}.symbo.ls`)
65
- addToJson(SYMBOLS_FILE_PATH, 'packageManager', `${options.yarn ? 'yarn' : 'npm'}`)
67
+ addToJson(SYMBOLS_FILE_PATH, 'packageManager', `${packageManager}`)
68
+
69
+ console.log(`Installing dependencies using ${packageManager}...`)
70
+
71
+ const exc = exec(packageManager === 'yarn' ? 'yarn' : 'npm i')
72
+
73
+ if (options.verbose) {
74
+ exc.stdout.on('data', (data) => {
75
+ console.log(data)
76
+ })
77
+ exc.stderr.on('data', (data) => {
78
+ console.error(data)
79
+ })
80
+ } else {
81
+ console.log(chalk.dim('Use --verbose to print the output'))
82
+ }
66
83
 
67
- console.log('Installing Dependencies...')
68
- console.log()
69
- spawnSync('yarn')
70
84
  console.log()
71
- console.log(chalk.green.bold(dest), 'successfuly created!')
72
- console.log(`Done! run \`${chalk.bold('npm start')}\` to start the development server.`)
85
+
86
+ exc.on('close', (code) => {
87
+ console.log()
88
+ console.log(chalk.green.bold(dest), 'successfuly created!')
89
+ console.log(`Done! run \`${chalk.bold('cd ' + dest + '; ' + packageManager + ' start')}\` to start the development server.`)
90
+ })
73
91
 
74
92
  if (options.cleanFromGit) {
75
93
  fs.rmSync('.git', {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@symbo.ls/cli",
3
- "version": "2.11.329",
3
+ "version": "2.11.330",
4
4
  "description": "Fetch your Symbols configuration",
5
5
  "main": "bin/fetch.js",
6
6
  "author": "Symbols",
@@ -26,5 +26,5 @@
26
26
  "node-fetch": "^3.1.0",
27
27
  "v8-compile-cache": "^2.3.0"
28
28
  },
29
- "gitHead": "32cca3d81ac46ff4256421fdaca75de64aeb52ef"
29
+ "gitHead": "ad749737e40e7ddab38da2ed89548a6e0d2c4173"
30
30
  }