meocli 0.1.4 → 0.1.6
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/README.md +70 -23
- package/dist/commands/env/apifox.d.ts +13 -0
- package/dist/commands/env/apifox.js +49 -0
- package/dist/commands/env/index.d.ts +13 -0
- package/dist/commands/env/index.js +47 -0
- package/dist/commands/hello/index.d.ts +1 -1
- package/dist/commands/hello/index.js +17 -8
- package/dist/commands/prettier/index.js +1 -0
- package/dist/consts/prettierrc.js +84 -79
- package/dist/lib/effective.d.ts +1 -0
- package/dist/lib/effective.js +2 -0
- package/dist/tests/d3-test.d.ts +1 -0
- package/dist/tests/d3-test.js +15 -0
- package/dist/tests/dotenv-test.d.ts +1 -0
- package/dist/tests/dotenv-test.js +11 -0
- package/dist/tests/lodash-test.js +17 -1
- package/dist/tests/num-test.d.ts +1 -0
- package/dist/tests/num-test.js +8 -0
- package/dist/tests/slice-test.d.ts +1 -0
- package/dist/tests/slice-test.js +22 -0
- package/dist/tests/time-test.d.ts +1 -0
- package/dist/tests/time-test.js +2 -0
- package/dist/tests/to-qiniu.d.ts +4 -0
- package/dist/tests/to-qiniu.js +123 -0
- package/dist/tests/trading-signals-test.d.ts +1 -0
- package/dist/tests/trading-signals-test.js +65 -0
- package/oclif.manifest.json +83 -3
- package/package.json +12 -6
package/README.md
CHANGED
|
@@ -23,9 +23,8 @@ Node CLI generated with oclif, Integrate Prettier
|
|
|
23
23
|
$ pnpm ncu # 检查更新
|
|
24
24
|
$ pnpm ncu -u # 升级更新
|
|
25
25
|
<!-- demo -->
|
|
26
|
-
$ pnpm run dev hello
|
|
27
|
-
$ pnpm run prod hello
|
|
28
|
-
$ pnpm run dev hello foo -f bar
|
|
26
|
+
$ pnpm run dev hello foo
|
|
27
|
+
$ pnpm run prod hello foo -f bar
|
|
29
28
|
<!-- prettier -->
|
|
30
29
|
$ pnpm run dev prettier ./tmp/test.svg --verbose
|
|
31
30
|
$ pnpm run dev prettier ./tmp/test.json --config=auto --ignore=auto
|
|
@@ -117,7 +116,7 @@ $ npm install -g meocli
|
|
|
117
116
|
$ me COMMAND
|
|
118
117
|
running command...
|
|
119
118
|
$ me (--version)
|
|
120
|
-
meocli/0.1.
|
|
119
|
+
meocli/0.1.6 win32-x64 node-v24.13.1
|
|
121
120
|
$ me --help [COMMAND]
|
|
122
121
|
USAGE
|
|
123
122
|
$ me COMMAND
|
|
@@ -128,6 +127,8 @@ USAGE
|
|
|
128
127
|
# Commands
|
|
129
128
|
|
|
130
129
|
<!-- commands -->
|
|
130
|
+
* [`me env [FILEPATH]`](#me-env-filepath)
|
|
131
|
+
* [`me env apifox [FILEPATH]`](#me-env-apifox-filepath)
|
|
131
132
|
* [`me hello PERSON`](#me-hello-person)
|
|
132
133
|
* [`me hello world`](#me-hello-world)
|
|
133
134
|
* [`me help [COMMAND]`](#me-help-command)
|
|
@@ -144,29 +145,75 @@ USAGE
|
|
|
144
145
|
* [`me prettier FILEPATH`](#me-prettier-filepath)
|
|
145
146
|
* [`me prettier reset`](#me-prettier-reset)
|
|
146
147
|
|
|
148
|
+
## `me env [FILEPATH]`
|
|
149
|
+
|
|
150
|
+
读取.env环境变量并打印(json格式)
|
|
151
|
+
|
|
152
|
+
```
|
|
153
|
+
USAGE
|
|
154
|
+
$ me env [FILEPATH] [-v]
|
|
155
|
+
|
|
156
|
+
ARGUMENTS
|
|
157
|
+
[FILEPATH] [default: .env] .env文件路径,不传默认值为.env
|
|
158
|
+
|
|
159
|
+
FLAGS
|
|
160
|
+
-v, --verbose Show verbose output
|
|
161
|
+
|
|
162
|
+
DESCRIPTION
|
|
163
|
+
读取.env环境变量并打印(json格式)
|
|
164
|
+
|
|
165
|
+
EXAMPLES
|
|
166
|
+
me env .env
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
_See code: [src/commands/env/index.ts](https://github.com/meme2046/meocli/blob/v0.1.6/src/commands/env/index.ts)_
|
|
170
|
+
|
|
171
|
+
## `me env apifox [FILEPATH]`
|
|
172
|
+
|
|
173
|
+
读取.env环境变量,输出apifox需要的csv格式
|
|
174
|
+
|
|
175
|
+
```
|
|
176
|
+
USAGE
|
|
177
|
+
$ me env apifox [FILEPATH] [-v]
|
|
178
|
+
|
|
179
|
+
ARGUMENTS
|
|
180
|
+
[FILEPATH] [default: .env] .env文件路径,不传默认值为.env
|
|
181
|
+
|
|
182
|
+
FLAGS
|
|
183
|
+
-v, --verbose Show verbose output
|
|
184
|
+
|
|
185
|
+
DESCRIPTION
|
|
186
|
+
读取.env环境变量,输出apifox需要的csv格式
|
|
187
|
+
|
|
188
|
+
EXAMPLES
|
|
189
|
+
me env apifox .env
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
_See code: [src/commands/env/apifox.ts](https://github.com/meme2046/meocli/blob/v0.1.6/src/commands/env/apifox.ts)_
|
|
193
|
+
|
|
147
194
|
## `me hello PERSON`
|
|
148
195
|
|
|
149
196
|
Say hello
|
|
150
197
|
|
|
151
198
|
```
|
|
152
199
|
USAGE
|
|
153
|
-
$ me hello PERSON -f <value>
|
|
200
|
+
$ me hello PERSON [-f <value>]
|
|
154
201
|
|
|
155
202
|
ARGUMENTS
|
|
156
203
|
PERSON Person to say hello to
|
|
157
204
|
|
|
158
205
|
FLAGS
|
|
159
|
-
-f, --from=<value>
|
|
206
|
+
-f, --from=<value> [default: meocli] Who is saying hello
|
|
160
207
|
|
|
161
208
|
DESCRIPTION
|
|
162
209
|
Say hello
|
|
163
210
|
|
|
164
211
|
EXAMPLES
|
|
165
|
-
|
|
166
|
-
|
|
212
|
+
me hello friend --from oclif
|
|
213
|
+
hello friend --from oclif (./src/commands/hello/index.ts)
|
|
167
214
|
```
|
|
168
215
|
|
|
169
|
-
_See code: [src/commands/hello/index.ts](https://github.com/meme2046/meocli/blob/v0.1.
|
|
216
|
+
_See code: [src/commands/hello/index.ts](https://github.com/meme2046/meocli/blob/v0.1.6/src/commands/hello/index.ts)_
|
|
170
217
|
|
|
171
218
|
## `me hello world`
|
|
172
219
|
|
|
@@ -184,7 +231,7 @@ EXAMPLES
|
|
|
184
231
|
hello world! (./src/commands/hello/world.ts)
|
|
185
232
|
```
|
|
186
233
|
|
|
187
|
-
_See code: [src/commands/hello/world.ts](https://github.com/meme2046/meocli/blob/v0.1.
|
|
234
|
+
_See code: [src/commands/hello/world.ts](https://github.com/meme2046/meocli/blob/v0.1.6/src/commands/hello/world.ts)_
|
|
188
235
|
|
|
189
236
|
## `me help [COMMAND]`
|
|
190
237
|
|
|
@@ -204,7 +251,7 @@ DESCRIPTION
|
|
|
204
251
|
Display help for me.
|
|
205
252
|
```
|
|
206
253
|
|
|
207
|
-
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.2.
|
|
254
|
+
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.2.37/src/commands/help.ts)_
|
|
208
255
|
|
|
209
256
|
## `me plugins`
|
|
210
257
|
|
|
@@ -227,7 +274,7 @@ EXAMPLES
|
|
|
227
274
|
$ me plugins
|
|
228
275
|
```
|
|
229
276
|
|
|
230
|
-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.
|
|
277
|
+
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.55/src/commands/plugins/index.ts)_
|
|
231
278
|
|
|
232
279
|
## `me plugins add PLUGIN`
|
|
233
280
|
|
|
@@ -301,7 +348,7 @@ EXAMPLES
|
|
|
301
348
|
$ me plugins inspect myplugin
|
|
302
349
|
```
|
|
303
350
|
|
|
304
|
-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.
|
|
351
|
+
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.55/src/commands/plugins/inspect.ts)_
|
|
305
352
|
|
|
306
353
|
## `me plugins install PLUGIN`
|
|
307
354
|
|
|
@@ -350,7 +397,7 @@ EXAMPLES
|
|
|
350
397
|
$ me plugins install someuser/someplugin
|
|
351
398
|
```
|
|
352
399
|
|
|
353
|
-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.
|
|
400
|
+
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.55/src/commands/plugins/install.ts)_
|
|
354
401
|
|
|
355
402
|
## `me plugins link PATH`
|
|
356
403
|
|
|
@@ -381,7 +428,7 @@ EXAMPLES
|
|
|
381
428
|
$ me plugins link myplugin
|
|
382
429
|
```
|
|
383
430
|
|
|
384
|
-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.
|
|
431
|
+
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.55/src/commands/plugins/link.ts)_
|
|
385
432
|
|
|
386
433
|
## `me plugins remove [PLUGIN]`
|
|
387
434
|
|
|
@@ -422,7 +469,7 @@ FLAGS
|
|
|
422
469
|
--reinstall Reinstall all plugins after uninstalling.
|
|
423
470
|
```
|
|
424
471
|
|
|
425
|
-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.
|
|
472
|
+
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.55/src/commands/plugins/reset.ts)_
|
|
426
473
|
|
|
427
474
|
## `me plugins uninstall [PLUGIN]`
|
|
428
475
|
|
|
@@ -450,7 +497,7 @@ EXAMPLES
|
|
|
450
497
|
$ me plugins uninstall myplugin
|
|
451
498
|
```
|
|
452
499
|
|
|
453
|
-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.
|
|
500
|
+
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.55/src/commands/plugins/uninstall.ts)_
|
|
454
501
|
|
|
455
502
|
## `me plugins unlink [PLUGIN]`
|
|
456
503
|
|
|
@@ -494,7 +541,7 @@ DESCRIPTION
|
|
|
494
541
|
Update installed plugins.
|
|
495
542
|
```
|
|
496
543
|
|
|
497
|
-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.
|
|
544
|
+
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.55/src/commands/plugins/update.ts)_
|
|
498
545
|
|
|
499
546
|
## `me prettier FILEPATH`
|
|
500
547
|
|
|
@@ -502,7 +549,7 @@ Use Prettier to format file,集成:『@prettier/plugin-xml、prettier-plugin-tom
|
|
|
502
549
|
|
|
503
550
|
```
|
|
504
551
|
USAGE
|
|
505
|
-
$ me prettier FILEPATH [-c <value>] [
|
|
552
|
+
$ me prettier FILEPATH [-c <value>] [-i <value>] [-v]
|
|
506
553
|
|
|
507
554
|
ARGUMENTS
|
|
508
555
|
FILEPATH file path that need to be formatted by Prettier
|
|
@@ -510,9 +557,9 @@ ARGUMENTS
|
|
|
510
557
|
FLAGS
|
|
511
558
|
-c, --config=<value> [default: built_in] built_in:使用内置规则(默认值), 传入路径则是使用自定义配置,
|
|
512
559
|
auto:自动检测config file
|
|
513
|
-
-
|
|
514
|
-
--ignore=<value> [default: built_in] built_in:使用内置规则(默认值), 传入路径则是使用自定义规则,
|
|
560
|
+
-i, --ignore=<value> [default: built_in] built_in:使用内置规则(默认值), 传入路径则是使用自定义规则,
|
|
515
561
|
auto:自动检测ignore file
|
|
562
|
+
-v, --verbose Show verbose output
|
|
516
563
|
|
|
517
564
|
DESCRIPTION
|
|
518
565
|
Use Prettier to format
|
|
@@ -524,7 +571,7 @@ EXAMPLES
|
|
|
524
571
|
$ me prettier ./src/file.ts --config ./.prettierrc.yaml
|
|
525
572
|
```
|
|
526
573
|
|
|
527
|
-
_See code: [src/commands/prettier/index.ts](https://github.com/meme2046/meocli/blob/v0.1.
|
|
574
|
+
_See code: [src/commands/prettier/index.ts](https://github.com/meme2046/meocli/blob/v0.1.6/src/commands/prettier/index.ts)_
|
|
528
575
|
|
|
529
576
|
## `me prettier reset`
|
|
530
577
|
|
|
@@ -544,5 +591,5 @@ EXAMPLES
|
|
|
544
591
|
$ me prettier reset --verbose
|
|
545
592
|
```
|
|
546
593
|
|
|
547
|
-
_See code: [src/commands/prettier/reset.ts](https://github.com/meme2046/meocli/blob/v0.1.
|
|
594
|
+
_See code: [src/commands/prettier/reset.ts](https://github.com/meme2046/meocli/blob/v0.1.6/src/commands/prettier/reset.ts)_
|
|
548
595
|
<!-- commandsstop -->
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Command } from "@oclif/core";
|
|
2
|
+
import dotenv from "dotenv";
|
|
3
|
+
export default class Apifox extends Command {
|
|
4
|
+
static args: {
|
|
5
|
+
filePath: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
6
|
+
};
|
|
7
|
+
static description: string;
|
|
8
|
+
static examples: string[];
|
|
9
|
+
static flags: {
|
|
10
|
+
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
11
|
+
};
|
|
12
|
+
run(): Promise<dotenv.DotenvParseOutput | undefined>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Args, Command, Flags } from "@oclif/core";
|
|
2
|
+
import dotenv from "dotenv";
|
|
3
|
+
import { existsSync } from "node:fs";
|
|
4
|
+
import { require } from "../../lib/commonjs.js";
|
|
5
|
+
export default class Apifox extends Command {
|
|
6
|
+
static args = {
|
|
7
|
+
filePath: Args.string({
|
|
8
|
+
default: ".env",
|
|
9
|
+
description: ".env文件路径,不传默认值为.env",
|
|
10
|
+
required: false,
|
|
11
|
+
}),
|
|
12
|
+
};
|
|
13
|
+
static description = "读取.env环境变量,输出apifox需要的csv格式";
|
|
14
|
+
static examples = [
|
|
15
|
+
`
|
|
16
|
+
<%= config.bin %> <%= command.id %> .env
|
|
17
|
+
`,
|
|
18
|
+
];
|
|
19
|
+
static flags = {
|
|
20
|
+
verbose: Flags.boolean({
|
|
21
|
+
char: "v",
|
|
22
|
+
default: false,
|
|
23
|
+
description: "Show verbose output",
|
|
24
|
+
}),
|
|
25
|
+
};
|
|
26
|
+
async run() {
|
|
27
|
+
const { args, flags } = await this.parse(Apifox);
|
|
28
|
+
const { filePath } = args;
|
|
29
|
+
const { verbose } = flags;
|
|
30
|
+
if (!existsSync(filePath)) {
|
|
31
|
+
this.log(`✘ 『${filePath}』 not found!`);
|
|
32
|
+
return undefined;
|
|
33
|
+
}
|
|
34
|
+
if (verbose) {
|
|
35
|
+
process.env.DEBUG = "oclif:me:env:apifox";
|
|
36
|
+
require("debug").enable(process.env.DEBUG);
|
|
37
|
+
}
|
|
38
|
+
const envConfig = dotenv.config({
|
|
39
|
+
path: filePath,
|
|
40
|
+
}).parsed;
|
|
41
|
+
if (envConfig) {
|
|
42
|
+
this.debug(`✔ 『${filePath}』`);
|
|
43
|
+
for (const [key, value] of Object.entries(envConfig || {})) {
|
|
44
|
+
console.log(`${key},default,,false,${value},`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return envConfig;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Command } from "@oclif/core";
|
|
2
|
+
import dotenv from "dotenv";
|
|
3
|
+
export default class Env extends Command {
|
|
4
|
+
static args: {
|
|
5
|
+
filePath: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
6
|
+
};
|
|
7
|
+
static description: string;
|
|
8
|
+
static examples: string[];
|
|
9
|
+
static flags: {
|
|
10
|
+
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
11
|
+
};
|
|
12
|
+
run(): Promise<dotenv.DotenvParseOutput | undefined>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Args, Command, Flags } from "@oclif/core";
|
|
2
|
+
import dotenv from "dotenv";
|
|
3
|
+
import { existsSync } from "node:fs";
|
|
4
|
+
import { require } from "../../lib/commonjs.js";
|
|
5
|
+
export default class Env extends Command {
|
|
6
|
+
static args = {
|
|
7
|
+
filePath: Args.string({
|
|
8
|
+
default: ".env",
|
|
9
|
+
description: ".env文件路径,不传默认值为.env",
|
|
10
|
+
required: false,
|
|
11
|
+
}),
|
|
12
|
+
};
|
|
13
|
+
static description = "读取.env环境变量并打印(json格式)";
|
|
14
|
+
static examples = [
|
|
15
|
+
`
|
|
16
|
+
<%= config.bin %> <%= command.id %> .env
|
|
17
|
+
`,
|
|
18
|
+
];
|
|
19
|
+
static flags = {
|
|
20
|
+
verbose: Flags.boolean({
|
|
21
|
+
char: "v",
|
|
22
|
+
default: false,
|
|
23
|
+
description: "Show verbose output",
|
|
24
|
+
}),
|
|
25
|
+
};
|
|
26
|
+
async run() {
|
|
27
|
+
const { args, flags } = await this.parse(Env);
|
|
28
|
+
const { filePath } = args;
|
|
29
|
+
const { verbose } = flags;
|
|
30
|
+
if (!existsSync(filePath)) {
|
|
31
|
+
this.log(`✘ 『${filePath}』 not found!`);
|
|
32
|
+
return undefined;
|
|
33
|
+
}
|
|
34
|
+
if (verbose) {
|
|
35
|
+
process.env.DEBUG = "oclif:me:env";
|
|
36
|
+
require("debug").enable(process.env.DEBUG);
|
|
37
|
+
}
|
|
38
|
+
const envConfig = dotenv.config({
|
|
39
|
+
path: filePath,
|
|
40
|
+
}).parsed;
|
|
41
|
+
if (envConfig) {
|
|
42
|
+
this.debug(`✔ 『${filePath}』\n`);
|
|
43
|
+
this.log(JSON.stringify(envConfig, null, 2));
|
|
44
|
+
}
|
|
45
|
+
return envConfig;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -1,19 +1,28 @@
|
|
|
1
|
-
import { Args, Command, Flags } from
|
|
1
|
+
import { Args, Command, Flags } from "@oclif/core";
|
|
2
2
|
export default class Hello extends Command {
|
|
3
3
|
static args = {
|
|
4
|
-
person: Args.string({
|
|
4
|
+
person: Args.string({
|
|
5
|
+
description: "Person to say hello to",
|
|
6
|
+
required: true,
|
|
7
|
+
}),
|
|
5
8
|
};
|
|
6
|
-
static description =
|
|
9
|
+
static description = "Say hello";
|
|
7
10
|
static examples = [
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
`
|
|
12
|
+
<%= config.bin %> <%= command.id %> friend --from oclif
|
|
13
|
+
hello friend --from oclif (./src/commands/hello/index.ts)
|
|
14
|
+
`,
|
|
11
15
|
];
|
|
12
16
|
static flags = {
|
|
13
|
-
from: Flags.string({
|
|
17
|
+
from: Flags.string({
|
|
18
|
+
char: "f",
|
|
19
|
+
default: "meocli",
|
|
20
|
+
description: "Who is saying hello",
|
|
21
|
+
required: false,
|
|
22
|
+
}),
|
|
14
23
|
};
|
|
15
24
|
async run() {
|
|
16
25
|
const { args, flags } = await this.parse(Hello);
|
|
17
|
-
this.log(
|
|
26
|
+
this.log(`✔ Hello ${args.person} from ${flags.from}! (./src/commands/hello/index.ts)`);
|
|
18
27
|
}
|
|
19
28
|
}
|
|
@@ -1,43 +1,43 @@
|
|
|
1
1
|
export const DEFAULT_ARGS = [
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
2
|
+
"--arrow-parens",
|
|
3
|
+
"always",
|
|
4
|
+
"--bracket-same-line",
|
|
5
|
+
"false",
|
|
6
|
+
"--object-wrap",
|
|
7
|
+
"preserve",
|
|
8
|
+
"--experimental-operator-position",
|
|
9
|
+
"end",
|
|
10
|
+
"--no-experimental-ternaries",
|
|
11
|
+
"--single-quote",
|
|
12
|
+
"false",
|
|
13
|
+
"--jsx-single-quote",
|
|
14
|
+
"false",
|
|
15
|
+
"--quote-props",
|
|
16
|
+
"as-needed",
|
|
17
|
+
"--trailing-comma",
|
|
18
|
+
"all",
|
|
19
|
+
"--single-attribute-per-line",
|
|
20
|
+
"false",
|
|
21
|
+
"--html-whitespace-sensitivity",
|
|
22
|
+
"css",
|
|
23
|
+
"--vue-indent-script-and-style",
|
|
24
|
+
"false",
|
|
25
|
+
"--prose-wrap",
|
|
26
|
+
"preserve",
|
|
27
|
+
"--end-of-line",
|
|
28
|
+
"lf",
|
|
29
|
+
"--insert-pragma",
|
|
30
|
+
"false",
|
|
31
|
+
"--print-width",
|
|
32
|
+
"80",
|
|
33
|
+
"--require-pragma",
|
|
34
|
+
"false",
|
|
35
|
+
"--tab-width",
|
|
36
|
+
"2",
|
|
37
|
+
"--use-tabs",
|
|
38
|
+
"false",
|
|
39
|
+
"--embedded-language-formatting",
|
|
40
|
+
"auto",
|
|
41
41
|
// plugins
|
|
42
42
|
// '--plugin',
|
|
43
43
|
// '@prettier/plugin-xml',
|
|
@@ -48,74 +48,79 @@ export const DEFAULT_ARGS = [
|
|
|
48
48
|
// '--plugin',
|
|
49
49
|
// 'prettier-plugin-nginx',
|
|
50
50
|
// xml
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
51
|
+
"--xml-whitespace-sensitivity",
|
|
52
|
+
"strict",
|
|
53
|
+
"--xml-sort-attributes-by-key",
|
|
54
|
+
"true",
|
|
55
|
+
"--xml-self-closing-space",
|
|
56
|
+
"true",
|
|
57
57
|
// toml
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
"--indent-entries",
|
|
59
|
+
"true",
|
|
60
|
+
"--reorder-keys",
|
|
61
|
+
"true",
|
|
62
62
|
// nginx
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
63
|
+
"--wrap-parameters",
|
|
64
|
+
"false",
|
|
65
|
+
"--continuation-indent",
|
|
66
|
+
"2",
|
|
67
67
|
];
|
|
68
68
|
export const DEFAULT_CONFIG = {
|
|
69
|
-
arrowParens:
|
|
70
|
-
bracketSameLine:
|
|
69
|
+
arrowParens: "always",
|
|
70
|
+
bracketSameLine: true,
|
|
71
71
|
bracketSpacing: true,
|
|
72
72
|
continuationIndent: 2, // nginx
|
|
73
|
-
embeddedLanguageFormatting:
|
|
74
|
-
endOfLine:
|
|
75
|
-
experimentalOperatorPosition:
|
|
73
|
+
embeddedLanguageFormatting: "auto",
|
|
74
|
+
endOfLine: "lf",
|
|
75
|
+
experimentalOperatorPosition: "end",
|
|
76
76
|
experimentalTernaries: false,
|
|
77
|
-
htmlWhitespaceSensitivity:
|
|
77
|
+
htmlWhitespaceSensitivity: "css",
|
|
78
78
|
indentEntries: true, // toml
|
|
79
79
|
insertPragma: false,
|
|
80
80
|
jsxSingleQuote: false,
|
|
81
|
-
objectWrap:
|
|
81
|
+
objectWrap: "preserve",
|
|
82
82
|
overrides: [
|
|
83
|
-
{ files: [
|
|
84
|
-
{ files: [
|
|
83
|
+
{ files: ["*.env"], options: { parser: "sh" } },
|
|
84
|
+
{ files: ["*.txt"], options: { parser: "markdown" } },
|
|
85
|
+
],
|
|
86
|
+
plugins: [
|
|
87
|
+
"@prettier/plugin-xml",
|
|
88
|
+
"prettier-plugin-toml",
|
|
89
|
+
"prettier-plugin-sh",
|
|
90
|
+
"prettier-plugin-nginx",
|
|
85
91
|
],
|
|
86
|
-
plugins: ['@prettier/plugin-xml', 'prettier-plugin-toml', 'prettier-plugin-sh', 'prettier-plugin-nginx'],
|
|
87
92
|
printWidth: 80,
|
|
88
|
-
proseWrap:
|
|
89
|
-
quoteProps:
|
|
93
|
+
proseWrap: "preserve",
|
|
94
|
+
quoteProps: "as-needed",
|
|
90
95
|
reorderKeys: true, // toml
|
|
91
96
|
requirePragma: false,
|
|
92
97
|
semi: true,
|
|
93
98
|
singleAttributePerLine: false,
|
|
94
99
|
singleQuote: false,
|
|
95
100
|
tabWidth: 2,
|
|
96
|
-
trailingComma:
|
|
101
|
+
trailingComma: "all",
|
|
97
102
|
useTabs: false, // useTabs 和 tabWidth 不能同时使用
|
|
98
103
|
vueIndentScriptAndStyle: false,
|
|
99
104
|
wrapParameters: false, // nginx
|
|
100
105
|
xmlSelfClosingSpace: true, // xml
|
|
101
106
|
xmlSortAttributesByKey: true, // xml
|
|
102
|
-
xmlWhitespaceSensitivity:
|
|
107
|
+
xmlWhitespaceSensitivity: "ignore", // xml
|
|
103
108
|
};
|
|
104
109
|
// 默认的 Prettier 插件列表
|
|
105
110
|
export const DEFAULT_PLUGINS = [
|
|
106
|
-
{ main:
|
|
107
|
-
{ main:
|
|
108
|
-
{ main:
|
|
109
|
-
{ main:
|
|
111
|
+
{ main: "src/plugin.js", name: "@prettier/plugin-xml" },
|
|
112
|
+
{ main: "lib/index.cjs", name: "prettier-plugin-toml" },
|
|
113
|
+
{ main: "lib/index.cjs", name: "prettier-plugin-sh" },
|
|
114
|
+
{ main: "dist/index.js", name: "prettier-plugin-nginx" },
|
|
110
115
|
];
|
|
111
116
|
// 默认的忽略模式
|
|
112
117
|
export const DEFAULT_IGNORE_PATTERNS = [
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
118
|
+
"node_modules/",
|
|
119
|
+
"dist/",
|
|
120
|
+
"build/",
|
|
121
|
+
".nyc_output/",
|
|
122
|
+
"coverage/",
|
|
123
|
+
".next/",
|
|
124
|
+
"out/",
|
|
125
|
+
"*.nu",
|
|
121
126
|
];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const effective: (src: string) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as d3Format from "d3-format";
|
|
2
|
+
import lodash from "lodash";
|
|
3
|
+
import { effective } from "../lib/effective.js";
|
|
4
|
+
const { formatPrefix } = d3Format;
|
|
5
|
+
const { replace } = lodash;
|
|
6
|
+
function formatNumberWithUnit(num, precision = 2) {
|
|
7
|
+
// 获取d3默认的前缀格式化器
|
|
8
|
+
const formatter = formatPrefix(`,.${precision}`, num);
|
|
9
|
+
return effective(replace(formatter(num), "G", "B"));
|
|
10
|
+
}
|
|
11
|
+
console.log(formatNumberWithUnit(1));
|
|
12
|
+
console.log(formatNumberWithUnit(150_123)); // 输出: 150.1k
|
|
13
|
+
console.log(formatNumberWithUnit(23_200_000)); // 输出: 23.2M
|
|
14
|
+
console.log(formatNumberWithUnit(1_600_000_000)); // 输出: 1.6B
|
|
15
|
+
console.log(formatNumberWithUnit(123_456, 2)); // 输出: 123.46k(自定义精度)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import dotenv from "dotenv";
|
|
2
|
+
const envConfig = dotenv.config({
|
|
3
|
+
path: "d:/.env",
|
|
4
|
+
}).parsed;
|
|
5
|
+
console.log(`✅MYSQL_HOST: ${envConfig?.MYSQL_HOST}`);
|
|
6
|
+
console.log(`📋 All .env variables:`, envConfig);
|
|
7
|
+
if (envConfig) {
|
|
8
|
+
for (const [key, value] of Object.entries(envConfig)) {
|
|
9
|
+
console.log(`✅${key}: ${value}`);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import lodash from "lodash";
|
|
2
|
-
const { isNaN, isNumber } = lodash;
|
|
2
|
+
const { flatMap, isNaN, isNumber, map, round, toNumber } = lodash;
|
|
3
3
|
console.log(isNumber("123"));
|
|
4
4
|
console.log(isNumber(null));
|
|
5
5
|
console.log(isNumber(1));
|
|
@@ -21,3 +21,19 @@ const pickedB2 = lodash.pick(B2, Object.keys(A2));
|
|
|
21
21
|
const filteredB2 = lodash.pickBy(pickedB2, (value) => value !== undefined && value !== "");
|
|
22
22
|
const result2 = { ...A2, ...filteredB2 };
|
|
23
23
|
console.log(result2); // 输出:{ a: '1', b: '2', c: '33' }
|
|
24
|
+
console.log(round(123, -1));
|
|
25
|
+
console.log(flatMap([1, 2, 3], (num) => [num, num * 2]));
|
|
26
|
+
console.log(Number(""));
|
|
27
|
+
if (Number("")) {
|
|
28
|
+
console.log("真");
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
console.log("假");
|
|
32
|
+
}
|
|
33
|
+
// 原始数组
|
|
34
|
+
const strArr = ["1", "2", "3"];
|
|
35
|
+
// 转换为数字数组
|
|
36
|
+
const numArr = map(strArr, Number);
|
|
37
|
+
console.log(numArr);
|
|
38
|
+
console.log(Number(""));
|
|
39
|
+
console.log(isNumber(toNumber("")));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import lodash from "lodash";
|
|
2
|
+
const { isNaN, slice } = lodash;
|
|
3
|
+
const list = [1, 2, 3, 55, 6];
|
|
4
|
+
console.log(slice(list, -2));
|
|
5
|
+
const a = [1, 2, 3, 4, 5];
|
|
6
|
+
// 访问不存在的索引 8,不会异常,返回 undefined
|
|
7
|
+
const result = a[8];
|
|
8
|
+
console.log(result); // 输出:undefined
|
|
9
|
+
console.log(typeof result); // 输出:undefined
|
|
10
|
+
console.log(isNaN(0)); // 输出:false
|
|
11
|
+
console.log([
|
|
12
|
+
"#4DAF4A",
|
|
13
|
+
"#E41A1C",
|
|
14
|
+
"#00C9C9",
|
|
15
|
+
"#7863FF",
|
|
16
|
+
"#1783FF",
|
|
17
|
+
"#F0884D",
|
|
18
|
+
"#D580FF",
|
|
19
|
+
"#57534D",
|
|
20
|
+
"#8200DB",
|
|
21
|
+
"#78716B",
|
|
22
|
+
].slice(0, 3));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
export const AVATAR_SRC = {
|
|
2
|
+
"6": "https://arweave.net/gh6dERw6YTSdb7HRYzZYA9WV1dg82J1I3I9fYzmomtU",
|
|
3
|
+
"34": "https://arweave.net/MdDHWgrX6J-6JgPR5LaFm50mvuFy8z-hLS3QXrRG_j8",
|
|
4
|
+
"38": "https://arweave.net/WLMz-0yWZhTi_inTmRL4fbyDzVKP1Qk9Tx2VDeFXl4s",
|
|
5
|
+
"46": "https://arweave.net/giw4W_wu2pXWdSfsBzjvRFcP5JmXLnleVzzOgJhgPzE",
|
|
6
|
+
"50": "https://arweave.net/OI7oKNP6TeAzCDXCRlfSrS-baom670bhozdEq3kiqUs",
|
|
7
|
+
"52": "https://arweave.net/Hy9GIxy1dfj0RbVzQCs6MnRDGPfhUtHFUY6bLZE3zb8",
|
|
8
|
+
"64": "https://arweave.net/A6Wq__dWOYTcIYmPrZyDGWHIwEtzO_oVTzkqfEnMnq8",
|
|
9
|
+
"65": "https://arweave.net/XU2GHzPO5LdvGsC9FvgJkMt0uV0tUREDYDihibPaszA",
|
|
10
|
+
"71": "https://arweave.net/M7-A45M71tdpd7p30s1zYtmxmgVZ0Vl8olkpxoRZg1c",
|
|
11
|
+
"73": "https://arweave.net/RMpV1-nhxoJxbkb7t87_Eg8wCzosomhF8hTey2R44qg",
|
|
12
|
+
"75": "https://arweave.net/pYfo28vgb1fXvaXdhtVbWeK78WD9_2zPTMoAt45eZzE",
|
|
13
|
+
"79": "https://arweave.net/YzZB_FCsmpdABmIzgbu0TkiE5PJAM1jfrZNXirkmVN4",
|
|
14
|
+
"80": "https://arweave.net/uoyT7Lb1zK5KZl7WVJ4-pkLaSoPvSjP377UqjLL16EA",
|
|
15
|
+
"81": "https://arweave.net/H1xDFDB7naLnRgeRUliVjOKrsQbWB_Uorl_QCtqjbWI",
|
|
16
|
+
"82": "https://arweave.net/BucAzz46YALpbKjHqsnlAgouDHlQxz6PnNlw2vengpU",
|
|
17
|
+
"84": "https://arweave.net/XLnzK9JO-Vi6UUGl4FAUSSe2dsHk3PFrlY8uZekir7k",
|
|
18
|
+
"94": "https://arweave.net/B71iMgEtvHptds7Qde3bQIiCC2kyP8kgUIKZE6RcnGo",
|
|
19
|
+
"95": "https://arweave.net/rOysZMiykbMV9r1CgkBd1x6hHoHTWWQxwU8Gq7PoU9A",
|
|
20
|
+
"96": "https://arweave.net/iTHsm2tFuK66u3yj8LvjvWuAL3-Z9mbYJzzOJvnQw2Y",
|
|
21
|
+
"98": "https://arweave.net/Ziy9tW38o7gGpilNkkhZiakyD9fqRwvOW2WY3IIw1do",
|
|
22
|
+
"100": "https://arweave.net/_0bEu-PTlOBW6gjEj0Irgdy_sD5QQeml8BsM4Pq9DbY",
|
|
23
|
+
bot: "https://arweave.net/tcD72fbKvbllrqQdHKaPyx42FlSSDdDqkm8Z1GEAcjs",
|
|
24
|
+
btc: "https://arweave.net/8eSQ-IslxWW04eTuh2G5vOncXKVLKtXxlKC6vyCemQE",
|
|
25
|
+
go: "https://arweave.net/__hs2Fm-jF-7yS7MnRkIRVrAdOrdn6iC4-Twxe8e1ps",
|
|
26
|
+
jks: "https://arweave.net/UPVr-n2J3oijcSx8cCalnNas1KxZVNaHiPmfDxPqTm0",
|
|
27
|
+
shadcn: "https://github.com/shadcn.png",
|
|
28
|
+
};
|
|
29
|
+
export const IMG_SRC = {
|
|
30
|
+
AU888: "https://baidu-finance.cdn.bcebos.com/imgs/icons/0530/futures_ab_GOLD.png",
|
|
31
|
+
binance: "https://arweave.net/8fUAyHBwxo_1YHybFGN_jI0bTUXW5736AO8vrlVZ0qQ",
|
|
32
|
+
bitget: "https://arweave.net/_p6Lp4BoYCcCzmKL-nNkQZFotuzgh7WXJuGRFgjWnEE",
|
|
33
|
+
bitget1: "https://arweave.net/Ki99DzArKbeSS1JtojXj-QyQKZr35s32W8IkRUrDsi8",
|
|
34
|
+
BTCUSDT: "https://coin-images.coingecko.com/coins/images/1/large/bitcoin.png",
|
|
35
|
+
coinbase: "https://arweave.net/XCNPLlObUE_n1Taa1iS_9D4_w-KHmXZVfLWI-bMIshA",
|
|
36
|
+
ETHUSDT: "https://coin-images.coingecko.com/coins/images/279/large/ethereum.png",
|
|
37
|
+
L1: "https://arweave.net/mJQhNY4Ia1obLHgGvf_DKcAobINcDEm6RbyCbCEnteU", // Level1 基础行情
|
|
38
|
+
NLS: "https://arweave.net/1A0Jrarna-hux7sirCX0moYedkUqixmJLB1T59Wx6Ew",
|
|
39
|
+
nodejs: "https://arweave.net/bsMsYyZlCGSZXHuwZ4BReNk1t-xFcg7KYAPHvXBx5jA",
|
|
40
|
+
okx: "https://arweave.net/zScW1JHznosuXYIQQUjmgAMYekN_esRyJby12ck5UAs",
|
|
41
|
+
SH: "https://arweave.net/zbcDqHBR69HECkU04pJe2cMb9UZdkaw368Z9-7Ooie0", // 上海证券交易所
|
|
42
|
+
typescript: "https://arweave.net/ojizDdSfAMkWFEG_L_NyxR4BWTY13MZLjC42WekTA1o",
|
|
43
|
+
US: "https://arweave.net/yAB9AibGUbrgn0oNiB8Zgw9S0aFwIbnz8gqW52UjM5M",
|
|
44
|
+
USDCNH: "https://arweave.net/qIGswQTXG_7jNU0RflLi8Qt-2FTC5ccbpWoOmMm7u5Q",
|
|
45
|
+
WH: "https://arweave.net/Y7ZsOW9u9VZf7fDQLa4tJcjDcACNBXe8L_-PPl5qy6A", // 外汇
|
|
46
|
+
XAUTUSDT: "https://coin-images.coingecko.com/coins/images/10481/large/Tether_Gold.png",
|
|
47
|
+
币安人生USDT: "https://coin-images.coingecko.com/coins/images/69848/large/%E5%B8%81%E5%AE%89%E4%BA%BA%E7%94%9F.png",
|
|
48
|
+
};
|
|
49
|
+
export const SVG_SRC = {
|
|
50
|
+
"000001": "https://baidu-finance.cdn.bcebos.com/imgs/icons/index_000001.svg",
|
|
51
|
+
"399300": "https://baidu-finance.cdn.bcebos.com/imgs/logo/indices/d0c11e7e09802a02888fcf5be5af8769.svg",
|
|
52
|
+
"399905": "https://baidu-finance.cdn.bcebos.com/imgs/logo/indices/62f226489b7e56c90b9e14e0d4fc7531.svg",
|
|
53
|
+
"600519": "https://arweave.net/K9W8zYbRg6HtBHW1wS273_2td2UOvHS27G9u_Z4ffIc",
|
|
54
|
+
AG888: "https://arweave.net/cME70JrezZj1FjE-sjkS_QIjMGwWx_U3gV3uTfJPKqQ",
|
|
55
|
+
ar: "https://arweave.net/CoPs0amqzT8swk9g1S4w_EmRm1YdcBbHFlHzZyLBA20",
|
|
56
|
+
beta: "https://arweave.net/KCAbhCpxYWfb7mZ3uPF9wQyGyaDYPHwn0zbR7nTXC80",
|
|
57
|
+
binance: "https://arweave.net/p1KeuJwiAPizd-8DBYAm1_14J3YlsfPu9evxf3M8Cto",
|
|
58
|
+
bitget: "https://arweave.net/HtmiQ-7AxOkhNtIjKzDBVTlgJv-dCSaDw-TqGeoVQQc",
|
|
59
|
+
btc: "https://arweave.net/arZDUcYsIe1iaUUiponcag3VY1AHyOII8F6IAavF_Vg",
|
|
60
|
+
btc1: "https://arweave.net/tKw5i4aX1IxOa89y-ojxFroGjBgxsfkfi1aIsKXeMuY",
|
|
61
|
+
coinbase: "https://arweave.net/0AL19pT7O6o0P-C_7HrGfn0j1FjGOtNzw6ltMk991BM",
|
|
62
|
+
eth: "https://arweave.net/CVvypM6_AP45YQKuYkvtSK2RtkeI_iOcfvdDR_WpgK0",
|
|
63
|
+
fil: "https://arweave.net/56IhfXT0GW8ko-OEOgnsL7y4haqIA1pCFXAc0VwIIiw",
|
|
64
|
+
gate: "https://arweave.net/xZueBl_L9E1e5N6rNwCC1Q1jdC6Be8viYMncB3d-C0E",
|
|
65
|
+
IXIC: "https://baidu-finance.cdn.bcebos.com/imgs/logo/indices/bbed2a87be06d1318a5c035e45c0f54c.svg",
|
|
66
|
+
line: "https://arweave.net/mfUS0iPbauAXqPYb0mRNYDCJhVQn8uKwG_HHqzYhANc",
|
|
67
|
+
metamask: "https://arweave.net/0ID-EgMR5jZQLj-JGfS2ql1FFaRr-Wvs3VoKRU4VWEU",
|
|
68
|
+
okx: "https://arweave.net/mbBFb3EXGFjrSG12tLfekPwccVuAVbUd3mEnCUjrt_M",
|
|
69
|
+
react: "https://arweave.net/NzS63egtcFF4PWAlKouHNqU05BdvWpIdD-TdaI0U2IY",
|
|
70
|
+
shadcn: "https://arweave.net/-2hSbOI-O2qs3u9d_yf4ylmV3AeSG739b-MaYghh8TA",
|
|
71
|
+
sol: "https://arweave.net/cGqOWiKeBCH1xO97fbs7Pi4assSD3aBudpuCtamWLy4",
|
|
72
|
+
solana: "https://arweave.net/cGqOWiKeBCH1xO97fbs7Pi4assSD3aBudpuCtamWLy4",
|
|
73
|
+
uni: "https://arweave.net/Awt6roS1V9fE9UvVp80x30bYPG-BAmV6Ex-CPz_TXVE",
|
|
74
|
+
vite: "https://arweave.net/IrKrystwNWLNEto65vp2Uk4LUsSfArXUAheSibRbA80",
|
|
75
|
+
};
|
|
76
|
+
export const ICON_SRC = {
|
|
77
|
+
"arrow-down": "https://arweave.net/-YGdFIvjFnQLPSANObNjyEGPFHvlMSMgpRVRGNsh2Tk",
|
|
78
|
+
"arrow-left": "https://arweave.net/_jJZIrnJMbYX_u4kHjwbHPlEjqTMQnTV4dW6z7c8v0A",
|
|
79
|
+
"arrow-right": "https://arweave.net/EMScQgcwVo1tRT-OhBgLW6-4ihQW8GrJNlhobHNMnnQ",
|
|
80
|
+
"arrow-up": "https://arweave.net/RBsQshBEQuJuF8hkyGRVVD3hP02NisXYqZ8oQfzaTG4",
|
|
81
|
+
chevron: "https://arweave.net/iU7ygwR3S3oAt6EVezM5Ab4l2q5OLwYxCS2G5jTDNsE",
|
|
82
|
+
copy: "https://arweave.net/OA0m_3us8t5skksCF-w4vT_klbAZvbfb7SRo_cgG7_k",
|
|
83
|
+
copy1: "https://arweave.net/6GqPMXgkxUEqtzYuJtZ7JlzSbsMNLp_-Me034MneZNw",
|
|
84
|
+
date: "https://arweave.net/Za54QBVo3UNSk8NpeH5jUdaI1VxYU9SSqH1_30vgHgg",
|
|
85
|
+
delete: "https://arweave.net/UwaZB8vdRdKX_Qs4rwC-KRP8eoPiANkYFJDyehMy81M",
|
|
86
|
+
edit: "https://arweave.net/2p7Uk63-5feqnC_J9Cpbs5nO3SvZsA6QEMzoUoqxkPQ",
|
|
87
|
+
eye: "https://arweave.net/yzGwWAq26yjRpDquLw4-48EtEq6LYnK6YCeAGC1EP8E",
|
|
88
|
+
home: "https://arweave.net/Pk5G6pbsp4UhkhynGMMvzqbhceU3X4e2IZLb1WouCo4",
|
|
89
|
+
kill: "https://arweave.net/hXolAnKzsjjlY69gcBxHWUOXFUyUrVqzGe3wPIV38Wc",
|
|
90
|
+
loading1: "https://arweave.net/ZnecWXdwgPXzNHC4NVOEKYi8T2wRQr8E31MH5C_s8uM",
|
|
91
|
+
loading2: "https://arweave.net/7Sc0hFWDM0wDHcu8-ArBSYZdyifw2Yk7xXiee7nJbLU",
|
|
92
|
+
loading3: "https://arweave.net/nNkZ4MZ_w0PwoMrsVX4bqRGbj-qgSDvrHLCDly9H3qA",
|
|
93
|
+
loading4: "https://arweave.net/FBR8S5bU6VICjCgf4F_7-_xC5OWsrwjqmru4T5wvlJU",
|
|
94
|
+
menu: "https://arweave.net/n5CWNGfFcKZiG8leIPn8PRZyOgUn02DBJXLG8xT-0sI",
|
|
95
|
+
menu1: "https://arweave.net/1GP8qNhG-JaAocFryihGI3QRwZ1Pb-eK6OlItqowRQg",
|
|
96
|
+
menu2: "https://arweave.net/Pozej2qroiuAy5gVRBmXrj-p3ioIz8tghQhHwRKLddo",
|
|
97
|
+
moon: "https://arweave.net/1MfkG19dwKaxQbA3wxkpSdNyTupuzHa9sXKoIreq3hQ",
|
|
98
|
+
ok: "https://arweave.net/iErSf5Cjt3Y_pXJxDJgKWBX5D16D2j4nslCrWSc8qpQ",
|
|
99
|
+
plus: "https://arweave.net/Z1KXoUsfbzVPm0tYBnv9AAmjHqg7EEJV6yM4cHPuJwA",
|
|
100
|
+
processing: "https://arweave.net/K6C7eMOM7pEESPSgsqR07EP4hUnfz0tQG138M6vpOyY",
|
|
101
|
+
refresh: "https://arweave.net/HCNMbsyzQDClZPDydPJH3VskQBONC6Ljnds2DWLE_Eo",
|
|
102
|
+
refresh1: "https://arweave.net/IFrj-BVQlhSrXgaDbmbbCRrGOnCVLKVhAepAwOW0AEs",
|
|
103
|
+
rocket: "https://arweave.net/S5Zja0AsszmLKAXNEcB0-GOucTcOnxhUVuYyuxW-L-k",
|
|
104
|
+
search: "https://arweave.net/W8A8Lbrd99c47uFqxvBiDNrGHWSpS8v26IGaGew4KyM",
|
|
105
|
+
sun: "https://arweave.net/cKUO-f2K_mG5NEt8REnrNBLLxwLE0RELwLqCb0yBCtg",
|
|
106
|
+
theme: "https://arweave.net/0QLtpZJuOdyvhf3lrW-FbHQ6gfh69pCY1G1fYaGAU9A",
|
|
107
|
+
"vertical-dots": "https://arweave.net/MCAQ2CskvsJu3Q_Ns9Hcwu8kV20CU0Qj1NTvOB-vLr0",
|
|
108
|
+
yes: "https://arweave.net/i-hGRM_wFXrpNFJRjvsx4oOzl6v3vlW3WZDEqsbla-4",
|
|
109
|
+
};
|
|
110
|
+
// 列表文件支持 csv 和 txt。使用 csv 格式时必须包含表头行,仅支持字段 url(待迁移 url)、key(迁移后的文件名)和 md5(数据内容校验值),仅支持小写且仅 url 为必需。
|
|
111
|
+
// 使用 txt 格式时,每一行表示一个要迁移的文件 URL。
|
|
112
|
+
// for (const [key, url] of Object.entries(AVATAR_SRC)) {
|
|
113
|
+
// console.log(`${url},${key}.png`);
|
|
114
|
+
// }
|
|
115
|
+
// for (const [key, url] of Object.entries(IMG_SRC)) {
|
|
116
|
+
// console.log(`${url},${key}.png`);
|
|
117
|
+
// }
|
|
118
|
+
// for (const [key, url] of Object.entries(SVG_SRC)) {
|
|
119
|
+
// console.log(`${url},${key}.svg`);
|
|
120
|
+
// }
|
|
121
|
+
for (const [key, url] of Object.entries(ICON_SRC)) {
|
|
122
|
+
console.log(`${url},${key}.svg`);
|
|
123
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import lodash from "lodash";
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import { EMA, MACD, SMA } from "trading-signals";
|
|
4
|
+
const { isNull, round, toNumber } = lodash;
|
|
5
|
+
// 从文件读取binance K线数据
|
|
6
|
+
const jsonData = JSON.parse(fs.readFileSync("d:/github/meme2046/meocli/tmp/tmp.json", "utf8"));
|
|
7
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
8
|
+
function testSMA() {
|
|
9
|
+
// 提取收盘价数据(每个K线数组的第4个元素,索引为4)
|
|
10
|
+
const closePrices = jsonData.map((kline) => toNumber(kline[4]));
|
|
11
|
+
// 创建SMA实例,设置周期为7
|
|
12
|
+
const sma = new SMA(7);
|
|
13
|
+
const smaResults = [];
|
|
14
|
+
// 实现批量添加数据的方法
|
|
15
|
+
// function updateSMA(sma: SMA, prices: number[]): (null | number)[] {
|
|
16
|
+
// const results: (null | number)[] = [];
|
|
17
|
+
// for (const price of prices) {
|
|
18
|
+
// sma.add(price);
|
|
19
|
+
// const result = sma.getResult();
|
|
20
|
+
// results.push(result);
|
|
21
|
+
// }
|
|
22
|
+
// return results;
|
|
23
|
+
// }
|
|
24
|
+
// 使用批量更新方法
|
|
25
|
+
// const smaResults2 = updateSMA(new SMA(7), closePrices);
|
|
26
|
+
// console.log("批量更新SMA(7)结果长度:", smaResults2.length);
|
|
27
|
+
// console.log("批量更新最后一个SMA(7)结果:", smaResults2.at(-1));
|
|
28
|
+
// 添加所有收盘价数据
|
|
29
|
+
for (const price of closePrices) {
|
|
30
|
+
sma.add(price);
|
|
31
|
+
const result = sma.getResult();
|
|
32
|
+
if (isNull(result)) {
|
|
33
|
+
smaResults.push(null);
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
smaResults.push(round(result, 2));
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return smaResults;
|
|
40
|
+
}
|
|
41
|
+
function testMACD() {
|
|
42
|
+
// 提取收盘价数据
|
|
43
|
+
const closePrices = jsonData.map((kline) => toNumber(kline[4]));
|
|
44
|
+
// 创建MACD实例 (参数: short=12, long=26, signal=9)
|
|
45
|
+
const short = new EMA(12);
|
|
46
|
+
const long = new EMA(26);
|
|
47
|
+
const signal = new EMA(9);
|
|
48
|
+
const macd = new MACD(short, long, signal);
|
|
49
|
+
const macdResults = [];
|
|
50
|
+
// 添加所有收盘价数据
|
|
51
|
+
for (const price of closePrices) {
|
|
52
|
+
macd.add(price);
|
|
53
|
+
const result = macd.getResult();
|
|
54
|
+
macdResults.push(result);
|
|
55
|
+
}
|
|
56
|
+
return macdResults;
|
|
57
|
+
}
|
|
58
|
+
// const smaResults = testSMA();
|
|
59
|
+
// 获取SMA结果
|
|
60
|
+
// console.log("SMA(7)结果长度:", smaResults.length);
|
|
61
|
+
// console.log("最后5个SMA(7)结果:", smaResults.slice(-5));
|
|
62
|
+
// 测试MACD
|
|
63
|
+
const macdResults = testMACD();
|
|
64
|
+
console.log("\nMACD结果长度:", macdResults.length);
|
|
65
|
+
console.log("最后一个MACD结果:", macdResults.at(-1));
|
package/oclif.manifest.json
CHANGED
|
@@ -1,5 +1,83 @@
|
|
|
1
1
|
{
|
|
2
2
|
"commands": {
|
|
3
|
+
"env:apifox": {
|
|
4
|
+
"aliases": [],
|
|
5
|
+
"args": {
|
|
6
|
+
"filePath": {
|
|
7
|
+
"default": ".env",
|
|
8
|
+
"description": ".env文件路径,不传默认值为.env",
|
|
9
|
+
"name": "filePath",
|
|
10
|
+
"required": false
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"description": "读取.env环境变量,输出apifox需要的csv格式",
|
|
14
|
+
"examples": [
|
|
15
|
+
"\n <%= config.bin %> <%= command.id %> .env\n "
|
|
16
|
+
],
|
|
17
|
+
"flags": {
|
|
18
|
+
"verbose": {
|
|
19
|
+
"char": "v",
|
|
20
|
+
"description": "Show verbose output",
|
|
21
|
+
"name": "verbose",
|
|
22
|
+
"allowNo": false,
|
|
23
|
+
"type": "boolean"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"hasDynamicHelp": false,
|
|
27
|
+
"hiddenAliases": [],
|
|
28
|
+
"id": "env:apifox",
|
|
29
|
+
"pluginAlias": "meocli",
|
|
30
|
+
"pluginName": "meocli",
|
|
31
|
+
"pluginType": "core",
|
|
32
|
+
"strict": true,
|
|
33
|
+
"enableJsonFlag": false,
|
|
34
|
+
"isESM": true,
|
|
35
|
+
"relativePath": [
|
|
36
|
+
"dist",
|
|
37
|
+
"commands",
|
|
38
|
+
"env",
|
|
39
|
+
"apifox.js"
|
|
40
|
+
]
|
|
41
|
+
},
|
|
42
|
+
"env": {
|
|
43
|
+
"aliases": [],
|
|
44
|
+
"args": {
|
|
45
|
+
"filePath": {
|
|
46
|
+
"default": ".env",
|
|
47
|
+
"description": ".env文件路径,不传默认值为.env",
|
|
48
|
+
"name": "filePath",
|
|
49
|
+
"required": false
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"description": "读取.env环境变量并打印(json格式)",
|
|
53
|
+
"examples": [
|
|
54
|
+
"\n <%= config.bin %> <%= command.id %> .env\n "
|
|
55
|
+
],
|
|
56
|
+
"flags": {
|
|
57
|
+
"verbose": {
|
|
58
|
+
"char": "v",
|
|
59
|
+
"description": "Show verbose output",
|
|
60
|
+
"name": "verbose",
|
|
61
|
+
"allowNo": false,
|
|
62
|
+
"type": "boolean"
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
"hasDynamicHelp": false,
|
|
66
|
+
"hiddenAliases": [],
|
|
67
|
+
"id": "env",
|
|
68
|
+
"pluginAlias": "meocli",
|
|
69
|
+
"pluginName": "meocli",
|
|
70
|
+
"pluginType": "core",
|
|
71
|
+
"strict": true,
|
|
72
|
+
"enableJsonFlag": false,
|
|
73
|
+
"isESM": true,
|
|
74
|
+
"relativePath": [
|
|
75
|
+
"dist",
|
|
76
|
+
"commands",
|
|
77
|
+
"env",
|
|
78
|
+
"index.js"
|
|
79
|
+
]
|
|
80
|
+
},
|
|
3
81
|
"hello": {
|
|
4
82
|
"aliases": [],
|
|
5
83
|
"args": {
|
|
@@ -11,14 +89,15 @@
|
|
|
11
89
|
},
|
|
12
90
|
"description": "Say hello",
|
|
13
91
|
"examples": [
|
|
14
|
-
"<%= config.bin %> <%= command.id %> friend --from oclif\
|
|
92
|
+
"\n <%= config.bin %> <%= command.id %> friend --from oclif\n hello friend --from oclif (./src/commands/hello/index.ts)\n "
|
|
15
93
|
],
|
|
16
94
|
"flags": {
|
|
17
95
|
"from": {
|
|
18
96
|
"char": "f",
|
|
19
97
|
"description": "Who is saying hello",
|
|
20
98
|
"name": "from",
|
|
21
|
-
"required":
|
|
99
|
+
"required": false,
|
|
100
|
+
"default": "meocli",
|
|
22
101
|
"hasDynamicHelp": false,
|
|
23
102
|
"multiple": false,
|
|
24
103
|
"type": "option"
|
|
@@ -90,6 +169,7 @@
|
|
|
90
169
|
"type": "option"
|
|
91
170
|
},
|
|
92
171
|
"ignore": {
|
|
172
|
+
"char": "i",
|
|
93
173
|
"description": "built_in:使用内置规则(默认值), 传入路径则是使用自定义规则, auto:自动检测ignore file",
|
|
94
174
|
"name": "ignore",
|
|
95
175
|
"required": false,
|
|
@@ -155,5 +235,5 @@
|
|
|
155
235
|
]
|
|
156
236
|
}
|
|
157
237
|
},
|
|
158
|
-
"version": "0.1.
|
|
238
|
+
"version": "0.1.6"
|
|
159
239
|
}
|
package/package.json
CHANGED
|
@@ -1,31 +1,36 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "meocli",
|
|
3
3
|
"description": "Node CLI generated with oclif, Integrate Prettier",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.6",
|
|
5
5
|
"author": "meme2046",
|
|
6
6
|
"bin": {
|
|
7
7
|
"me": "./bin/run.js"
|
|
8
8
|
},
|
|
9
9
|
"bugs": "https://github.com/meme2046/meocli/issues",
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@oclif/core": "^4",
|
|
11
|
+
"@oclif/core": "^4.8.0",
|
|
12
12
|
"@oclif/plugin-help": "^6",
|
|
13
13
|
"@oclif/plugin-plugins": "^5",
|
|
14
14
|
"@prettier/plugin-xml": "^3.4.2",
|
|
15
|
+
"d3-format": "^3.1.2",
|
|
16
|
+
"dayjs": "^1.11.19",
|
|
15
17
|
"debug": "^4.4.3",
|
|
18
|
+
"dotenv": "^17.2.3",
|
|
16
19
|
"execa": "^9.6.1",
|
|
17
20
|
"js-yaml": "^4.1.1",
|
|
18
|
-
"lodash": "^4.17.
|
|
19
|
-
"prettier": "^3.8.
|
|
21
|
+
"lodash": "^4.17.23",
|
|
22
|
+
"prettier": "^3.8.1",
|
|
20
23
|
"prettier-plugin-nginx": "^1.0.3",
|
|
21
24
|
"prettier-plugin-sh": "^0.18.0",
|
|
22
|
-
"prettier-plugin-toml": "^2.0.6"
|
|
25
|
+
"prettier-plugin-toml": "^2.0.6",
|
|
26
|
+
"trading-signals": "^7.4.3"
|
|
23
27
|
},
|
|
24
28
|
"devDependencies": {
|
|
25
29
|
"@eslint/compat": "^1",
|
|
26
30
|
"@oclif/prettier-config": "^0.2.1",
|
|
27
31
|
"@oclif/test": "^4",
|
|
28
32
|
"@types/chai": "^4",
|
|
33
|
+
"@types/d3-format": "^3.0.4",
|
|
29
34
|
"@types/js-yaml": "^4.0.9",
|
|
30
35
|
"@types/lodash": "^4.17.23",
|
|
31
36
|
"@types/mocha": "^10",
|
|
@@ -35,7 +40,7 @@
|
|
|
35
40
|
"eslint-config-oclif": "^6",
|
|
36
41
|
"eslint-config-prettier": "^10",
|
|
37
42
|
"mocha": "^10",
|
|
38
|
-
"npm-check-updates": "^19.3.
|
|
43
|
+
"npm-check-updates": "^19.3.2",
|
|
39
44
|
"oclif": "^4",
|
|
40
45
|
"shx": "^0.3.3",
|
|
41
46
|
"ts-node": "^10",
|
|
@@ -77,6 +82,7 @@
|
|
|
77
82
|
"types": "dist/index.d.ts",
|
|
78
83
|
"scripts": {
|
|
79
84
|
"ncu": "ncu --target minor --reject webpack,shx",
|
|
85
|
+
"tsv": "tsc -v",
|
|
80
86
|
"dev": "node --no-deprecation --no-warnings --disable-warning=ExperimentalWarning --loader ts-node/esm bin/dev.js",
|
|
81
87
|
"prod": "node bin/run.js",
|
|
82
88
|
"build": "shx rm -rf dist && tsc -b",
|