auto-cr-cmd 1.0.0
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/LICENSE +21 -0
- package/README.md +3 -0
- package/dist/babel/config.d.ts +2 -0
- package/dist/babel/config.js +95 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +165 -0
- package/dist/report/index.d.ts +6 -0
- package/dist/report/index.js +9 -0
- package/dist/types/babel/config.d.ts +2 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/report/index.d.ts +6 -0
- package/dist/types/utils/file.d.ts +9 -0
- package/dist/utils/file.d.ts +9 -0
- package/dist/utils/file.js +47 -0
- package/package.json +53 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 王威威
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.babelConfig = void 0;
|
|
18
|
+
var fs_1 = __importDefault(require("fs"));
|
|
19
|
+
var path_1 = __importDefault(require("path"));
|
|
20
|
+
var core_1 = require("@babel/core");
|
|
21
|
+
/**
|
|
22
|
+
* 获取项目中的 Babel 配置(如果存在)
|
|
23
|
+
* 如果没有找到配置文件,则返回 null
|
|
24
|
+
*/
|
|
25
|
+
function getProjectBabelConfig() {
|
|
26
|
+
try {
|
|
27
|
+
var fullConfig = (0, core_1.loadOptions)({
|
|
28
|
+
root: process.cwd(),
|
|
29
|
+
});
|
|
30
|
+
if (fullConfig) {
|
|
31
|
+
return fullConfig;
|
|
32
|
+
}
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
console.warn('Warning: Failed to load project Babel config:', error);
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* 获取合并后的 Babel 配置
|
|
42
|
+
* 会尝试读取项目配置,如果没有则使用默认配置
|
|
43
|
+
*/
|
|
44
|
+
function getMergedBabelConfig() {
|
|
45
|
+
var _a;
|
|
46
|
+
// 尝试获取项目中的 Babel 配置
|
|
47
|
+
var projectConfig = getProjectBabelConfig();
|
|
48
|
+
var tsConfigPath = path_1.default.resolve(process.cwd(), 'tsconfig.json');
|
|
49
|
+
var tsConfig = {};
|
|
50
|
+
try {
|
|
51
|
+
if (fs_1.default.existsSync(tsConfigPath)) {
|
|
52
|
+
tsConfig = JSON.parse(fs_1.default.readFileSync(tsConfigPath, 'utf-8'));
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
console.warn('Warning: Failed to read tsconfig.json:', error);
|
|
57
|
+
}
|
|
58
|
+
var defaultConfig = {
|
|
59
|
+
presets: [
|
|
60
|
+
[
|
|
61
|
+
'@babel/preset-react',
|
|
62
|
+
{
|
|
63
|
+
// 根据 tsconfig 决定使用哪种 JSX 运行时
|
|
64
|
+
runtime: ((_a = tsConfig.compilerOptions) === null || _a === void 0 ? void 0 : _a.jsx) === 'react-jsx' ? 'automatic' : 'classic',
|
|
65
|
+
development: process.env.NODE_ENV === 'development',
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
[
|
|
69
|
+
'@babel/preset-typescript',
|
|
70
|
+
{
|
|
71
|
+
allExtensions: true,
|
|
72
|
+
isTSX: true,
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
],
|
|
76
|
+
};
|
|
77
|
+
// 合并配置:项目配置优先,默认配置作为后备
|
|
78
|
+
if (projectConfig) {
|
|
79
|
+
return __assign(__assign(__assign({}, defaultConfig), projectConfig), {
|
|
80
|
+
// 对于 presets 和 plugins 等数组,需要更复杂的合并策略
|
|
81
|
+
// 这里简单起见,如果项目配置有 presets,就使用项目的,否则使用默认的
|
|
82
|
+
presets: projectConfig.presets || defaultConfig.presets, plugins: projectConfig.plugins || defaultConfig.plugins });
|
|
83
|
+
}
|
|
84
|
+
// 如果没有找到项目配置,返回默认配置
|
|
85
|
+
return defaultConfig;
|
|
86
|
+
}
|
|
87
|
+
var tsConfigPath = path_1.default.resolve(process.cwd(), 'tsconfig.json');
|
|
88
|
+
var tsConfig = JSON.parse(fs_1.default.readFileSync(tsConfigPath, 'utf-8'));
|
|
89
|
+
exports.babelConfig = __assign(__assign({}, getMergedBabelConfig()), { parserOpts: {
|
|
90
|
+
plugins: [
|
|
91
|
+
'jsx',
|
|
92
|
+
'typescript',
|
|
93
|
+
tsConfig.compilerOptions.jsx === 'preserve' ? 'preserveJsx' : '',
|
|
94
|
+
].filter(Boolean),
|
|
95
|
+
} });
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
var __assign = (this && this.__assign) || function () {
|
|
4
|
+
__assign = Object.assign || function(t) {
|
|
5
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
6
|
+
s = arguments[i];
|
|
7
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
8
|
+
t[p] = s[p];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
return __assign.apply(this, arguments);
|
|
13
|
+
};
|
|
14
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
15
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
16
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
17
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
18
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
19
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
20
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
24
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
25
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
26
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
27
|
+
function step(op) {
|
|
28
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
29
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
30
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
31
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
32
|
+
switch (op[0]) {
|
|
33
|
+
case 0: case 1: t = op; break;
|
|
34
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
35
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
36
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
37
|
+
default:
|
|
38
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
39
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
40
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
41
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
42
|
+
if (t[2]) _.ops.pop();
|
|
43
|
+
_.trys.pop(); continue;
|
|
44
|
+
}
|
|
45
|
+
op = body.call(thisArg, _);
|
|
46
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
47
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
51
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
52
|
+
if (ar || !(i in from)) {
|
|
53
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
54
|
+
ar[i] = from[i];
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
58
|
+
};
|
|
59
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
60
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
61
|
+
};
|
|
62
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
63
|
+
var consola_1 = require("consola");
|
|
64
|
+
var fs_1 = __importDefault(require("fs"));
|
|
65
|
+
var commander_1 = require("commander");
|
|
66
|
+
var config_1 = require("./babel/config");
|
|
67
|
+
var file_1 = require("./utils/file");
|
|
68
|
+
var core_1 = require("@babel/core");
|
|
69
|
+
var report_1 = require("./report");
|
|
70
|
+
var path_1 = __importDefault(require("path"));
|
|
71
|
+
var auto_cr_rules_1 = require("auto-cr-rules");
|
|
72
|
+
function run() {
|
|
73
|
+
return __awaiter(this, arguments, void 0, function (filePaths, ruleDir) {
|
|
74
|
+
var validPaths, allFiles, _i, validPaths_1, targetPath, stat, directoryFiles, plugins, _a, allFiles_1, file;
|
|
75
|
+
if (filePaths === void 0) { filePaths = []; }
|
|
76
|
+
return __generator(this, function (_b) {
|
|
77
|
+
try {
|
|
78
|
+
if (filePaths.length === 0) {
|
|
79
|
+
consola_1.consola.info('未提供文件或目录路径,跳过代码扫描');
|
|
80
|
+
return [2 /*return*/];
|
|
81
|
+
}
|
|
82
|
+
validPaths = filePaths.filter(function (path) { return (0, file_1.checkPathExists)(path); });
|
|
83
|
+
if (validPaths.length === 0) {
|
|
84
|
+
consola_1.consola.error('所有提供的路径均不存在,终止操作');
|
|
85
|
+
return [2 /*return*/];
|
|
86
|
+
}
|
|
87
|
+
allFiles = [];
|
|
88
|
+
for (_i = 0, validPaths_1 = validPaths; _i < validPaths_1.length; _i++) {
|
|
89
|
+
targetPath = validPaths_1[_i];
|
|
90
|
+
stat = fs_1.default.statSync(targetPath);
|
|
91
|
+
if (stat.isFile()) {
|
|
92
|
+
// 如果是文件,直接添加到扫描列表
|
|
93
|
+
allFiles.push(targetPath);
|
|
94
|
+
}
|
|
95
|
+
else if (stat.isDirectory()) {
|
|
96
|
+
// 如果是目录,递归获取所有相关文件
|
|
97
|
+
consola_1.consola.info("\u626B\u63CF\u76EE\u5F55: ".concat(targetPath));
|
|
98
|
+
directoryFiles = (0, file_1.getAllFiles)(targetPath);
|
|
99
|
+
allFiles = __spreadArray(__spreadArray([], allFiles, true), directoryFiles, true);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
if (allFiles.length === 0) {
|
|
103
|
+
consola_1.consola.info('未找到需要扫描的文件');
|
|
104
|
+
return [2 /*return*/];
|
|
105
|
+
}
|
|
106
|
+
plugins = void 0;
|
|
107
|
+
if (ruleDir === null || ruleDir === void 0 ? void 0 : ruleDir.length) {
|
|
108
|
+
plugins = (0, file_1.getAllFiles)(path_1.default.resolve(__dirname, ruleDir !== null && ruleDir !== void 0 ? ruleDir : ''), [], ['.js'])
|
|
109
|
+
.map(function (file) {
|
|
110
|
+
var fileName = file.split('/').reverse()[0];
|
|
111
|
+
if (fileName !== 'index.js' && fileName !== 'types.js') {
|
|
112
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
113
|
+
return [require(file), { report: report_1.report }];
|
|
114
|
+
}
|
|
115
|
+
return undefined;
|
|
116
|
+
})
|
|
117
|
+
.filter(function (item) { return item !== undefined; });
|
|
118
|
+
}
|
|
119
|
+
// 执行扫描
|
|
120
|
+
for (_a = 0, allFiles_1 = allFiles; _a < allFiles_1.length; _a++) {
|
|
121
|
+
file = allFiles_1[_a];
|
|
122
|
+
consola_1.consola.info("\u626B\u63CF\u6587\u4EF6: ".concat(file));
|
|
123
|
+
try {
|
|
124
|
+
(0, core_1.transformSync)((0, file_1.readFile)(file), __assign(__assign({}, config_1.babelConfig), { plugins: __spreadArray(__spreadArray([], auto_cr_rules_1.rules.map(function (rule) { return [rule, { report: report_1.report }]; }), true), (plugins || []), true) }));
|
|
125
|
+
}
|
|
126
|
+
catch (error) {
|
|
127
|
+
consola_1.consola.error("\u6587\u4EF6\u626B\u63CF\u5931\u8D25: ".concat(file), error instanceof Error ? error.message : error);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
consola_1.consola.success('代码扫描完成');
|
|
131
|
+
}
|
|
132
|
+
catch (error) {
|
|
133
|
+
consola_1.consola.error('代码扫描过程中发生错误:', error instanceof Error ? error.message : error);
|
|
134
|
+
process.exit(1);
|
|
135
|
+
}
|
|
136
|
+
return [2 /*return*/];
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
commander_1.program
|
|
141
|
+
.argument('[paths...]', '需要扫描的文件或目录路径列表')
|
|
142
|
+
.option('-r, --rule-dir <directory>', '自定义规则目录路径')
|
|
143
|
+
.parse(process.argv);
|
|
144
|
+
var options = commander_1.program.opts();
|
|
145
|
+
var filePaths = commander_1.program.args;
|
|
146
|
+
(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
147
|
+
var error_1;
|
|
148
|
+
return __generator(this, function (_a) {
|
|
149
|
+
switch (_a.label) {
|
|
150
|
+
case 0:
|
|
151
|
+
_a.trys.push([0, 2, , 3]);
|
|
152
|
+
return [4 /*yield*/, run(filePaths, options.ruleDir)];
|
|
153
|
+
case 1:
|
|
154
|
+
_a.sent();
|
|
155
|
+
process.exit(0);
|
|
156
|
+
return [3 /*break*/, 3];
|
|
157
|
+
case 2:
|
|
158
|
+
error_1 = _a.sent();
|
|
159
|
+
consola_1.consola.error('执行过程中发生未预期的错误:', error_1);
|
|
160
|
+
process.exit(1);
|
|
161
|
+
return [3 /*break*/, 3];
|
|
162
|
+
case 3: return [2 /*return*/];
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
}); })();
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type NodePath } from '@babel/traverse';
|
|
2
|
+
import type { AnyTypeAnnotation, ArgumentPlaceholder, ArrayExpression, ArrayPattern, ArrayTypeAnnotation, ArrowFunctionExpression, AssignmentExpression, AssignmentPattern, AwaitExpression, BigIntLiteral, BinaryExpression, BindExpression, BlockStatement, BooleanLiteral, BooleanLiteralTypeAnnotation, BooleanTypeAnnotation, BreakStatement, CallExpression, CatchClause, ClassAccessorProperty, ClassBody, ClassDeclaration, ClassExpression, ClassImplements, ClassMethod, ClassPrivateMethod, ClassPrivateProperty, ClassProperty, ConditionalExpression, ContinueStatement, DebuggerStatement, DecimalLiteral, DeclareClass, DeclaredPredicate, DeclareExportAllDeclaration, DeclareExportDeclaration, DeclareFunction, DeclareInterface, DeclareModule, DeclareModuleExports, DeclareOpaqueType, DeclareTypeAlias, DeclareVariable, Decorator, Directive, DirectiveLiteral, DoExpression, DoWhileStatement, EmptyStatement, EmptyTypeAnnotation, EnumBooleanBody, EnumBooleanMember, EnumDeclaration, EnumDefaultedMember, EnumNumberBody, EnumNumberMember, EnumStringBody, EnumStringMember, EnumSymbolBody, ExistsTypeAnnotation, ExportAllDeclaration, ExportDefaultDeclaration, ExportDefaultSpecifier, ExportNamedDeclaration, ExportNamespaceSpecifier, ExportSpecifier, ExpressionStatement, File, ForInStatement, ForOfStatement, ForStatement, FunctionDeclaration, FunctionExpression, FunctionTypeAnnotation, FunctionTypeParam, GenericTypeAnnotation, Identifier, IfStatement, Import, ImportAttribute, ImportDeclaration, ImportDefaultSpecifier, ImportExpression, ImportNamespaceSpecifier, ImportSpecifier, IndexedAccessType, InferredPredicate, InterfaceDeclaration, InterfaceExtends, InterfaceTypeAnnotation, InterpreterDirective, IntersectionTypeAnnotation, JSXAttribute, JSXClosingElement, JSXClosingFragment, JSXElement, JSXEmptyExpression, JSXExpressionContainer, JSXFragment, JSXIdentifier, JSXMemberExpression, JSXNamespacedName, JSXOpeningElement, JSXOpeningFragment, JSXSpreadAttribute, JSXSpreadChild, JSXText, LabeledStatement, LogicalExpression, MemberExpression, MetaProperty, MixedTypeAnnotation, ModuleExpression, NewExpression, Noop, NullableTypeAnnotation, NullLiteral, NullLiteralTypeAnnotation, NumberLiteralTypeAnnotation, NumberTypeAnnotation, NumericLiteral, ObjectExpression, ObjectMethod, ObjectPattern, ObjectProperty, ObjectTypeAnnotation, ObjectTypeCallProperty, ObjectTypeIndexer, ObjectTypeInternalSlot, ObjectTypeProperty, ObjectTypeSpreadProperty, OpaqueType, OptionalCallExpression, OptionalIndexedAccessType, OptionalMemberExpression, ParenthesizedExpression, PipelineBareFunction, PipelinePrimaryTopicReference, PipelineTopicExpression, Placeholder, PrivateName, Program, QualifiedTypeIdentifier, RecordExpression, RegExpLiteral, RestElement, ReturnStatement, SequenceExpression, SpreadElement, StaticBlock, StringLiteral, StringLiteralTypeAnnotation, StringTypeAnnotation, Super, SwitchCase, SwitchStatement, SymbolTypeAnnotation, TaggedTemplateExpression, TemplateElement, TemplateLiteral, ThisExpression, ThisTypeAnnotation, ThrowStatement, TopicReference, TryStatement, TSAnyKeyword, TSArrayType, TSAsExpression, TSBigIntKeyword, TSBooleanKeyword, TSCallSignatureDeclaration, TSConditionalType, TSConstructorType, TSConstructSignatureDeclaration, TSDeclareFunction, TSDeclareMethod, TSEnumBody, TSEnumDeclaration, TSEnumMember, TSExportAssignment, TSExpressionWithTypeArguments, TSExternalModuleReference, TSFunctionType, TSImportEqualsDeclaration, TSImportType, TSIndexedAccessType, TSIndexSignature, TSInferType, TSInstantiationExpression, TSInterfaceBody, TSInterfaceDeclaration, TSIntersectionType, TSIntrinsicKeyword, TSLiteralType, TSMappedType, TSMethodSignature, TSModuleBlock, TSModuleDeclaration, TSNamedTupleMember, TSNamespaceExportDeclaration, TSNeverKeyword, TSNonNullExpression, TSNullKeyword, TSNumberKeyword, TSObjectKeyword, TSOptionalType, TSParameterProperty, TSParenthesizedType, TSPropertySignature, TSQualifiedName, TSRestType, TSSatisfiesExpression, TSStringKeyword, TSSymbolKeyword, TSTemplateLiteralType, TSThisType, TSTupleType, TSTypeAliasDeclaration, TSTypeAnnotation, TSTypeAssertion, TSTypeLiteral, TSTypeOperator, TSTypeParameter, TSTypeParameterDeclaration, TSTypeParameterInstantiation, TSTypePredicate, TSTypeQuery, TSTypeReference, TSUndefinedKeyword, TSUnionType, TSUnknownKeyword, TSVoidKeyword, TupleExpression, TupleTypeAnnotation, TypeAlias, TypeAnnotation, TypeCastExpression, TypeofTypeAnnotation, TypeParameter, TypeParameterDeclaration, TypeParameterInstantiation, UnaryExpression, UnionTypeAnnotation, UpdateExpression, V8IntrinsicIdentifier, VariableDeclaration, VariableDeclarator, Variance, VoidPattern, VoidTypeAnnotation, WhileStatement, WithStatement, YieldExpression } from '@babel/types';
|
|
3
|
+
type Node = AnyTypeAnnotation | ArgumentPlaceholder | ArrayExpression | ArrayPattern | ArrayTypeAnnotation | ArrowFunctionExpression | AssignmentExpression | AssignmentPattern | AwaitExpression | BigIntLiteral | BinaryExpression | BindExpression | BlockStatement | BooleanLiteral | BooleanLiteralTypeAnnotation | BooleanTypeAnnotation | BreakStatement | CallExpression | CatchClause | ClassAccessorProperty | ClassBody | ClassDeclaration | ClassExpression | ClassImplements | ClassMethod | ClassPrivateMethod | ClassPrivateProperty | ClassProperty | ConditionalExpression | ContinueStatement | DebuggerStatement | DecimalLiteral | DeclareClass | DeclareExportAllDeclaration | DeclareExportDeclaration | DeclareFunction | DeclareInterface | DeclareModule | DeclareModuleExports | DeclareOpaqueType | DeclareTypeAlias | DeclareVariable | DeclaredPredicate | Decorator | Directive | DirectiveLiteral | DoExpression | DoWhileStatement | EmptyStatement | EmptyTypeAnnotation | EnumBooleanBody | EnumBooleanMember | EnumDeclaration | EnumDefaultedMember | EnumNumberBody | EnumNumberMember | EnumStringBody | EnumStringMember | EnumSymbolBody | ExistsTypeAnnotation | ExportAllDeclaration | ExportDefaultDeclaration | ExportDefaultSpecifier | ExportNamedDeclaration | ExportNamespaceSpecifier | ExportSpecifier | ExpressionStatement | File | ForInStatement | ForOfStatement | ForStatement | FunctionDeclaration | FunctionExpression | FunctionTypeAnnotation | FunctionTypeParam | GenericTypeAnnotation | Identifier | IfStatement | Import | ImportAttribute | ImportDeclaration | ImportDefaultSpecifier | ImportExpression | ImportNamespaceSpecifier | ImportSpecifier | IndexedAccessType | InferredPredicate | InterfaceDeclaration | InterfaceExtends | InterfaceTypeAnnotation | InterpreterDirective | IntersectionTypeAnnotation | JSXAttribute | JSXClosingElement | JSXClosingFragment | JSXElement | JSXEmptyExpression | JSXExpressionContainer | JSXFragment | JSXIdentifier | JSXMemberExpression | JSXNamespacedName | JSXOpeningElement | JSXOpeningFragment | JSXSpreadAttribute | JSXSpreadChild | JSXText | LabeledStatement | LogicalExpression | MemberExpression | MetaProperty | MixedTypeAnnotation | ModuleExpression | NewExpression | Noop | NullLiteral | NullLiteralTypeAnnotation | NullableTypeAnnotation | NumberLiteralTypeAnnotation | NumberTypeAnnotation | NumericLiteral | ObjectExpression | ObjectMethod | ObjectPattern | ObjectProperty | ObjectTypeAnnotation | ObjectTypeCallProperty | ObjectTypeIndexer | ObjectTypeInternalSlot | ObjectTypeProperty | ObjectTypeSpreadProperty | OpaqueType | OptionalCallExpression | OptionalIndexedAccessType | OptionalMemberExpression | ParenthesizedExpression | PipelineBareFunction | PipelinePrimaryTopicReference | PipelineTopicExpression | Placeholder | PrivateName | Program | QualifiedTypeIdentifier | RecordExpression | RegExpLiteral | RestElement | ReturnStatement | SequenceExpression | SpreadElement | StaticBlock | StringLiteral | StringLiteralTypeAnnotation | StringTypeAnnotation | Super | SwitchCase | SwitchStatement | SymbolTypeAnnotation | TSAnyKeyword | TSArrayType | TSAsExpression | TSBigIntKeyword | TSBooleanKeyword | TSCallSignatureDeclaration | TSConditionalType | TSConstructSignatureDeclaration | TSConstructorType | TSDeclareFunction | TSDeclareMethod | TSEnumBody | TSEnumDeclaration | TSEnumMember | TSExportAssignment | TSExpressionWithTypeArguments | TSExternalModuleReference | TSFunctionType | TSImportEqualsDeclaration | TSImportType | TSIndexSignature | TSIndexedAccessType | TSInferType | TSInstantiationExpression | TSInterfaceBody | TSInterfaceDeclaration | TSIntersectionType | TSIntrinsicKeyword | TSLiteralType | TSMappedType | TSMethodSignature | TSModuleBlock | TSModuleDeclaration | TSNamedTupleMember | TSNamespaceExportDeclaration | TSNeverKeyword | TSNonNullExpression | TSNullKeyword | TSNumberKeyword | TSObjectKeyword | TSOptionalType | TSParameterProperty | TSParenthesizedType | TSPropertySignature | TSQualifiedName | TSRestType | TSSatisfiesExpression | TSStringKeyword | TSSymbolKeyword | TSTemplateLiteralType | TSThisType | TSTupleType | TSTypeAliasDeclaration | TSTypeAnnotation | TSTypeAssertion | TSTypeLiteral | TSTypeOperator | TSTypeParameter | TSTypeParameterDeclaration | TSTypeParameterInstantiation | TSTypePredicate | TSTypeQuery | TSTypeReference | TSUndefinedKeyword | TSUnionType | TSUnknownKeyword | TSVoidKeyword | TaggedTemplateExpression | TemplateElement | TemplateLiteral | ThisExpression | ThisTypeAnnotation | ThrowStatement | TopicReference | TryStatement | TupleExpression | TupleTypeAnnotation | TypeAlias | TypeAnnotation | TypeCastExpression | TypeParameter | TypeParameterDeclaration | TypeParameterInstantiation | TypeofTypeAnnotation | UnaryExpression | UnionTypeAnnotation | UpdateExpression | V8IntrinsicIdentifier | VariableDeclaration | VariableDeclarator | Variance | VoidPattern | VoidTypeAnnotation | WhileStatement | WithStatement | YieldExpression;
|
|
4
|
+
type ReportFunction = <T extends Node>(issue: NodePath<T>, message: string) => void;
|
|
5
|
+
export declare const report: ReportFunction;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.report = void 0;
|
|
4
|
+
var report = function (issue, message) {
|
|
5
|
+
var _a, _b, _c;
|
|
6
|
+
var lineNumber = (_c = (_b = (_a = issue === null || issue === void 0 ? void 0 : issue.node) === null || _a === void 0 ? void 0 : _a.loc) === null || _b === void 0 ? void 0 : _b.start) === null || _c === void 0 ? void 0 : _c.line;
|
|
7
|
+
console.log("[ERROR] Line ".concat(lineNumber, ": ").concat(message));
|
|
8
|
+
};
|
|
9
|
+
exports.report = report;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type NodePath } from '@babel/traverse';
|
|
2
|
+
import type { AnyTypeAnnotation, ArgumentPlaceholder, ArrayExpression, ArrayPattern, ArrayTypeAnnotation, ArrowFunctionExpression, AssignmentExpression, AssignmentPattern, AwaitExpression, BigIntLiteral, BinaryExpression, BindExpression, BlockStatement, BooleanLiteral, BooleanLiteralTypeAnnotation, BooleanTypeAnnotation, BreakStatement, CallExpression, CatchClause, ClassAccessorProperty, ClassBody, ClassDeclaration, ClassExpression, ClassImplements, ClassMethod, ClassPrivateMethod, ClassPrivateProperty, ClassProperty, ConditionalExpression, ContinueStatement, DebuggerStatement, DecimalLiteral, DeclareClass, DeclaredPredicate, DeclareExportAllDeclaration, DeclareExportDeclaration, DeclareFunction, DeclareInterface, DeclareModule, DeclareModuleExports, DeclareOpaqueType, DeclareTypeAlias, DeclareVariable, Decorator, Directive, DirectiveLiteral, DoExpression, DoWhileStatement, EmptyStatement, EmptyTypeAnnotation, EnumBooleanBody, EnumBooleanMember, EnumDeclaration, EnumDefaultedMember, EnumNumberBody, EnumNumberMember, EnumStringBody, EnumStringMember, EnumSymbolBody, ExistsTypeAnnotation, ExportAllDeclaration, ExportDefaultDeclaration, ExportDefaultSpecifier, ExportNamedDeclaration, ExportNamespaceSpecifier, ExportSpecifier, ExpressionStatement, File, ForInStatement, ForOfStatement, ForStatement, FunctionDeclaration, FunctionExpression, FunctionTypeAnnotation, FunctionTypeParam, GenericTypeAnnotation, Identifier, IfStatement, Import, ImportAttribute, ImportDeclaration, ImportDefaultSpecifier, ImportExpression, ImportNamespaceSpecifier, ImportSpecifier, IndexedAccessType, InferredPredicate, InterfaceDeclaration, InterfaceExtends, InterfaceTypeAnnotation, InterpreterDirective, IntersectionTypeAnnotation, JSXAttribute, JSXClosingElement, JSXClosingFragment, JSXElement, JSXEmptyExpression, JSXExpressionContainer, JSXFragment, JSXIdentifier, JSXMemberExpression, JSXNamespacedName, JSXOpeningElement, JSXOpeningFragment, JSXSpreadAttribute, JSXSpreadChild, JSXText, LabeledStatement, LogicalExpression, MemberExpression, MetaProperty, MixedTypeAnnotation, ModuleExpression, NewExpression, Noop, NullableTypeAnnotation, NullLiteral, NullLiteralTypeAnnotation, NumberLiteralTypeAnnotation, NumberTypeAnnotation, NumericLiteral, ObjectExpression, ObjectMethod, ObjectPattern, ObjectProperty, ObjectTypeAnnotation, ObjectTypeCallProperty, ObjectTypeIndexer, ObjectTypeInternalSlot, ObjectTypeProperty, ObjectTypeSpreadProperty, OpaqueType, OptionalCallExpression, OptionalIndexedAccessType, OptionalMemberExpression, ParenthesizedExpression, PipelineBareFunction, PipelinePrimaryTopicReference, PipelineTopicExpression, Placeholder, PrivateName, Program, QualifiedTypeIdentifier, RecordExpression, RegExpLiteral, RestElement, ReturnStatement, SequenceExpression, SpreadElement, StaticBlock, StringLiteral, StringLiteralTypeAnnotation, StringTypeAnnotation, Super, SwitchCase, SwitchStatement, SymbolTypeAnnotation, TaggedTemplateExpression, TemplateElement, TemplateLiteral, ThisExpression, ThisTypeAnnotation, ThrowStatement, TopicReference, TryStatement, TSAnyKeyword, TSArrayType, TSAsExpression, TSBigIntKeyword, TSBooleanKeyword, TSCallSignatureDeclaration, TSConditionalType, TSConstructorType, TSConstructSignatureDeclaration, TSDeclareFunction, TSDeclareMethod, TSEnumBody, TSEnumDeclaration, TSEnumMember, TSExportAssignment, TSExpressionWithTypeArguments, TSExternalModuleReference, TSFunctionType, TSImportEqualsDeclaration, TSImportType, TSIndexedAccessType, TSIndexSignature, TSInferType, TSInstantiationExpression, TSInterfaceBody, TSInterfaceDeclaration, TSIntersectionType, TSIntrinsicKeyword, TSLiteralType, TSMappedType, TSMethodSignature, TSModuleBlock, TSModuleDeclaration, TSNamedTupleMember, TSNamespaceExportDeclaration, TSNeverKeyword, TSNonNullExpression, TSNullKeyword, TSNumberKeyword, TSObjectKeyword, TSOptionalType, TSParameterProperty, TSParenthesizedType, TSPropertySignature, TSQualifiedName, TSRestType, TSSatisfiesExpression, TSStringKeyword, TSSymbolKeyword, TSTemplateLiteralType, TSThisType, TSTupleType, TSTypeAliasDeclaration, TSTypeAnnotation, TSTypeAssertion, TSTypeLiteral, TSTypeOperator, TSTypeParameter, TSTypeParameterDeclaration, TSTypeParameterInstantiation, TSTypePredicate, TSTypeQuery, TSTypeReference, TSUndefinedKeyword, TSUnionType, TSUnknownKeyword, TSVoidKeyword, TupleExpression, TupleTypeAnnotation, TypeAlias, TypeAnnotation, TypeCastExpression, TypeofTypeAnnotation, TypeParameter, TypeParameterDeclaration, TypeParameterInstantiation, UnaryExpression, UnionTypeAnnotation, UpdateExpression, V8IntrinsicIdentifier, VariableDeclaration, VariableDeclarator, Variance, VoidPattern, VoidTypeAnnotation, WhileStatement, WithStatement, YieldExpression } from '@babel/types';
|
|
3
|
+
type Node = AnyTypeAnnotation | ArgumentPlaceholder | ArrayExpression | ArrayPattern | ArrayTypeAnnotation | ArrowFunctionExpression | AssignmentExpression | AssignmentPattern | AwaitExpression | BigIntLiteral | BinaryExpression | BindExpression | BlockStatement | BooleanLiteral | BooleanLiteralTypeAnnotation | BooleanTypeAnnotation | BreakStatement | CallExpression | CatchClause | ClassAccessorProperty | ClassBody | ClassDeclaration | ClassExpression | ClassImplements | ClassMethod | ClassPrivateMethod | ClassPrivateProperty | ClassProperty | ConditionalExpression | ContinueStatement | DebuggerStatement | DecimalLiteral | DeclareClass | DeclareExportAllDeclaration | DeclareExportDeclaration | DeclareFunction | DeclareInterface | DeclareModule | DeclareModuleExports | DeclareOpaqueType | DeclareTypeAlias | DeclareVariable | DeclaredPredicate | Decorator | Directive | DirectiveLiteral | DoExpression | DoWhileStatement | EmptyStatement | EmptyTypeAnnotation | EnumBooleanBody | EnumBooleanMember | EnumDeclaration | EnumDefaultedMember | EnumNumberBody | EnumNumberMember | EnumStringBody | EnumStringMember | EnumSymbolBody | ExistsTypeAnnotation | ExportAllDeclaration | ExportDefaultDeclaration | ExportDefaultSpecifier | ExportNamedDeclaration | ExportNamespaceSpecifier | ExportSpecifier | ExpressionStatement | File | ForInStatement | ForOfStatement | ForStatement | FunctionDeclaration | FunctionExpression | FunctionTypeAnnotation | FunctionTypeParam | GenericTypeAnnotation | Identifier | IfStatement | Import | ImportAttribute | ImportDeclaration | ImportDefaultSpecifier | ImportExpression | ImportNamespaceSpecifier | ImportSpecifier | IndexedAccessType | InferredPredicate | InterfaceDeclaration | InterfaceExtends | InterfaceTypeAnnotation | InterpreterDirective | IntersectionTypeAnnotation | JSXAttribute | JSXClosingElement | JSXClosingFragment | JSXElement | JSXEmptyExpression | JSXExpressionContainer | JSXFragment | JSXIdentifier | JSXMemberExpression | JSXNamespacedName | JSXOpeningElement | JSXOpeningFragment | JSXSpreadAttribute | JSXSpreadChild | JSXText | LabeledStatement | LogicalExpression | MemberExpression | MetaProperty | MixedTypeAnnotation | ModuleExpression | NewExpression | Noop | NullLiteral | NullLiteralTypeAnnotation | NullableTypeAnnotation | NumberLiteralTypeAnnotation | NumberTypeAnnotation | NumericLiteral | ObjectExpression | ObjectMethod | ObjectPattern | ObjectProperty | ObjectTypeAnnotation | ObjectTypeCallProperty | ObjectTypeIndexer | ObjectTypeInternalSlot | ObjectTypeProperty | ObjectTypeSpreadProperty | OpaqueType | OptionalCallExpression | OptionalIndexedAccessType | OptionalMemberExpression | ParenthesizedExpression | PipelineBareFunction | PipelinePrimaryTopicReference | PipelineTopicExpression | Placeholder | PrivateName | Program | QualifiedTypeIdentifier | RecordExpression | RegExpLiteral | RestElement | ReturnStatement | SequenceExpression | SpreadElement | StaticBlock | StringLiteral | StringLiteralTypeAnnotation | StringTypeAnnotation | Super | SwitchCase | SwitchStatement | SymbolTypeAnnotation | TSAnyKeyword | TSArrayType | TSAsExpression | TSBigIntKeyword | TSBooleanKeyword | TSCallSignatureDeclaration | TSConditionalType | TSConstructSignatureDeclaration | TSConstructorType | TSDeclareFunction | TSDeclareMethod | TSEnumBody | TSEnumDeclaration | TSEnumMember | TSExportAssignment | TSExpressionWithTypeArguments | TSExternalModuleReference | TSFunctionType | TSImportEqualsDeclaration | TSImportType | TSIndexSignature | TSIndexedAccessType | TSInferType | TSInstantiationExpression | TSInterfaceBody | TSInterfaceDeclaration | TSIntersectionType | TSIntrinsicKeyword | TSLiteralType | TSMappedType | TSMethodSignature | TSModuleBlock | TSModuleDeclaration | TSNamedTupleMember | TSNamespaceExportDeclaration | TSNeverKeyword | TSNonNullExpression | TSNullKeyword | TSNumberKeyword | TSObjectKeyword | TSOptionalType | TSParameterProperty | TSParenthesizedType | TSPropertySignature | TSQualifiedName | TSRestType | TSSatisfiesExpression | TSStringKeyword | TSSymbolKeyword | TSTemplateLiteralType | TSThisType | TSTupleType | TSTypeAliasDeclaration | TSTypeAnnotation | TSTypeAssertion | TSTypeLiteral | TSTypeOperator | TSTypeParameter | TSTypeParameterDeclaration | TSTypeParameterInstantiation | TSTypePredicate | TSTypeQuery | TSTypeReference | TSUndefinedKeyword | TSUnionType | TSUnknownKeyword | TSVoidKeyword | TaggedTemplateExpression | TemplateElement | TemplateLiteral | ThisExpression | ThisTypeAnnotation | ThrowStatement | TopicReference | TryStatement | TupleExpression | TupleTypeAnnotation | TypeAlias | TypeAnnotation | TypeCastExpression | TypeParameter | TypeParameterDeclaration | TypeParameterInstantiation | TypeofTypeAnnotation | UnaryExpression | UnionTypeAnnotation | UpdateExpression | V8IntrinsicIdentifier | VariableDeclaration | VariableDeclarator | Variance | VoidPattern | VoidTypeAnnotation | WhileStatement | WithStatement | YieldExpression;
|
|
4
|
+
type ReportFunction = <T extends Node>(issue: NodePath<T>, message: string) => void;
|
|
5
|
+
export declare const report: ReportFunction;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const readFile: (path: string) => string;
|
|
2
|
+
/**
|
|
3
|
+
* 递归获取目录下所有 TypeScript 和 JavaScript 文件
|
|
4
|
+
*/
|
|
5
|
+
export declare function getAllFiles(dirPath: string, arrayOfFiles?: string[], extensions?: string[]): string[];
|
|
6
|
+
/**
|
|
7
|
+
* 检查文件或目录是否存在
|
|
8
|
+
*/
|
|
9
|
+
export declare function checkPathExists(targetPath: string): boolean;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const readFile: (path: string) => string;
|
|
2
|
+
/**
|
|
3
|
+
* 递归获取目录下所有 TypeScript 和 JavaScript 文件
|
|
4
|
+
*/
|
|
5
|
+
export declare function getAllFiles(dirPath: string, arrayOfFiles?: string[], extensions?: string[]): string[];
|
|
6
|
+
/**
|
|
7
|
+
* 检查文件或目录是否存在
|
|
8
|
+
*/
|
|
9
|
+
export declare function checkPathExists(targetPath: string): boolean;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.readFile = void 0;
|
|
7
|
+
exports.getAllFiles = getAllFiles;
|
|
8
|
+
exports.checkPathExists = checkPathExists;
|
|
9
|
+
var fs_1 = __importDefault(require("fs"));
|
|
10
|
+
var path_1 = __importDefault(require("path"));
|
|
11
|
+
var consola_1 = require("consola");
|
|
12
|
+
var readFile = function (path) {
|
|
13
|
+
return fs_1.default.readFileSync(path, 'utf-8');
|
|
14
|
+
};
|
|
15
|
+
exports.readFile = readFile;
|
|
16
|
+
/**
|
|
17
|
+
* 递归获取目录下所有 TypeScript 和 JavaScript 文件
|
|
18
|
+
*/
|
|
19
|
+
function getAllFiles(dirPath, arrayOfFiles, extensions) {
|
|
20
|
+
if (arrayOfFiles === void 0) { arrayOfFiles = []; }
|
|
21
|
+
if (extensions === void 0) { extensions = ['.ts', '.tsx', '.js', '.jsx']; }
|
|
22
|
+
if (!fs_1.default.existsSync(dirPath))
|
|
23
|
+
return arrayOfFiles;
|
|
24
|
+
var files = fs_1.default.readdirSync(dirPath);
|
|
25
|
+
files.forEach(function (file) {
|
|
26
|
+
var fullPath = path_1.default.join(dirPath, file);
|
|
27
|
+
if (fs_1.default.statSync(fullPath).isDirectory()) {
|
|
28
|
+
arrayOfFiles = getAllFiles(fullPath, arrayOfFiles, extensions);
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
if (extensions === null || extensions === void 0 ? void 0 : extensions.some(function (ext) { return fullPath.endsWith(ext); })) {
|
|
32
|
+
arrayOfFiles.push(fullPath);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
return arrayOfFiles;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* 检查文件或目录是否存在
|
|
40
|
+
*/
|
|
41
|
+
function checkPathExists(targetPath) {
|
|
42
|
+
if (!fs_1.default.existsSync(targetPath)) {
|
|
43
|
+
consola_1.consola.error("\u8DEF\u5F84\u4E0D\u5B58\u5728: ".concat(targetPath));
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
return true;
|
|
47
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "auto-cr-cmd",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"bin": {
|
|
8
|
+
"check": "./dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist"
|
|
12
|
+
],
|
|
13
|
+
"scripts": {
|
|
14
|
+
"build": "tsc",
|
|
15
|
+
"dev": "tsc --watch",
|
|
16
|
+
"start": "node dist/index.js",
|
|
17
|
+
"cli": "ts-node src/index.ts",
|
|
18
|
+
"prepublishOnly": "npm run build",
|
|
19
|
+
"format": "prettier --write src"
|
|
20
|
+
},
|
|
21
|
+
"keywords": [
|
|
22
|
+
"auto",
|
|
23
|
+
"cr",
|
|
24
|
+
"code",
|
|
25
|
+
"review"
|
|
26
|
+
],
|
|
27
|
+
"author": "wangweiwei",
|
|
28
|
+
"license": "MIT",
|
|
29
|
+
"sideEffects": false,
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@babel/core": "^7.28.4",
|
|
32
|
+
"auto-cr-rules": "1.0.9",
|
|
33
|
+
"commander": "^14.0.0",
|
|
34
|
+
"consola": "^3.4.2"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@babel/types": "^7.28.4",
|
|
38
|
+
"@eslint/js": "^9.35.0",
|
|
39
|
+
"@types/babel__core": "^7.20.5",
|
|
40
|
+
"@types/babel__traverse": "^7.28.0",
|
|
41
|
+
"@types/node": "^24.3.1",
|
|
42
|
+
"eslint": "^9.35.0",
|
|
43
|
+
"eslint-plugin-prettier": "^5.5.4",
|
|
44
|
+
"globals": "^16.3.0",
|
|
45
|
+
"jiti": "^2.5.1",
|
|
46
|
+
"prettier": "^3.6.2",
|
|
47
|
+
"ts-node": "^10.9.2",
|
|
48
|
+
"tslib": "^2.8.1",
|
|
49
|
+
"typescript": "^5.9.2",
|
|
50
|
+
"typescript-eslint": "^8.42.0"
|
|
51
|
+
},
|
|
52
|
+
"packageManager": "pnpm@10.15.1"
|
|
53
|
+
}
|