secrez 1.1.0 → 1.1.2

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 (69) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +414 -291
  3. package/bin/secrez.js +50 -47
  4. package/coverage.report +81 -0
  5. package/package.json +18 -20
  6. package/src/Command.js +78 -57
  7. package/src/PreCommand.js +74 -70
  8. package/src/Welcome.js +144 -134
  9. package/src/cliConfig.js +14 -14
  10. package/src/commands/Alias.js +123 -100
  11. package/src/commands/Bash.js +10 -12
  12. package/src/commands/Cat.js +117 -107
  13. package/src/commands/Cd.js +39 -42
  14. package/src/commands/Chat.js +75 -63
  15. package/src/commands/Conf.js +123 -99
  16. package/src/commands/Contacts.js +189 -171
  17. package/src/commands/Copy.js +132 -113
  18. package/src/commands/Courier.js +123 -105
  19. package/src/commands/Ds.js +88 -76
  20. package/src/commands/Edit.js +122 -103
  21. package/src/commands/Export.js +153 -114
  22. package/src/commands/Find.js +115 -110
  23. package/src/commands/Help.js +20 -23
  24. package/src/commands/Import.js +296 -225
  25. package/src/commands/Lcat.js +36 -39
  26. package/src/commands/Lcd.js +38 -39
  27. package/src/commands/Lls.js +58 -55
  28. package/src/commands/Lpwd.js +20 -24
  29. package/src/commands/Ls.js +107 -97
  30. package/src/commands/Mkdir.js +35 -38
  31. package/src/commands/Mv.js +147 -114
  32. package/src/commands/Paste.js +68 -65
  33. package/src/commands/Pwd.js +18 -23
  34. package/src/commands/Quit.js +22 -24
  35. package/src/commands/Rm.js +78 -70
  36. package/src/commands/Shell.js +31 -32
  37. package/src/commands/Ssh.js +77 -63
  38. package/src/commands/Tag.js +133 -112
  39. package/src/commands/Totp.js +166 -136
  40. package/src/commands/Touch.js +169 -56
  41. package/src/commands/Use.js +44 -41
  42. package/src/commands/Ver.js +16 -18
  43. package/src/commands/Whoami.js +34 -37
  44. package/src/commands/chat/Contacts.js +41 -44
  45. package/src/commands/chat/Help.js +20 -23
  46. package/src/commands/chat/Join.js +59 -55
  47. package/src/commands/chat/Leave.js +16 -22
  48. package/src/commands/chat/Quit.js +19 -24
  49. package/src/commands/chat/Send.js +58 -57
  50. package/src/commands/chat/Show.js +60 -51
  51. package/src/commands/chat/Whoami.js +18 -22
  52. package/src/commands/index.js +20 -22
  53. package/src/index.js +3 -3
  54. package/src/prompts/ChatPrompt.js +87 -82
  55. package/src/prompts/ChatPromptMock.js +11 -17
  56. package/src/prompts/CommandPrompt.js +146 -138
  57. package/src/prompts/Completion.js +64 -69
  58. package/src/prompts/MainPrompt.js +84 -77
  59. package/src/prompts/MainPromptMock.js +19 -30
  60. package/src/prompts/MultiEditorPrompt.js +21 -22
  61. package/src/prompts/SigintManager.js +21 -24
  62. package/src/utils/AliasManager.js +16 -18
  63. package/src/utils/ContactManager.js +15 -17
  64. package/src/utils/Fido2Client.js +59 -49
  65. package/src/utils/HelpProto.js +130 -117
  66. package/src/utils/Logger.js +48 -50
  67. package/.eslintignore +0 -0
  68. package/.eslintrc +0 -33
  69. package/.jshintrc +0 -3
@@ -1,108 +1,118 @@
1
- const path = require('path')
2
- const {Crypto} = require('@secrez/core')
3
- const {execAsync} = require('@secrez/utils')
4
- const _ = require('lodash')
1
+ const path = require("path");
2
+ const { Crypto } = require("@secrez/core");
3
+ const { execAsync } = require("@secrez/utils");
4
+ const _ = require("lodash");
5
5
 
