@symbo.ls/cli 2.11.316 → 2.11.317

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/fetch.js +71 -71
  2. package/package.json +2 -2
package/bin/fetch.js CHANGED
@@ -1,138 +1,138 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import fs from "fs";
4
- import chalk from "chalk";
5
- import { loadModule } from "./require.js";
6
- import { program } from "./program.js";
7
- import * as fetch from "@symbo.ls/fetch";
8
- import * as utils from "@domql/utils";
9
- import { convertFromCli } from "./convert.js";
10
- import { createFs } from "./fs.js";
11
-
12
- const { isObjectLike } = utils.default;
13
- const { fetchRemote } = fetch.default;
14
-
15
- const RC_PATH = process.cwd() + "/symbols.json";
3
+ import fs from 'fs'
4
+ import chalk from 'chalk'
5
+ import { loadModule } from './require.js'
6
+ import { program } from './program.js'
7
+ import * as fetch from '@symbo.ls/fetch'
8
+ import * as utils from '@domql/utils'
9
+ import { convertFromCli } from './convert.js'
10
+ import { createFs } from './fs.js'
11
+
12
+ const { isObjectLike } = utils.default
13
+ const { fetchRemote } = fetch.default
14
+
15
+ const RC_PATH = process.cwd() + '/symbols.json'
16
16
  const LOCAL_CONFIG_PATH =
17
- process.cwd() + "/node_modules/@symbo.ls/init/dynamic.json";
18
- const DEFAULT_REMOTE_REPOSITORY = "https://github.com/symbo-ls/default-config/";
17
+ process.cwd() + '/node_modules/@symbo.ls/init/dynamic.json'
18
+ const DEFAULT_REMOTE_REPOSITORY = 'https://github.com/symbo-ls/default-config/'
19
19
  const DEFAULT_REMOTE_CONFIG_PATH = "https://api.symbols.app/"; // eslint-disable-line
20
20
 
21
- const API_URL_LOCAL = "http://localhost:13335/get/";
22
- const API_URL = "https://api.symbols.app/get/";
21
+ const API_URL_LOCAL = 'http://localhost:13335/get/'
22
+ const API_URL = 'https://api.symbols.app/get/'
23
23
 
24
24
  const rcFile = loadModule(RC_PATH); // eslint-disable-line
25
25
  const localConfig = loadModule(LOCAL_CONFIG_PATH); // eslint-disable-line
26
26
 
27
27
  const debugMsg = chalk.dim(
28
- "Use --verbose to debug the error or open the issue at https://github.com/symbo-ls/smbls"
29
- );
28
+ 'Use --verbose to debug the error or open the issue at https://github.com/symbo-ls/smbls'
29
+ )
30
30
 
31
- let rc = {};
31
+ let rc = {}
32
32
  try {
33
33
  rc = loadModule(RC_PATH); // eslint-disable-line
34
34
  } catch (e) {
35
- console.error("Please include symbols.json to your root of respository");
35
+ console.error('Please include symbols.json to your root of respository')
36
36
  }
37
37
 
38
38
  export const fetchFromCli = async (opts) => {
39
- const { dev, verbose, prettify, convert: convertOpt, update } = opts;
39
+ const { dev, verbose, prettify, convert: convertOpt, update } = opts
40
40
  await rc.then(async (data) => {
41
- const { key, framework, distDir } = data;
41
+ const { key, framework, distDir } = data
42
42
 
43
- const endpoint = dev ? API_URL_LOCAL : API_URL;
43
+ const endpoint = dev ? API_URL_LOCAL : API_URL
44
44
 
45
- console.log("\nFetching from:", chalk.bold(endpoint), "\n");
45
+ console.log('\nFetching from:', chalk.bold(endpoint), '\n')
46
46
 
47
47
  const body = await fetchRemote(key, {
48
48
  endpoint,
49
49
  onError: (e) => {
50
- console.log(chalk.red("Failed to fetch:"), key);
51
- if (verbose) console.error(e);
52
- else console.log(debugMsg);
53
- },
54
- });
50
+ console.log(chalk.red('Failed to fetch:'), key)
51
+ if (verbose) console.error(e)
52
+ else console.log(debugMsg)
53
+ }
54
+ })
55
55
 
56
- if (!body) return;
56
+ if (!body) return
57
57
 
58
- const { version, ...config } = body;
58
+ const { version, ...config } = body
59
59
 
60
60
  if (verbose) {
61
61
  if (key) {
62
62
  console.log(
63
- chalk.bold("Symbols"),
64
- "data fetched for",
63
+ chalk.bold('Symbols'),
64
+ 'data fetched for',
65
65
  chalk.green(body.name)
66
- );
66
+ )
67
67
  } else {
68
68
  console.log(
69
- chalk.bold("Symbols"),
70
- "config fetched from",
71
- chalk.bold("default-config from:"),
69
+ chalk.bold('Symbols'),
70
+ 'config fetched from',
71
+ chalk.bold('default-config from:'),
72
72
  chalk.dim.underline(DEFAULT_REMOTE_REPOSITORY)
73
- );
73
+ )
74
74
  }
