@symbo.ls/cli 2.11.317 → 2.11.327

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/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 } from 'child_process'
6
+ import { execSync, spawnSync } from 'child_process'
7
7
  import { program } from './program.js'
8
8
  import { addToJson } from './init-helpers/addToJson.js'
9
9
 
@@ -28,11 +28,13 @@ program
28
28
  .command('create')
29
29
  .description('Create and initialize a new project')
30
30
  .argument('dest', 'Project directory')
31
+ .option('--remote', 'Fetch from platform', true)
31
32
  .option('--domql', 'Use DOMQL in the project', true)
32
33
  .option('--react', 'Use React in the project (default)')
33
34
  .option('--angular', 'Use Angular in the project')
34
35
  .option('--vue2', 'Use Vue2 in the project')
35
36
  .option('--vue3', 'Use Vue3 in the project')
37
+ .option('--yarn', 'Install via yarn', true)
36
38
  .action(async (dest = 'symbols-starter-kit', options) => {
37
39
  // Determine framework
38
40
  let framework = 'domql'
@@ -53,16 +55,17 @@ program
53
55
  }
54
56
 
55
57
  console.log(`Cloning ${cloneUrl} into '${dest}'...`)
56
- execSync(`git clone ${cloneUrl} ${dest}`)
58
+ execSync(`git clone ${options.remote ? ' -b feature/remote' : ''} ${cloneUrl} ${dest}`)
57
59
 
58
60
  process.chdir(dest)
59
61
 
60
62
  const SYMBOLS_FILE_PATH = path.join(process.cwd(), 'symbols.json')
61
63
  addToJson(SYMBOLS_FILE_PATH, 'key', `${dest}.symbo.ls`)
64
+ addToJson(SYMBOLS_FILE_PATH, 'packageManager', `${options.yarn ? 'yarn' : 'npm'}`)
62
65
 
63
66
  console.log('Installing Dependencies...')
64
67
  console.log()
65
- execSync('npm i')
68
+ spawnSync('yarn')
66
69
  console.log()
67
70
  console.log(chalk.green.bold(dest), 'successfuly created!')
68
71
  console.log(`Done! run \`${chalk.bold('npm start')}\` to start the development server.`)
@@ -4,25 +4,24 @@ import fs from 'fs'
4
4
 
5
5
  // Step 1: Read the JSON file
6
6
  export const addToJson = (filePath, key, value) => {
7
- fs.readFile(filePath, 'utf8', (err, data) => {
8
- if (err) {
9
- console.error('Error reading file:', err)
10
- return
11
- }
7
+ const data = fs.readFileSync(filePath, { encoding: 'utf8' })
8
+ if (!data) {
9
+ console.error('Error reading file:', data)
10
+ return
11
+ }
12
12
 
13
- try {
14
- const jsonData = JSON.parse(data)
13
+ try {
14
+ const jsonData = JSON.parse(data)
15
15
 
16
- jsonData[key] = value
16
+ jsonData[key] = value
17
17
 
18
- fs.writeFileSync(filePath, JSON.stringify(jsonData, null, 2), 'utf8', err => {
19
- if (err) {
20
- console.error('Error writing file:', err)
21
- }
22
- console.log(filePath, JSON.stringify(jsonData, null, 2))
23
- })
24
- } catch (parseError) {
25
- console.error('Error parsing JSON:', parseError)
26
- }
27
- })
18
+ fs.writeFileSync(filePath, JSON.stringify(jsonData, null, 2), 'utf8', err => {
19
+ if (err) {
20
+ console.error('Error writing file:', err)
21
+ }
22
+ console.log(filePath, JSON.stringify(jsonData, null, 2))
23
+ })
24
+ } catch (parseError) {
25
+ console.error('Error parsing JSON:', parseError)
26
+ }
28
27
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@symbo.ls/cli",
3
- "version": "2.11.317",
3
+ "version": "2.11.327",
4
4
  "description": "Fetch your Symbols configuration",
5
5
  "main": "bin/fetch.js",
6
6
  "author": "Symbols",
@@ -21,11 +21,12 @@
21
21
  "chalk": "^5.0.0",
22
22
  "commander": "latest",
23
23
  "esbuild": "^0.19.2",
24
+ "inquirer": "^9.2.17",
24
25
  "node-fetch": "^3.1.0",
25
26
  "v8-compile-cache": "^2.3.0"
26
27
  },
27
28
  "peerDependencies": {
28
29
  "@symbo.ls/convert": "latest"
29
30
  },
30
- "gitHead": "893d1978b8fb04a4bf9790a75c93ddd4814c0d49"
31
+ "gitHead": "cad8a2eaaaa68b40c237cc35d1236095f600a30e"
31
32
  }