@symbo.ls/cli 0.6.26 → 0.6.28

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/clean.js ADDED
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { sync } from '@symbo.ls/socket'
4
+ import { program } from './program.js'
5
+
6
+ program
7
+ .command('clean')
8
+ .description('Clean Symbols temp files')
9
+ .action(async () => {
10
+ sync()
11
+ })
package/bin/fetch.js CHANGED
@@ -4,28 +4,47 @@ import fs from 'fs'
4
4
  import fetch from 'node-fetch'
5
5
  import chalk from 'chalk'
6
6
  import { loadModule } from './require.js'
7
- import { Command } from 'commander'
8
7
  import { exec } from 'child_process'
8
+ import { program } from './program.js'
9
9
 
10
- const pkg = loadModule('../package.json')
11
- const program = new Command()
10
+ const PACKAGE_PATH = process.cwd() + '/package.json'
11
+ const RC_PATH = process.cwd() + '/node_modules/@symbo.ls/init/src/dynamic.json'
12
+ const LOCAL_CONFIG_PATH = process.cwd() + '/node_modules/@symbo.ls/init/src/dynamic.json'
13
+ const DEFAULT_REMOTE_REPOSITORY = 'https://github.com/symbo-ls/config-default/'
14
+ const DEFAULT_REMOTE_CONFIG_PATH = 'https://raw.githubusercontent.com/symbo-ls/config-default/main/src/config.json'
12
15
 
13
16
  const API_URL = 'https://api.symbols.app/' // eslint-disable-line
14
- const DEFAULT_CONFIG = 'https://raw.githubusercontent.com/symbo-ls/uikit/feature/monorepo/packages/config-default/src/config.json'
15
- const LOG_DEST = 'https://raw.githubusercontent.com/symbo-ls/uikit/packages/config-default/src/config.json'
17
+
18
+ const pkg = loadModule(PACKAGE_PATH)
19
+ const rc_file = loadModule(RC_PATH) // eslint-disable-line
20
+ const local_config = loadModule(LOCAL_CONFIG_PATH) // eslint-disable-line
16
21
 
17
22
  program
18
23
  .version(pkg.version)
19
24
 
20
25
  program