75
- console.log();
75
+ console.log()
76
76
  }
77
77
 
78
78
  for (const t in config) {
79
- const type = config[t];
80
- const arr = [];
79
+ const type = config[t]
80
+ const arr = []
81
81
  if (isObjectLike(type)) {
82
- for (const v in type) arr.push(v);
82
+ for (const v in type) arr.push(v)
83
83
  if (arr.length) {
84
- console.log(chalk.dim(t + ":"));
85
- console.log(chalk.bold(arr.join(", ")));
84
+ console.log(chalk.dim(t + ':'))
85
+ console.log(chalk.bold(arr.join(', ')))
86
86
  } else {
87
- console.log(chalk.dim(t + ":"), chalk.dim("- empty -"));
87
+ console.log(chalk.dim(t + ':'), chalk.dim('- empty -'))
88
88
  }
89
- } else console.log(chalk.dim(t + ":"), chalk.bold(type));
89
+ } else console.log(chalk.dim(t + ':'), chalk.bold(type))
90
90
  }
91
91
 
92
92
  if (body.designsystem) {
93
- body.designSystem = body.designsystem;
94
- delete body.designsystem;
93
+ body.designSystem = body.designsystem
94
+ delete body.designsystem
95
95
  }
96
96
 
97
- const bodyString = JSON.stringify(body, null, prettify ?? 2);
97
+ const bodyString = JSON.stringify(body, null, prettify ?? 2)
98
98
 
99
99
  try {
100
- await fs.writeFileSync(LOCAL_CONFIG_PATH, bodyString);
100
+ await fs.writeFileSync(LOCAL_CONFIG_PATH, bodyString)
101
101
 
102
102
  if (verbose) {
103
- console.log(chalk.dim("\ndynamic.json has been updated:"));
104
- console.log(chalk.dim.underline(LOCAL_CONFIG_PATH));
103
+ console.log(chalk.dim('\ndynamic.json has been updated:'))
104
+ console.log(chalk.dim.underline(LOCAL_CONFIG_PATH))
105
105
  }
106
106
 
107
- console.log(chalk.bold.green("\nSuccessfully wrote file"));
107
+ console.log(chalk.bold.green('\nSuccessfully wrote file'))
108
108
  } catch (e) {
109
- console.log(chalk.bold.red("\nError writing file"));
110
- if (verbose) console.error(e);
111
- else console.log(debugMsg);
109
+ console.log(chalk.bold.red('\nError writing file'))
110
+ if (verbose) console.error(e)
111
+ else console.log(debugMsg)
112
112
  }
113
113
 
114
- console.log(convertOpt);
114
+ console.log(convertOpt)
115
115
  if (body.components && convertOpt && framework) {
116
- convertFromCli(body.components, { ...opts, framework });
116
+ convertFromCli(body.components, { ...opts, framework })
117
117
  }
118
118
 
119
119
  if (update) {
120
- createFs(body, distDir, update);
120
+ createFs(body, distDir, update)
121
121
  } else {
122
- createFs(body, distDir);
122
+ createFs(body, distDir)
123
123
  }
124
- });
125
- };
124
+ })
125
+ }
126
126
 
127
127
  program
128
- .command("fetch")
129
- .description("Fetch Symbols")
130
- .option("-d, --dev", "Running from local server")
131
- .option("-v, --verbose", "Verbose errors and warnings")
132
- .option("--convert", "Verbose errors and warnings", true)
133
- .option("--update", "overriding changes from platform")
134
- .option("--verbose-code", "Verbose errors and warnings")
135
- .action(fetchFromCli);
128
+ .command('fetch')
129
+ .description('Fetch Symbols')
130
+ .option('-d, --dev', 'Running from local server')
131
+ .option('-v, --verbose', 'Verbose errors and warnings')
132
+ .option('--convert', 'Verbose errors and warnings', true)
133
+ .option('--update', 'overriding changes from platform')
134
+ .option('--verbose-code', 'Verbose errors and warnings')
135
+ .action(fetchFromCli)
136
136
 
137
137
  // program
138
138
  // .command("push")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@symbo.ls/cli",
3
- "version": "2.11.316",
3
+ "version": "2.11.317",
4
4
  "description": "Fetch your Symbols configuration",
5
5
  "main": "bin/fetch.js",
6
6
  "author": "Symbols",
@@ -27,5 +27,5 @@
27
27
  "peerDependencies": {
28
28
  "@symbo.ls/convert": "latest"
29
29
  },
30
- "gitHead": "ed0a2b1ad4395c057770dc16b763bcf344232162"
30
+ "gitHead": "893d1978b8fb04a4bf9790a75c93ddd4814c0d49"
31
31
  }