@symbo.ls/cli 0.6.18 → 0.6.19

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/fetch.js CHANGED
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import 'v8-compile-cache'
4
3
  import fs from 'fs'
5
4
  import fetch from 'node-fetch'
6
5
  import chalk from 'chalk'
7
6
  import { loadModule } from './require.js'
8
7
  import { Command } from 'commander'
8
+ import { exec } from "child_process"
9
9
 
10
10
  const pkg = loadModule('../package.json')
11
11
  const program = new Command()
@@ -17,6 +17,32 @@ 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
22
+ .command('init [destination]')
23
+ .description('Initialize a repository')
24
+ .option('-m, --mode', 'Which Symbols to install (domql, react)')
25
+ .action(async (mode) => {
26
+ const packageName = `@symbo.ls/${mode || 'uikit'}`
27
+ console.log('Adding', chalk.green.bold(packageName))
28
+
29
+ exec(`yarn add ${packageName} --force`, (error, stdout, stderr) => {
30
+ if (error) {
31
+ console.log(`error: ${error.message}`);
32
+ return;
33
+ }
34
+ if (stderr) {
35
+ console.log(`stderr: ${stderr}`);
36
+ // return;
37
+ }
38
+ console.log(``);
39
+ console.log(`stdout: ${stdout}`);
40
+ console.log(`\n`);
41
+ console.log(chalk.green.bold(packageName), 'successfuly added!')
42
+ console.log('')
43
+ console.log(chalk.dim('Now you can import components like:'), `import { Button } from "${chalk.green.bold(packageName)}"`)
44
+ })
45
+ })
20
46
  program
21
47
  .command('fetch [destination]')
22
48
  .description('Fetch symbols')
@@ -25,6 +51,8 @@ program
25
51
  const body = await response.json()
26
52
  const { version, ...config } = body
27
53
 
54
+ console.log(source, destination)
55
+
28
56
  console.log('')
29
57
  console.log(chalk.bold('Symbols'), 'config fetched:', chalk.green(version))
30
58
  console.log(chalk.dim('- Default config from:'), chalk.dim.underline(LOG_DEST))
package/bin/index.js ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+
3
+ import 'v8-compile-cache'
4
+ import './init.js'
5
+ import './fetch.js'
package/bin/init.js ADDED
@@ -0,0 +1,27 @@
1
+ 'use strict'
2
+
3
+ import { exec } from "child_process"
4
+
5
+ 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))
12
+
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)}""`)
26
+ })
27
+ })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@symbo.ls/cli",
3
- "version": "0.6.18",
3
+ "version": "0.6.19",
4
4
  "description": "Fetch your Symbols configuration",
5
5
  "main": "bin/fetch.js",
6
6
  "author": "Symbols",
@@ -8,10 +8,10 @@
8
8
  "private": false,
9
9
  "type": "module",
10
10
  "bin": {
11
- "symbo-ls": "bin/fetch.js"
11
+ "symbo-ls": "bin/index.js"
12
12
  },
13
13
  "scripts": {
14
- "start": "node bin/fetch.js",
14
+ "start": "node bin/index.js",
15
15
  "vpush": "git add . && git commit -am 'version update' && git push",
16
16
  "vpatch": "npm version patch && npm publish"
17
17
  },
@@ -22,6 +22,14 @@
22
22
  "v8-compile-cache": "^2.3.0"
23
23
  },
24
24
  "devDependencies": {
25
- "np": "^7.6.0"
25
+ "np": "^7.6.0",
26
+ "@babel/core": "^7.10.4",
27
+ "@babel/preset-env": "^7.10.4",
28
+ "eslint": "^7.12.1",
29
+ "babel-eslint": "^10.0.3",
30
+ "standard": "^16.0.1"
31
+ },
32
+ "standard": {
33
+ "parser": "babel-eslint"
26
34
  }
27
35
  }