feima-shortcuts 0.1.2 → 0.1.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/package.json
CHANGED
|
@@ -9,7 +9,7 @@ function toKebabCase(str) {
|
|
|
9
9
|
return str.replace(/([A-Z])/g, '-$1').toLowerCase();
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
const templateStr = ({fileName}) => {
|
|
12
|
+
const templateStr = ({ fileName }) => {
|
|
13
13
|
const className = toKebabCase(fileName);
|
|
14
14
|
|
|
15
15
|
return `<template>
|
|
@@ -19,7 +19,6 @@ const templateStr = ({fileName}) => {
|
|
|
19
19
|
:params="params"
|
|
20
20
|
:columns="columns"
|
|
21
21
|
:request="request"
|
|
22
|
-
style="max-width: 1000px"
|
|
23
22
|
>
|
|
24
23
|
<template #option="scopeData">
|
|
25
24
|
<el-table-column v-bind="scopeData">
|
|
@@ -129,15 +128,15 @@ exports.run = function (answers) {
|
|
|
129
128
|
process.chdir(makeDirPath);
|
|
130
129
|
|
|
131
130
|
const template = templateStr({ fileName });
|
|
132
|
-
|
|
131
|
+
|
|
133
132
|
const targetFilePath = `./${fileIndex}`;
|
|
134
133
|
|
|
135
|
-
|
|
134
|
+
// 新增:判断文件是否存在
|
|
136
135
|
if (fs.existsSync(targetFilePath)) {
|
|
137
136
|
console.log(`❌ 文件已存在:${targetFilePath},未进行覆盖操作。`);
|
|
138
137
|
return;
|
|
139
138
|
}
|
|
140
|
-
|
|
139
|
+
|
|
141
140
|
fs.writeFileSync(targetFilePath, template);
|
|
142
141
|
console.log(`✅ 文件创建成功`);
|
|
143
142
|
};
|