garbage-maker 0.2.1 → 0.2.3
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 +2 -1
- package/oclif.manifest.json +2 -90
- package/package.json +16 -16
- package/dist/commands/add.d.ts +0 -15
- package/dist/commands/add.js +0 -86
- package/dist/commands/clean.d.ts +0 -13
- package/dist/commands/clean.js +0 -58
- package/dist/garbage-maker.d.ts +0 -34
- package/dist/garbage-maker.js +0 -106
package/README.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# garbage-maker
|
|
2
2
|
|
|
3
|
-

|
|
3
|
+
 
|
|
4
|
+
|
|
4
5
|
|
|
5
6
|
为项目中的所有 `JavaScript` 和 `TypeScript` 脚本添加垃圾代码。
|
|
6
7
|
|
package/oclif.manifest.json
CHANGED
|
@@ -1,92 +1,4 @@
|
|
|
1
1
|
{
|
|
2
|
-
"commands": {
|
|
3
|
-
|
|
4
|
-
"aliases": [],
|
|
5
|
-
"args": {
|
|
6
|
-
"path": {
|
|
7
|
-
"description": "目标文件或目录的路径",
|
|
8
|
-
"name": "path",
|
|
9
|
-
"required": true
|
|
10
|
-
}
|
|
11
|
-
},
|
|
12
|
-
"description": "➕添加垃圾代码",
|
|
13
|
-
"examples": [
|
|
14
|
-
"<%= config.bin %> <%= command.id %>"
|
|
15
|
-
],
|
|
16
|
-
"flags": {
|
|
17
|
-
"code": {
|
|
18
|
-
"char": "c",
|
|
19
|
-
"description": "自定义添加的垃圾代码",
|
|
20
|
-
"name": "code",
|
|
21
|
-
"required": false,
|
|
22
|
-
"hasDynamicHelp": false,
|
|
23
|
-
"multiple": false,
|
|
24
|
-
"type": "option"
|
|
25
|
-
},
|
|
26
|
-
"ratio": {
|
|
27
|
-
"char": "r",
|
|
28
|
-
"description": "添加垃圾代码的比例",
|
|
29
|
-
"name": "ratio",
|
|
30
|
-
"required": false,
|
|
31
|
-
"hasDynamicHelp": false,
|
|
32
|
-
"multiple": false,
|
|
33
|
-
"type": "option"
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
"hasDynamicHelp": false,
|
|
37
|
-
"hiddenAliases": [],
|
|
38
|
-
"id": "add",
|
|
39
|
-
"pluginAlias": "garbage-maker",
|
|
40
|
-
"pluginName": "garbage-maker",
|
|
41
|
-
"pluginType": "core",
|
|
42
|
-
"strict": true,
|
|
43
|
-
"enableJsonFlag": false,
|
|
44
|
-
"isESM": true,
|
|
45
|
-
"relativePath": [
|
|
46
|
-
"dist",
|
|
47
|
-
"commands",
|
|
48
|
-
"add.js"
|
|
49
|
-
]
|
|
50
|
-
},
|
|
51
|
-
"clean": {
|
|
52
|
-
"aliases": [],
|
|
53
|
-
"args": {
|
|
54
|
-
"path": {
|
|
55
|
-
"description": "目标文件或目录的路径",
|
|
56
|
-
"name": "path",
|
|
57
|
-
"required": true
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
"description": "🧹清理垃圾代码",
|
|
61
|
-
"examples": [
|
|
62
|
-
"<%= config.bin %> <%= command.id %>"
|
|
63
|
-
],
|
|
64
|
-
"flags": {
|
|
65
|
-
"code": {
|
|
66
|
-
"char": "c",
|
|
67
|
-
"description": "需要清理的垃圾代码",
|
|
68
|
-
"name": "code",
|
|
69
|
-
"required": false,
|
|
70
|
-
"hasDynamicHelp": false,
|
|
71
|
-
"multiple": false,
|
|
72
|
-
"type": "option"
|
|
73
|
-
}
|
|
74
|
-
},
|
|
75
|
-
"hasDynamicHelp": false,
|
|
76
|
-
"hiddenAliases": [],
|
|
77
|
-
"id": "clean",
|
|
78
|
-
"pluginAlias": "garbage-maker",
|
|
79
|
-
"pluginName": "garbage-maker",
|
|
80
|
-
"pluginType": "core",
|
|
81
|
-
"strict": true,
|
|
82
|
-
"enableJsonFlag": false,
|
|
83
|
-
"isESM": true,
|
|
84
|
-
"relativePath": [
|
|
85
|
-
"dist",
|
|
86
|
-
"commands",
|
|
87
|
-
"clean.js"
|
|
88
|
-
]
|
|
89
|
-
}
|
|
90
|
-
},
|
|
91
|
-
"version": "0.2.1"
|
|
2
|
+
"commands": {},
|
|
3
|
+
"version": "0.2.3"
|
|
92
4
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "garbage-maker",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "garbage-maker,向 JS 和 TS 文件中添加垃圾代码",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"oclif",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
],
|
|
9
9
|
"homepage": "https://github.com/CosmoLau/garbage-maker",
|
|
10
10
|
"bugs": "https://github.com/CosmoLau/garbage-maker/issues",
|
|
11
|
-
"repository": "CosmoLau/garbage-maker",
|
|
11
|
+
"repository": "https://github.com/CosmoLau/garbage-maker.git",
|
|
12
12
|
"license": "MIT",
|
|
13
13
|
"author": "CosmoLau",
|
|
14
14
|
"publishConfig": {
|
|
@@ -44,24 +44,24 @@
|
|
|
44
44
|
"topicSeparator": " "
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@inquirer/prompts": "^
|
|
48
|
-
"@oclif/core": "^
|
|
49
|
-
"@oclif/plugin-help": "^6",
|
|
50
|
-
"@oclif/plugin-plugins": "^5",
|
|
51
|
-
"@types/inquirer": "^9.0.
|
|
47
|
+
"@inquirer/prompts": "^8.4.2",
|
|
48
|
+
"@oclif/core": "^4.11.1",
|
|
49
|
+
"@oclif/plugin-help": "^6.2.47",
|
|
50
|
+
"@oclif/plugin-plugins": "^5.4.65",
|
|
51
|
+
"@types/inquirer": "^9.0.9"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@oclif/prettier-config": "^0.2.1",
|
|
55
|
-
"@oclif/test": "^
|
|
56
|
-
"@types/chai": "^4",
|
|
57
|
-
"@types/mocha": "^10",
|
|
58
|
-
"@types/node": "^
|
|
59
|
-
"chai": "^
|
|
60
|
-
"mocha": "^
|
|
61
|
-
"oclif": "^4.
|
|
62
|
-
"shx": "^0.
|
|
55
|
+
"@oclif/test": "^4.1.18",
|
|
56
|
+
"@types/chai": "^4.3.20",
|
|
57
|
+
"@types/mocha": "^10.0.10",
|
|
58
|
+
"@types/node": "^25.6.2",
|
|
59
|
+
"chai": "^6.2.2",
|
|
60
|
+
"mocha": "^11.7.5",
|
|
61
|
+
"oclif": "^4.23.0",
|
|
62
|
+
"shx": "^0.4.0",
|
|
63
63
|
"ts-node": "^10.9.2",
|
|
64
|
-
"typescript": "^
|
|
64
|
+
"typescript": "^6.0.3"
|
|
65
65
|
},
|
|
66
66
|
"engines": {
|
|
67
67
|
"node": ">=18.0.0"
|
package/dist/commands/add.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Command } from '@oclif/core';
|
|
2
|
-
export default class Add extends Command {
|
|
3
|
-
static args: {
|
|
4
|
-
path: import("@oclif/core/lib/interfaces/parser.js").Arg<string, Record<string, unknown>>;
|
|
5
|
-
};
|
|
6
|
-
static description: string;
|
|
7
|
-
static examples: string[];
|
|
8
|
-
static flags: {
|
|
9
|
-
/** 添加的垃圾代码字符串 */
|
|
10
|
-
code: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
11
|
-
/** 添加垃圾代码的比例 */
|
|
12
|
-
ratio: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
13
|
-
};
|
|
14
|
-
run(): Promise<void>;
|
|
15
|
-
}
|
package/dist/commands/add.js
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { Args, Command, Flags } from '@oclif/core';
|
|
2
|
-
import { statSync } from 'fs';
|
|
3
|
-
import { GarbageMaker, defaultProp } from '../garbage-maker.js';
|
|
4
|
-
import { confirm, input } from '@inquirer/prompts';
|
|
5
|
-
export default class Add extends Command {
|
|
6
|
-
static args = {
|
|
7
|
-
path: Args.string({
|
|
8
|
-
name: 'path',
|
|
9
|
-
required: true,
|
|
10
|
-
description: '目标文件或目录的路径'
|
|
11
|
-
}),
|
|
12
|
-
};
|
|
13
|
-
static description = '➕添加垃圾代码';
|
|
14
|
-
static examples = [
|
|
15
|
-
'<%= config.bin %> <%= command.id %>',
|
|
16
|
-
];
|
|
17
|
-
static flags = {
|
|
18
|
-
/** 添加的垃圾代码字符串 */
|
|
19
|
-
code: Flags.string({
|
|
20
|
-
name: 'code',
|
|
21
|
-
description: '自定义添加的垃圾代码',
|
|
22
|
-
char: 'c',
|
|
23
|
-
required: false,
|
|
24
|
-
}),
|
|
25
|
-
/** 添加垃圾代码的比例 */
|
|
26
|
-
ratio: Flags.string({
|
|
27
|
-
name: 'ratio',
|
|
28
|
-
description: '添加垃圾代码的比例',
|
|
29
|
-
char: 'r',
|
|
30
|
-
required: false,
|
|
31
|
-
})
|
|
32
|
-
};
|
|
33
|
-
async run() {
|
|
34
|
-
const { args, flags } = await this.parse(Add);
|
|
35
|
-
this.log(`输入的路径:${args.path}`);
|
|
36
|
-
this.log(`垃圾代码:${flags.code}\n添加比例:${flags.ratio}`);
|
|
37
|
-
if (!flags.code) {
|
|
38
|
-
// 如果没有在标志中传参,对其进行询问
|
|
39
|
-
flags.code = await input({
|
|
40
|
-
message: '想要添加的垃圾代码:',
|
|
41
|
-
default: defaultProp.codeStr
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
// 检查文件中是否包含垃圾代码
|
|
45
|
-
let checkCodeConfirm = true;
|
|
46
|
-
if (GarbageMaker.checkCode(args.path, flags.code)) {
|
|
47
|
-
checkCodeConfirm = await confirm({
|
|
48
|
-
message: '现有代码中已包含垃圾代码,是否继续添加?',
|
|
49
|
-
default: false,
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
if (!checkCodeConfirm) {
|
|
53
|
-
console.log("已取消添加代码");
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
// 如果没有在标志中传参,对其进行询问
|
|
57
|
-
if (!flags.ratio) {
|
|
58
|
-
flags.ratio = await input({
|
|
59
|
-
message: '添加垃圾代码的比例:',
|
|
60
|
-
default: defaultProp.ratio?.toString()
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
try {
|
|
64
|
-
let stat = statSync(args.path);
|
|
65
|
-
if (stat.isDirectory()) {
|
|
66
|
-
this.log("传入的是一个文件夹路径");
|
|
67
|
-
}
|
|
68
|
-
else if (stat.isFile()) {
|
|
69
|
-
this.log("传入的是一个文件路径");
|
|
70
|
-
}
|
|
71
|
-
else {
|
|
72
|
-
this.warn("请输入正确的路径");
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
catch (error) {
|
|
76
|
-
this.error("无法读取路径,请输入正确的路径:" + error);
|
|
77
|
-
}
|
|
78
|
-
let prop = {
|
|
79
|
-
sourcePath: args.path,
|
|
80
|
-
addShit: true,
|
|
81
|
-
codeStr: flags.code,
|
|
82
|
-
ratio: flags.ratio ? Number(flags.ratio) : undefined,
|
|
83
|
-
};
|
|
84
|
-
GarbageMaker.execute(prop);
|
|
85
|
-
}
|
|
86
|
-
}
|
package/dist/commands/clean.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Command } from '@oclif/core';
|
|
2
|
-
export default class Clean extends Command {
|
|
3
|
-
static args: {
|
|
4
|
-
path: import("@oclif/core/lib/interfaces/parser.js").Arg<string, Record<string, unknown>>;
|
|
5
|
-
};
|
|
6
|
-
static description: string;
|
|
7
|
-
static examples: string[];
|
|
8
|
-
static flags: {
|
|
9
|
-
/** 清理的垃圾代码字符串 */
|
|
10
|
-
code: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
11
|
-
};
|
|
12
|
-
run(): Promise<void>;
|
|
13
|
-
}
|
package/dist/commands/clean.js
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { Args, Command, Flags } from '@oclif/core';
|
|
2
|
-
import { GarbageMaker, defaultProp } from '../garbage-maker.js';
|
|
3
|
-
import { statSync } from 'fs';
|
|
4
|
-
import { input } from '@inquirer/prompts';
|
|
5
|
-
export default class Clean extends Command {
|
|
6
|
-
static args = {
|
|
7
|
-
path: Args.string({
|
|
8
|
-
name: 'path',
|
|
9
|
-
required: true,
|
|
10
|
-
description: '目标文件或目录的路径'
|
|
11
|
-
}),
|
|
12
|
-
};
|
|
13
|
-
static description = '🧹清理垃圾代码';
|
|
14
|
-
static examples = [
|
|
15
|
-
'<%= config.bin %> <%= command.id %>',
|
|
16
|
-
];
|
|
17
|
-
static flags = {
|
|
18
|
-
/** 清理的垃圾代码字符串 */
|
|
19
|
-
code: Flags.string({
|
|
20
|
-
name: 'code',
|
|
21
|
-
description: '需要清理的垃圾代码',
|
|
22
|
-
char: 'c',
|
|
23
|
-
required: false,
|
|
24
|
-
}),
|
|
25
|
-
};
|
|
26
|
-
async run() {
|
|
27
|
-
const { args, flags } = await this.parse(Clean);
|
|
28
|
-
this.log(`输入的路径:${args.path}`);
|
|
29
|
-
this.log(`垃圾代码:${flags.codeStr}\n添加比例:${flags.ratio}`);
|
|
30
|
-
if (!flags.code) {
|
|
31
|
-
flags.code = await input({
|
|
32
|
-
message: '需要清理的垃圾代码:',
|
|
33
|
-
default: defaultProp.codeStr
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
try {
|
|
37
|
-
let stat = statSync(args.path);
|
|
38
|
-
if (stat.isDirectory()) {
|
|
39
|
-
this.log("传入的是一个文件夹路径");
|
|
40
|
-
}
|
|
41
|
-
else if (stat.isFile()) {
|
|
42
|
-
this.log("传入的是一个文件路径");
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
this.warn("请输入正确的路径");
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
catch (error) {
|
|
49
|
-
this.error("无法读取路径,请输入正确的路径:" + error);
|
|
50
|
-
}
|
|
51
|
-
let prop = {
|
|
52
|
-
sourcePath: args.path,
|
|
53
|
-
addShit: false,
|
|
54
|
-
codeStr: flags.code,
|
|
55
|
-
};
|
|
56
|
-
GarbageMaker.execute(prop);
|
|
57
|
-
}
|
|
58
|
-
}
|
package/dist/garbage-maker.d.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
import { PathLike } from "fs";
|
|
3
|
-
/**
|
|
4
|
-
* garbage-maker 类的参数接口
|
|
5
|
-
*/
|
|
6
|
-
export interface Prop {
|
|
7
|
-
/** 源文件路径 */
|
|
8
|
-
sourcePath: PathLike;
|
|
9
|
-
/** 是否添加垃圾代码 */
|
|
10
|
-
addShit?: boolean;
|
|
11
|
-
/** 垃圾代码内容 */
|
|
12
|
-
codeStr?: string;
|
|
13
|
-
/** 添加垃圾代码的比例 */
|
|
14
|
-
ratio?: number;
|
|
15
|
-
}
|
|
16
|
-
/** 默认参数 */
|
|
17
|
-
export declare const defaultProp: Prop;
|
|
18
|
-
/**
|
|
19
|
-
* garbage-maker 核心代码类
|
|
20
|
-
*/
|
|
21
|
-
export declare class GarbageMaker {
|
|
22
|
-
/**
|
|
23
|
-
* 执行代码
|
|
24
|
-
* @param prop 参数
|
|
25
|
-
*/
|
|
26
|
-
static execute(prop: Prop): void;
|
|
27
|
-
/**
|
|
28
|
-
* 检查垃圾代码是否存在
|
|
29
|
-
* @param path 文件或文件夹的绝对路径
|
|
30
|
-
* @param codeStr 代码字符串
|
|
31
|
-
* @returns
|
|
32
|
-
*/
|
|
33
|
-
static checkCode(path: PathLike, codeStr: string): boolean;
|
|
34
|
-
}
|
package/dist/garbage-maker.js
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import { readFileSync, readdirSync, statSync, writeFileSync } from "fs";
|
|
2
|
-
import { extname, join } from "path";
|
|
3
|
-
/** 默认参数 */
|
|
4
|
-
export const defaultProp = {
|
|
5
|
-
sourcePath: "",
|
|
6
|
-
addShit: true,
|
|
7
|
-
codeStr: "(1+1);",
|
|
8
|
-
ratio: 35,
|
|
9
|
-
};
|
|
10
|
-
/**
|
|
11
|
-
* garbage-maker 核心代码类
|
|
12
|
-
*/
|
|
13
|
-
export class GarbageMaker {
|
|
14
|
-
/**
|
|
15
|
-
* 执行代码
|
|
16
|
-
* @param prop 参数
|
|
17
|
-
*/
|
|
18
|
-
static execute(prop) {
|
|
19
|
-
/** 已修改的文件数量 */
|
|
20
|
-
let fileChangeNum = 0;
|
|
21
|
-
// 检查可选参数
|
|
22
|
-
prop.addShit = prop.addShit ?? defaultProp.addShit;
|
|
23
|
-
prop.codeStr = prop.codeStr ?? defaultProp.codeStr;
|
|
24
|
-
prop.ratio = prop.ratio ?? defaultProp.ratio;
|
|
25
|
-
/** 添加垃圾代码 */
|
|
26
|
-
let addCode = (path) => {
|
|
27
|
-
let context = readFileSync(path, 'utf8');
|
|
28
|
-
let num = Math.floor(context.length * prop.ratio / 100 / prop.codeStr?.length);
|
|
29
|
-
for (let i = 0; i < num; i++) {
|
|
30
|
-
context += prop.codeStr;
|
|
31
|
-
}
|
|
32
|
-
writeFileSync(path, context, 'utf8');
|
|
33
|
-
fileChangeNum++;
|
|
34
|
-
};
|
|
35
|
-
/** 清理垃圾代码 */
|
|
36
|
-
let cleanCode = (path) => {
|
|
37
|
-
let context = readFileSync(path, 'utf8');
|
|
38
|
-
let pattern = prop.codeStr?.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
39
|
-
let reg = new RegExp(pattern, 'g');
|
|
40
|
-
context = context.replace(reg, "");
|
|
41
|
-
writeFileSync(path, context, 'utf8');
|
|
42
|
-
fileChangeNum++;
|
|
43
|
-
};
|
|
44
|
-
/** 遍历文件夹 */
|
|
45
|
-
let traverseFile = (path) => {
|
|
46
|
-
let files = readdirSync(path);
|
|
47
|
-
files.forEach(val => {
|
|
48
|
-
let subPath = join(path.toString(), val);
|
|
49
|
-
let stat = statSync(subPath);
|
|
50
|
-
if (stat.isFile() && (extname(subPath) == ".ts" || extname(subPath) == ".js")) {
|
|
51
|
-
prop.addShit ? addCode(subPath) : cleanCode(subPath);
|
|
52
|
-
}
|
|
53
|
-
if (stat.isDirectory()) {
|
|
54
|
-
traverseFile(subPath);
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
};
|
|
58
|
-
let stat = statSync(prop.sourcePath);
|
|
59
|
-
if (stat.isFile() && (extname(prop.sourcePath.toString()) == ".ts" || extname(prop.sourcePath.toString()) == ".js")) {
|
|
60
|
-
prop.addShit ? addCode(prop.sourcePath) : cleanCode(prop.sourcePath);
|
|
61
|
-
}
|
|
62
|
-
if (stat.isDirectory()) {
|
|
63
|
-
traverseFile(prop.sourcePath);
|
|
64
|
-
}
|
|
65
|
-
console.log(`已修改 ${fileChangeNum} 个文件`);
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* 检查垃圾代码是否存在
|
|
69
|
-
* @param path 文件或文件夹的绝对路径
|
|
70
|
-
* @param codeStr 代码字符串
|
|
71
|
-
* @returns
|
|
72
|
-
*/
|
|
73
|
-
static checkCode(path, codeStr) {
|
|
74
|
-
/** 是否存在代码 */
|
|
75
|
-
let haveCode = false;
|
|
76
|
-
/** 清理垃圾代码 */
|
|
77
|
-
let check = (path) => {
|
|
78
|
-
let context = readFileSync(path, 'utf8');
|
|
79
|
-
let pattern = codeStr?.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
80
|
-
let reg = new RegExp(pattern, 'g');
|
|
81
|
-
haveCode = reg.test(context) ? true : haveCode;
|
|
82
|
-
};
|
|
83
|
-
/** 遍历文件夹 */
|
|
84
|
-
let traverseFile = (path) => {
|
|
85
|
-
let files = readdirSync(path);
|
|
86
|
-
files.forEach(val => {
|
|
87
|
-
let subPath = join(path.toString(), val);
|
|
88
|
-
let stat = statSync(subPath);
|
|
89
|
-
if (stat.isFile() && (extname(subPath) == ".ts" || extname(subPath) == ".js")) {
|
|
90
|
-
check(subPath);
|
|
91
|
-
}
|
|
92
|
-
if (stat.isDirectory()) {
|
|
93
|
-
traverseFile(subPath);
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
};
|
|
97
|
-
let stat = statSync(path);
|
|
98
|
-
if (stat.isFile() && (extname(path.toString()) == ".ts" || extname(path.toString()) == ".js")) {
|
|
99
|
-
check(path);
|
|
100
|
-
}
|
|
101
|
-
if (stat.isDirectory()) {
|
|
102
|
-
traverseFile(path);
|
|
103
|
-
}
|
|
104
|
-
return haveCode;
|
|
105
|
-
}
|
|
106
|
-
}
|