@symbo.ls/cli 0.6.19 → 0.6.23

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 (3) hide show
  1. package/bin/fetch.js +13 -11
  2. package/bin/init.js +25 -21
  3. package/package.json +1 -1
package/bin/fetch.js CHANGED
@@ -5,7 +5,7 @@ import fetch from 'node-fetch'
5
5
  import chalk from 'chalk'
6
6
  import { loadModule } from './require.js'
7
7
  import { Command } from 'commander'
8
- import { exec } from "child_process"
8
+ import { exec } from 'child_process'
9
9
 
10
10
  const pkg = loadModule('../package.json')
11
11
  const program = new Command()
@@ -17,8 +17,7 @@ const LOG_DEST = 'https://raw.githubusercontent.com/symbo-ls/uikit/packages/conf
17
17
  program
18
18
  .version(pkg.version)
19
19
 
20
-
21
- program
20
+ program
22
21
  .command('init [destination]')
23
22
  .description('Initialize a repository')
24
23
  .option('-m, --mode', 'Which Symbols to install (domql, react)')
@@ -28,16 +27,16 @@ program
28
27
 
29
28
  exec(`yarn add ${packageName} --force`, (error, stdout, stderr) => {
30
29
  if (error) {
31
- console.log(`error: ${error.message}`);
32
- return;
30
+ console.log(`error: ${error.message}`)
31
+ return
33
32
  }
34
33
  if (stderr) {
35
- console.log(`stderr: ${stderr}`);
34
+ console.log(`stderr: ${stderr}`)
36
35
  // return;
37
36
  }
38
- console.log(``);
39
- console.log(`stdout: ${stdout}`);
40
- console.log(`\n`);
37
+ console.log('')
38
+ console.log(`stdout: ${stdout}`)
39
+ console.log('\n')
41
40
  console.log(chalk.green.bold(packageName), 'successfuly added!')
42
41
  console.log('')
43
42
  console.log(chalk.dim('Now you can import components like:'), `import { Button } from "${chalk.green.bold(packageName)}"`)
@@ -61,10 +60,13 @@ program
61
60
  console.log(chalk.dim('- .symbolsrc.json created:'), chalk.dim.underline(path))
62
61
  console.log('')
63
62
 
64
- fs.writeFile(path, JSON.stringify(body), err => {
63
+ const bodyString = JSON.stringify(body)
64
+ fs.writeFile(path, bodyString, err => {
65
65
  if (err) {
66
66
  console.log('Error writing file', err)
67
67
  } else {
68
+ const initPath = process.cwd() + '/node_modules/@symbo.ls/scratch-init/.symbolsrc.json'
69
+ fs.writeFile(initPath, bodyString, err => { if (err) throw err })
68
70
  console.log('Successfully wrote file')
69
71
  }
70
72
  })
@@ -77,5 +79,5 @@ program
77
79
  }
78
80
  })
79
81
 
80
- var args = process.argv
82
+ const args = process.argv
81
83
  program.parse(args)
package/bin/init.js CHANGED
@@ -1,27 +1,31 @@
1
1
  'use strict'
2
2
 
3
- import { exec } from "child_process"
3
+ import { exec } from 'child_process'
4
+ import chalk from 'chalk'
5
+
6
+ import { Command } from 'commander'
7
+ const program = new Command()
4
8
 
5
9
  program
6
- .command('init [destination]')
7
- .description('Initialize a repository')
8
- .option('-m, --mode', 'Which Symbols to install (domql, react)')
9
- .action(async (mode) => {
10
- const packageName = `@symbo.ls/${mode || 'uikit'}`
11
- console.log('Adding', chalk.green.bold(packageName))
10
+ .command('init [destination]')
11
+ .description('Initialize a repository')
12
+ .option('-m, --mode', 'Which Symbols to install (domql, react)')
13
+ .action(async (mode) => {
14
+ const packageName = `@symbo.ls/${mode || 'uikit'}`
15
+ console.log('Adding', chalk.green.bold(packageName))
12
16
 
13
- exec(`yarn add ${packageName} --force`, (error, stdout, stderr) => {
14
- if (error) {
15
- console.log(`error: ${error.message}`);
16
- return;
17
- }
18
- if (stderr) {
19
- console.warn(`stderr: ${stderr}`);
20
- return;
21
- }
22
- console.log(`stdout: ${stdout}`);
23
- console.log(chalk.green.bold(packageName), 'successfuly added!')
24
- console.log('')
25
- console.log(chalk.dim.underline('Now you can import components like:'), `import { Button } from "${chalk.green.bold(packageName)}""`)
17
+ exec(`yarn add ${packageName} --force`, (error, stdout, stderr) => {
18
+ if (error) {
19
+ console.log(`error: ${error.message}`)
20
+ return
21
+ }
22
+ if (stderr) {
23
+ console.warn(`stderr: ${stderr}`)
24
+ return
25
+ }
26
+ console.log(`stdout: ${stdout}`)
27
+ console.log(chalk.green.bold(packageName), 'successfuly added!')
28
+ console.log('')
29
+ console.log(chalk.dim.underline('Now you can import components like:'), `import { Button } from "${chalk.green.bold(packageName)}""`)
30
+ })
26
31
  })
27
- })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@symbo.ls/cli",
3
- "version": "0.6.19",
3
+ "version": "0.6.23",
4
4
  "description": "Fetch your Symbols configuration",
5
5
  "main": "bin/fetch.js",
6
6
  "author": "Symbols",