21
- .command('init [destination]')
22
- .description('Initialize a repository')
23
- .option('-m, --mode', 'Which Symbols to install (domql, react)')
24
- .action(async (mode) => {
25
- const packageName = `@symbo.ls/${mode || 'uikit'}`
26
+ .command('install')
27
+ .description('Install Symbols')
28
+ .option('--framework', 'Which Symbols to install (domql, react)')
29
+ .action(async (framework) => {
30
+ // const packageName = `@symbo.ls/${mode || 'uikit'}`
31
+ const packageName = 'smbls'
26
32
  console.log('Adding', chalk.green.bold(packageName))
27
33
 
28
- exec(`yarn add ${packageName} --force`, (error, stdout, stderr) => {
34
+ if (framework === 'domql' || rc_file.framework === 'domql') {
35
+ exec('yarn add domql@^1.15.26 --force', (error, stdout, stderr) => {
36
+ if (error) {
37
+ console.log(`error: ${error.message}`)
38
+ return
39
+ }
40
+ if (stderr) {
41
+ console.log(`stderr: ${stderr}`)
42
+ // return;
43
+ }
44
+ })
45
+ }
46
+
47
+ exec(`yarn add ${packageName}@^0.15.22 --force`, (error, stdout, stderr) => {
29
48
  if (error) {
30
49
  console.log(`error: ${error.message}`)
31
50
  return
@@ -46,27 +65,22 @@ program
46
65
  .command('fetch [destination]')
47
66
  .description('Fetch symbols')
48
67
  .action(async (source, destination) => {
49
- const response = await fetch(DEFAULT_CONFIG)
68
+ const response = await fetch(DEFAULT_REMOTE_CONFIG_PATH)
50
69
  const body = await response.json()
51
70
  const { version, ...config } = body
52
71
 
53
- console.log(source, destination)
54
-
72
+ console.log(chalk.dim('- Default config from:'), chalk.dim.underline(DEFAULT_REMOTE_REPOSITORY))
55
73
  console.log('')
56
74
  console.log(chalk.bold('Symbols'), 'config fetched:', chalk.green(version))
57
- console.log(chalk.dim('- Default config from:'), chalk.dim.underline(LOG_DEST))
58
75
 
59
- const path = process.cwd() + '/.symbolsrc.json'
60
- console.log(chalk.dim('- .symbolsrc.json created:'), chalk.dim.underline(path))
76
+ console.log(chalk.dim('- .symbolsrc.json created:'), chalk.dim.underline(LOCAL_CONFIG_PATH))
61
77
  console.log('')
62
78
 
63
79
  const bodyString = JSON.stringify(body)
64
- fs.writeFile(path, bodyString, err => {
80
+ fs.writeFile(LOCAL_CONFIG_PATH, bodyString, err => {
65
81
  if (err) {
66
82
  console.log('Error writing file', err)
67
83
  } else {
68
- const initPath = process.cwd() + '/node_modules/@symbo.ls/scratch-init/.symbolsrc.json'
69
- fs.writeFile(initPath, bodyString, err => { if (err) throw err })
70
84
  console.log('Successfully wrote file')
71
85
  }
72
86
  })
@@ -78,6 +92,3 @@ program
78
92
  console.log(Object.keys(type))
79
93
  }
80
94
  })
81
-
82
- const args = process.argv
83
- program.parse(args)
package/bin/index.js CHANGED
@@ -1,6 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import 'v8-compile-cache'
4
+
5
+ import { program } from './program.js'
4
6
  import './init.js'
5
7
  import './fetch.js'
6
8
  import './sync.js'
9
+ import './clean.js'
10
+
11
+ const args = process.argv
12
+ program.parse(args)
package/bin/init.js CHANGED
@@ -2,30 +2,29 @@
2
2
 
3
3
  import { exec } from 'child_process'
4
4
  import chalk from 'chalk'
5
-
6
- import { Command } from 'commander'
7
- const program = new Command()
5
+ import { program } from './program.js'
8
6
 
9
7
  program
10
- .command('init [destination]')
8
+ .command('init [name]')
11
9
  .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))
10
+ .argument('<name>')
11
+ .option('--framework', 'Which Symbols to install (domql, react)')
12
+ .action(async (framework) => {
13
+ const packageName = `@symbo.ls/${framework || 'uikit'}`
14
+ console.log('Creating', chalk.green.bold(packageName))
16
15
 
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
- })
16
+ // exec(`git clone git@github.com:symbo-ls/starter-kit.git`, (error, stdout, stderr) => {
17
+ // if (error) {
18
+ // console.log(`error: ${error.message}`)
19
+ // return
20
+ // }
21
+ // if (stderr) {
22
+ // console.warn(`stderr: ${stderr}`)
23
+ // return
24
+ // }
25
+ // console.log(`stdout: ${stdout}`)
26
+ // console.log(chalk.green.bold(packageName), 'successfuly added!')
27
+ // console.log('')
28
+ // console.log(chalk.dim.underline('Now you can import components like:'), `import { Button } from "${chalk.green.bold(packageName)}""`)
29
+ // })
31
30
  })
package/bin/program.js ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { Command } from 'commander'
4
+ export const program = new Command()
package/bin/require.js CHANGED
@@ -1,10 +1,8 @@
1
- class ImportError extends Error {}
1
+ import { createRequire } from 'module'
2
+
3
+ class ImportError extends Error {} // Bring in the ability to create the 'require' method
4
+ const require = createRequire(import.meta.url) // construct the require method
2
5
 
3
6
  export const loadModule = async (modulePath) => {
4
- try {
5
- return await import(modulePath)
6
- } catch (e) {
7
- console.warn('Cant found', modulePath)
8
- // throw new ImportError(`Unable to import module ${modulePath}`)
9
- }
7
+ return require(modulePath) // use the require method
10
8
  }
package/bin/sync.js CHANGED
@@ -1,3 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- require('@symbo.ls/socket')
3
+ import { sync } from '@symbo.ls/socket'
4
+ import { program } from './program.js'
5
+
6
+ program
7
+ .command('sync')
8
+ .description('Sync with Symbols')
9
+ .action(async () => {
10
+ sync()
11
+ })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@symbo.ls/cli",
3
- "version": "0.6.26",
3
+ "version": "0.6.28",
4
4
  "description": "Fetch your Symbols configuration",
5
5
  "main": "bin/fetch.js",
6
6
  "author": "Symbols",
@@ -16,10 +16,10 @@
16
16
  "vpatch": "npm version patch && npm publish"
17
17
  },
18
18
  "dependencies": {
19
- "@symbo.ls/socket": "latest",
20
19
  "@symbo.ls/init": "latest",
20
+ "@symbo.ls/socket": "latest",
21
21
  "chalk": "^5.0.0",
22
- "commander": "^8.3.0",
22
+ "commander": "^9.4.1",
23
23
  "node-fetch": "^3.1.0",
24
24
  "v8-compile-cache": "^2.3.0"
25
25
  },