6
6
  class Fido2Client {
7
-
8
7
  constructor(secrez) {
9
- this.keys = {}
10
- this.secrez = secrez
11
- this.scriptsPath = path.resolve(__dirname, '../../scripts')
8
+ this.keys = {};
9
+ this.secrez = secrez;
10
+ this.scriptsPath = path.resolve(__dirname, "../../scripts");
12
11
  }
13
12
 
14
13
  async updateConf() {
15
- const conf = await this.secrez.readConf()
16
- this.keys = {}
14
+ const conf = await this.secrez.readConf();
15
+ this.keys = {};
17
16
  if (conf.data.keys) {
18
- let keys = conf.data.keys
17
+ let keys = conf.data.keys;
19
18
  for (let authenticator in keys) {
20
- if (keys[authenticator].type === this.secrez.config.sharedKeys.FIDO2_KEY) {
21
- let key = this.keys[authenticator] = _.clone(keys[authenticator])
22
- key.id = this.secrez.preDecryptData(key.id)
23
- key.salt = this.secrez.preDecryptData(key.salt)
24
- key.credential = this.secrez.preDecryptData(key.credential)
19
+ if (
20
+ keys[authenticator].type === this.secrez.config.sharedKeys.FIDO2_KEY
21
+ ) {
22
+ let key = (this.keys[authenticator] = _.clone(keys[authenticator]));
23
+ key.id = this.secrez.preDecryptData(key.id);
24
+ key.salt = this.secrez.preDecryptData(key.salt);
25
+ key.credential = this.secrez.preDecryptData(key.credential);
25
26
  }
26
27
  }
27
28
  }
28
29
  }
29
30
 
30
31
  async getKeys(asAList) {
31
- await this.updateConf()
32
+ await this.updateConf();
32
33
  if (asAList) {
33
- let list = []
34
+ let list = [];
34
35
  for (let authenticator in this.keys) {
35
- list.push([authenticator, this.keys[authenticator].type])
36
+ list.push([authenticator, this.keys[authenticator].type]);
36
37
  }
37
- return list
38
+ return list;
38
39
  } else {
39
- return this.keys
40
+ return this.keys;
40
41
  }
41
42
  }
42
43
 
43
44
  setParams(options) {
44
45
  let params = [
45
- options.credential ? 'hmac_secret.py' : 'fido2_credential.py',
46
- '-n', options.authenticator,
47
- '-i', options.id
48
- ]
46
+ options.credential ? "hmac_secret.py" : "fido2_credential.py",
47
+ "-n",
48
+ options.authenticator,
49
+ "-i",
50
+ options.id,
51
+ ];
49
52
  if (options.credential) {
50
- params.push('-c', options.credential)
53
+ params.push("-c", options.credential);
51
54
  }
52
55
  if (options.salt) {
53
- params.push('-s', options.salt)
56
+ params.push("-s", options.salt);
54
57
  }
55
- return params
58
+ return params;
56
59
  }
57
60
 
58
61
  async checkIfReady() {
59
- let result = await execAsync('which', __dirname, ['python'])
60
- if (result.code !== 0 || typeof result.message === 'undefined') {
61
- throw new Error('The Fido2 module requires Python. Please install it on your computer.')
62
+ let result = await execAsync("which", __dirname, ["python"]);
63
+ if (result.code !== 0 || typeof result.message === "undefined") {
64
+ throw new Error(
65
+ "The Fido2 module requires Python. Please install it on your computer."
66
+ );
62
67
  }
63
- result = await execAsync('python', this.scriptsPath, ['is_fido2_ready.py'])
64
- if (result.message !== 'Ready') {
65
- throw new Error('Python-fido2 is required. Install it with "pip install fido2"')
68
+ result = await execAsync("python", this.scriptsPath, ["is_fido2_ready.py"]);
69
+ if (result.message !== "Ready") {
70
+ throw new Error(
71
+ 'Python-fido2 is required. Install it with "pip install fido2"'
72
+ );
66
73
  }
67
74
  }
68
75
 
69
76
  async setCredential(options) {
70
- return await execAsync('python', this.scriptsPath, this.setParams(options))
77
+ return await execAsync("python", this.scriptsPath, this.setParams(options));
71
78
  }
72
79
 
73
80
  async getSecret(options) {
74
- return await execAsync('python', this.scriptsPath, this.setParams(options))
81
+ return await execAsync("python", this.scriptsPath, this.setParams(options));
75
82
  }
76
83
 
77
84
  async verifySecret(authenticator) {
78
- await this.updateConf()
79
- let key = this.keys[authenticator]
85
+ await this.updateConf();
86
+ let key = this.keys[authenticator];
80
87
  let fido2Options = {
81
88
  id: key.id,
82
89
  authenticator,
83
90
  salt: key.salt,
84
- credential: key.credential
85
- }
86
- let result = await this.getSecret(fido2Options)
87
- this.checkErrorCode(result, 1)
91
+ credential: key.credential,
92
+ };
93
+ let result = await this.getSecret(fido2Options);
94
+ this.checkErrorCode(result, 1);
88
95
  if (Crypto.b58Hash(result.message) === key.hash) {
89
- return result.message
96
+ return result.message;
90
97
  } else {
91
- throw new Error(`You used a different key for ${authenticator}`)
98
+ throw new Error(`You used a different key for ${authenticator}`);
92
99
  }
93
100
  }
94
101
 
95
102
  checkErrorCode(result, num) {
96
103
  if (result.code !== 0) {
97
- let err = 'No Authenticator with the HmacSecret extension found!'
104
+ let err = "No Authenticator with the HmacSecret extension found!";
98
105
  if (result.error === err) {
99
- throw new Error(err)
106
+ throw new Error(err);
100
107
  } else {
101
- throw new Error(num === 1 ? 'Fido2 authenticator device not found' : 'Something went wrong')
108
+ throw new Error(
109
+ num === 1
110
+ ? "Fido2 authenticator device not found"
111
+ : "Something went wrong"
112
+ );
102
113
  }
103
114
  }
104
115
  }
105
-
106
116
  }
107
117
 
108
- module.exports = Fido2Client
118
+ module.exports = Fido2Client;
@@ -1,191 +1,204 @@
1
- const chalk = require('chalk')
2
- const {getCols} = require('@secrez/utils')
3
- const Logger = require('./Logger')
4
-
1
+ const chalk = require("chalk");
2
+ const { getCols } = require("@secrez/utils");
3
+ const Logger = require("./Logger");
5
4
 
6
5
  class HelpProto {
7
-
8
6
  constructor(options = {}) {
9
- this.options = options
7
+ this.options = options;
10
8
  }
11
9
 
12
10
  help() {
13
11
  if (!this.options.helpDescription) {
14
- this.options.helpDescription = ['Available commands:']
15
- let maxSize = 0
16
- let commands = Object.keys(this.options.cliConfig[this.options.completionObj || 'completion'].help)
12
+ this.options.helpDescription = ["Available commands:"];
13
+ let maxSize = 0;
14
+ let commands = Object.keys(
15
+ this.options.cliConfig[this.options.completionObj || "completion"].help
16
+ );
17
17
  for (let command of commands) {
18
- maxSize = Math.max(maxSize, command.length)
18
+ maxSize = Math.max(maxSize, command.length);
19
19
  }
20
- let done = false
20
+ let done = false;
21
21
  for (let command of commands) {
22
- if (!done && command > 'help') {
23
- this.options.helpDescription.push(`help${' '.repeat(1 + maxSize - 'help'.length)} This help.`)
24
- done = true
22
+ if (!done && command > "help") {
23
+ this.options.helpDescription.push(
24
+ `help${" ".repeat(1 + maxSize - "help".length)} This help.`
25
+ );
26
+ done = true;
25
27
  }
26
- let help = this.options.prompt.commands[command].help()
27
- this.options.helpDescription.push(`${command}${' '.repeat(1 + maxSize - command.length)} ${help.description[0]}`)
28
+ let help = this.options.prompt.commands[command].help();
29
+ this.options.helpDescription.push(
30
+ `${command}${" ".repeat(1 + maxSize - command.length)} ${
31
+ help.description[0]
32
+ }`
33
+ );
28
34
  }
29
- this.options.helpDescription.push('\nTo get help about single commands, specify the command, or use the -h option.')
35
+ this.options.helpDescription.push(
36
+ "\nTo get help about single commands, specify the command, or use the -h option."
37
+ );
30
38
  }
31
39
  return {
32
40
  description: this.options.helpDescription,
33
- examples: [
34
- 'help touch',
35
- 'import -h'
36
- ],
37
- completion: this.options.completion
38
- }
41
+ examples: ["help touch", "import -h"],
42
+ completion: this.options.completion,
43
+ };
39
44
  }
40
45
 
41
46
  format(data, command) {
42
- let spacer = ' '
47
+ let spacer = " ";
43
48
  if (!Array.isArray(data.description)) {
44
- data.description = [data.description]
49
+ data.description = [data.description];
45
50
  }
46
- console.info()
47
- Logger.reset(data.description[0])
51
+ console.info();
52
+ Logger.reset(data.description[0]);
48
53
  if (data.description[1]) {
49
- data.description.slice(1).map(e => Logger.reset(` ${e}`))
54
+ data.description.slice(1).map((e) => Logger.reset(` ${e}`));
50
55
  }
51
56
  if (command) {
52
- let optionDefinitions = this.options.prompt.commands[command].optionDefinitions
53
- let commandNames = optionDefinitions.map(e => e.name)
57
+ let optionDefinitions =
58
+ this.options.prompt.commands[command].optionDefinitions;
59
+ let commandNames = optionDefinitions.map((e) => e.name);
54
60
  if (commandNames.length) {
55
- console.info()
56
- Logger.reset('Available options:')
57
- let max = 0
61
+ console.info();
62
+ Logger.reset("Available options:");
63
+ let max = 0;
58
64
  for (let c of commandNames) {
59
- max = Math.max(max, c.length)
65
+ max = Math.max(max, c.length);
60
66
  }
61
67
  for (let c of optionDefinitions) {
62
- let type = c.type === Boolean ? 'Boolean' : c.type === Number ? 'Number' : 'String'
63
- let space = c.multiple ? '[] ' : ' '
68
+ let type =
69
+ c.type === Boolean
70
+ ? "Boolean"
71
+ : c.type === Number
72
+ ? "Number"
73
+ : "String";
74
+ let space = c.multiple ? "[] " : " ";
64
75
  Logger.log(
65
- 'reset',
66
- spacer +
67
- (c.alias ? '-' + c.alias + ', ' : '')
68
- + '--' + c.name + ' '.repeat(max - c.name.length + 3) +
69
- (c.alias ? '' : ' '),
70
- 'grey',
71
- type + space + (type !== 'Boolean' ? ' ' : '') + (
72
- c.defaultOption
73
- ? '(default)'
74
- : ' '
75
- ),
76
- 'grey',
77
- c.hint ? ' (' + c.hint + ')' : ''
78
- )
76
+ "reset",
77
+ spacer +
78
+ (c.alias ? "-" + c.alias + ", " : "") +
79
+ "--" +
80
+ c.name +
81
+ " ".repeat(max - c.name.length + 3) +
82
+ (c.alias ? "" : " "),
83
+ "grey",
84
+ type +
85
+ space +
86
+ (type !== "Boolean" ? " " : "") +
87
+ (c.defaultOption ? "(default)" : " "),
88
+ "grey",
89
+ c.hint ? " (" + c.hint + ")" : ""
90
+ );
79
91
  }
80
92
  }
81
93
  }
82
94
  if (data.examples.length) {
83
- Logger.reset('\nExamples:')
84
- let max = 0
85
- const cols = getCols()
95
+ Logger.reset("\nExamples:");
96
+ let max = 0;
97
+ const cols = getCols();
86
98
 
87
- let MAX = parseInt(cols * 2 / 6)
99
+ let MAX = parseInt((cols * 2) / 6);
88
100
  for (let e of data.examples) {
89
101
  if (Array.isArray(e)) {
90
- e = e[0]
102
+ e = e[0];
91
103
  }
92
- max = Math.max(max, e.length)
104
+ max = Math.max(max, e.length);
93
105
  if (max > MAX) {
94
- max = MAX
95
- break
106
+ max = MAX;
107
+ break;
96
108
  }
97
109
  }
98
110
 
99
111
  const formatExample = (example, ...hint) => {
100
- hint = hint.length ? `(${hint.join(' ')})` : undefined
101
- let str = []
102
- let i = 0
103
- let tot = (2 * spacer.length) + max
104
- let x = 0
105
- let j = -1
106
- let elem
107
- for (; ;) {
108
- let m = max - x
112
+ hint = hint.length ? `(${hint.join(" ")})` : undefined;
113
+ let str = [];
114
+ let i = 0;
115
+ let tot = 2 * spacer.length + max;
116
+ let x = 0;
117
+ let j = -1;
118
+ let elem;
119
+ for (;;) {
120
+ let m = max - x;
109
121
  if (example.length <= m) {
110
- elem = spacer + ' '.repeat(x) + example
111
- str.push(elem + ' '.repeat(tot > elem.length ? tot - elem.length : 3))
112
- break
122
+ elem = spacer + " ".repeat(x) + example;
123
+ str.push(
124
+ elem + " ".repeat(tot > elem.length ? tot - elem.length : 3)
125
+ );
126
+ break;
113
127
  } else {
114
- j = -1
115
- let partial = example.substring(0, m)
116
- let li = partial.lastIndexOf(' ')
128
+ j = -1;
129
+ let partial = example.substring(0, m);
130
+ let li = partial.lastIndexOf(" ");
117
131
  if (li === -1) {
118
- j = i
119
- li = example.lastIndexOf(' ')
132
+ j = i;
133
+ li = example.lastIndexOf(" ");
120
134
  if (li === -1) {
121
- elem = spacer + ' '.repeat(x) + example
122
- str.push(elem)
123
- break
135
+ elem = spacer + " ".repeat(x) + example;
136
+ str.push(elem);
137
+ break;
124
138
  }
125
139
  }
126
- let good = example.substring(0, li)
127
- elem = spacer + ' '.repeat(x) + good
128
- str.push(elem + ' '.repeat(tot > elem.length ? tot - elem.length : 3))
129
- example = example.substring(li + 1)
130
- i++
140
+ let good = example.substring(0, li);
141
+ elem = spacer + " ".repeat(x) + good;
142
+ str.push(
143
+ elem + " ".repeat(tot > elem.length ? tot - elem.length : 3)
144
+ );
145
+ example = example.substring(li + 1);
146
+ i++;
131
147
  // console.log(i, example)
132
148
  }
133
- x = 2
149
+ x = 2;
134
150
  }
135
- let len = str[0].length
151
+ let len = str[0].length;
136
152
  if (hint && i === j) {
137
- i++
138
- str[i] = ' '.repeat(len)
153
+ i++;
154
+ str[i] = " ".repeat(len);
139
155
  }
140
- let xam = cols - len
141
- x = 0
156
+ let xam = cols - len;
157
+ x = 0;
142
158
  if (hint) {
143
- for (; ;) {
159
+ for (;;) {
144
160
  if (!str[i]) {
145
- str[i] = ' '.repeat(len)
161
+ str[i] = " ".repeat(len);
146
162
  }
147
- let m = xam - x
163
+ let m = xam - x;
148
164
  if (hint.length <= m) {
149
- str[i] += ' '.repeat(x) + chalk.grey(hint)
150
- break
165
+ str[i] += " ".repeat(x) + chalk.grey(hint);
166
+ break;
151
167
  }
152
- let partial = hint.substring(0, m)
153
- let li = partial.lastIndexOf(' ')
168
+ let partial = hint.substring(0, m);
169
+ let li = partial.lastIndexOf(" ");
154
170
  if (li === -1) {
155
- j = i
156
- li = hint.lastIndexOf(' ')
171
+ j = i;
172
+ li = hint.lastIndexOf(" ");
157
173
  if (li === -1) {
158
- elem = ' '.repeat(x) + hint
159
- str[i] += chalk.grey(elem)
160
- break
174
+ elem = " ".repeat(x) + hint;
175
+ str[i] += chalk.grey(elem);
176
+ break;
161
177
  }
162
178
  }
163
179
 
164
- let good = hint.substring(0, li)
165
- str[i] += ' '.repeat(x) + chalk.grey(good)
166
- hint = hint.substring(li + 1)
167
- i++
168
- x = 2
180
+ let good = hint.substring(0, li);
181
+ str[i] += " ".repeat(x) + chalk.grey(good);
182
+ hint = hint.substring(li + 1);
183
+ i++;
184
+ x = 2;
169
185
  }
170
186
  }
171
- console.info(str.join('\n'))
172
- }
187
+ console.info(str.join("\n"));
188
+ };
173
189
 
174
190
  for (let e of data.examples) {
175
- if (typeof e === 'string') {
176
- e = [e]
191
+ if (typeof e === "string") {
192
+ e = [e];
177
193
  }
178
194
  if (!Array.isArray(e)) {
179
- e = [e]
195
+ e = [e];
180
196
  }
181
- formatExample(...e)
197
+ formatExample(...e);
182
198
  }
183
199
  }
184
- console.info()
200
+ console.info();
185
201
  }
186
-
187
202
  }
188
203
 
189
- module.exports = HelpProto
190
-
191
-
204
+ module.exports = HelpProto;
@@ -1,113 +1,111 @@
1
- const chalk = require('chalk')
2
- const fs = require('fs-extra')
3
- const path = require('path')
1
+ const chalk = require("chalk");
2
+ const fs = require("fs-extra");
3
+ const path = require("path");
4
4
 
5
- let jsonIndent = 0
5
+ let jsonIndent = 0;
6
6
 
7
- chalk.blu = str => {
8
- return chalk.rgb(40, 160, 210).dim(str)
9
- }
7
+ chalk.blu = (str) => {
8
+ return chalk.rgb(40, 160, 210).dim(str);
9
+ };
10
10
 
11
- chalk.agua = str => {
12
- return chalk.rgb(40, 210, 160).dim(str)
13
- }
11
+ chalk.agua = (str) => {
12
+ return chalk.rgb(40, 210, 160).dim(str);
13
+ };
14
14
 
15
- chalk.pink = str => {
16
- return chalk.rgb(210, 40, 40).dim(str)
17
- }
15
+ chalk.pink = (str) => {
16
+ return chalk.rgb(210, 40, 40).dim(str);
17
+ };
18
18
 
19
19
  class Logger {
20
-
21
20
  static red(str) {
22
- Logger.log('red', str)
21
+ Logger.log("red", str);
23
22
  }
24
23
 
25
24
  static redWithSuggestion(str) {
26
- Logger.log('red', `${str}\n>>`, 'grey', 'Press TAB for suggestions.')
25
+ Logger.log("red", `${str}\n>>`, "grey", "Press TAB for suggestions.");
27
26
  }
28
27
 
29
28
  static yellow(str) {
30
- Logger.log('yellow', str)
29
+ Logger.log("yellow", str);
31
30
  }
32
31
 
33
32
  static grey(str) {
34
- Logger.log('grey', str)
33
+ Logger.log("grey", str);
35
34
  }
36
35
 
37
36
  static green(str) {
38
- Logger.log('green', str)
37
+ Logger.log("green", str);
39
38
  }
40
39
 
41
40
  static agua(str) {
42
- Logger.log('agua', str)
41
+ Logger.log("agua", str);
43
42
  }
44
43
 
45
44
  static pink(str) {
46
- Logger.log('pink', str)
45
+ Logger.log("pink", str);
47
46
  }
48
47
 
49
48
  static blue(str) {
50
- Logger.log('blue', str)
49
+ Logger.log("blue", str);
51
50
  }
52
51
 
53
52
  static cyan(str) {
54
- Logger.log('cyan', str)
53
+ Logger.log("cyan", str);
55
54
  }
56
55
 
57
56
  static dim(str) {
58
- Logger.log('dim', str)
57
+ Logger.log("dim", str);
59
58
  }
60
59
 
61
60
  static reset(str) {
62
- Logger.log('reset', str)
61
+ Logger.log("reset", str);
63
62
  }
64
63
 
65
64
  static bold(str) {
66
- Logger.log('bold', str)
65
+ Logger.log("bold", str);
67
66
  }
68
67
 
69
68
  static blu(str) {
70
- Logger.log('blu', str)
69
+ Logger.log("blu", str);
71
70
  }
72
71
 
73
72
  static format(data) {
74
- if (typeof data === 'object') {
75
- return JSON.stringify(data, null, jsonIndent)
73
+ if (typeof data === "object") {
74
+ return JSON.stringify(data, null, jsonIndent);
76
75
  } else {
77
- return data
76
+ return data;
78
77
  }
79
78
  }
80
79
 
81
80
  static log(...data) {
82
- let message = ''
83
- let prev
81
+ let message = "";
82
+ let prev;
84
83
  if (data.length === 1) {
85
- data = ['dim', data[0]]
84
+ data = ["dim", data[0]];
86
85
  }
87
86
  for (let i = 0; i < data.length; i += 2) {
88
- if (typeof data[i + 1] === 'undefined') {
89
- break
87
+ if (typeof data[i + 1] === "undefined") {
88
+ break;
90
89
  }
91
- let sep = prev ? ' ' : ''
92
- data[i + 1] = Logger.format(data[i + 1])
93
- if (prev && ['bold', 'italic', 'dim', 'underline'].includes(data[i])) {
94
- message += sep + chalk[prev][data[i] || 'reset'](data[i + 1])
90
+ let sep = prev ? " " : "";
91
+ data[i + 1] = Logger.format(data[i + 1]);
92
+ if (prev && ["bold", "italic", "dim", "underline"].includes(data[i])) {
93
+ message += sep + chalk[prev][data[i] || "reset"](data[i + 1]);
95
94
  } else {
96
- message += sep + chalk[data[i] || 'reset'](data[i + 1])
95
+ message += sep + chalk[data[i] || "reset"](data[i + 1]);
97
96
  }
98
- prev = data[i]
97
+ prev = data[i];
99
98
  }
100
- console.info(message)
99
+ console.info(message);
101
100
  }
102
-
103
101
  }
104
102
 
105
- module.exports = Logger
103
+ module.exports = Logger;
106
104
  module.exports.debug = (...data) => {
107
- fs.appendFileSync(path.resolve(__dirname, '../../tmp/tmp.log'), '\n' + data.join(' '))
108
- }
109
-
110
- module.exports.chalk = chalk
111
-
112
-
105
+ fs.appendFileSync(
106
+ path.resolve(__dirname, "../../tmp/tmp.log"),
107
+ "\n" + data.join(" ")
108
+ );
109
+ };
113
110
 
111
+ module.exports.chalk = chalk;
package/.eslintignore DELETED
File without changes