feima-shortcuts 0.1.2 → 0.1.4

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "feima-shortcuts",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "快捷指令",
5
5
  "main": "index.js",
6
6
  "directories": {
@@ -18,7 +18,7 @@ const postTemplate = (url, functionName) => {
18
18
  const fileData = (functionName, filePath) => {
19
19
  if (fs.existsSync(filePath)) {
20
20
  const data = fs.readFileSync(filePath, "utf8");
21
- if (data.includes(`export const ${functionName}`)) {
21
+ if (data.includes(`export const ${functionName} `)) {
22
22
  console.log(`⚠️ 函数名 ${functionName} 已存在,跳过生成`);
23
23
  return null;
24
24
  }
@@ -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
  };