neo-cmp-cli 1.5.0-beta.10 → 1.5.0-beta.11

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": "neo-cmp-cli",
3
- "version": "1.5.0-beta.10",
3
+ "version": "1.5.0-beta.11",
4
4
  "description": "前端脚手架:自定义组件开发工具,支持react 和 vue2.0技术栈。",
5
5
  "keywords": [
6
6
  "neo-cli",
@@ -115,9 +115,10 @@ const buildComponentData = async (assetsRoot, cmpInfo) => {
115
115
  try {
116
116
  // 加载自定义组件模型资源文件
117
117
  if (fs.existsSync(modelFile)) {
118
+ // 加载自定义组件模型资源文件
118
119
  let modelModule = require(modelFile);
119
120
  // 获取导出的模型类(可能是 default 导出或命名导出)
120
- CatchCustomCmpModelClass = modelModule.default || modelModule;
121
+ // const CatchCustomCmpModelClass = modelModule.default || modelModule;
121
122
  }
122
123
  else {
123
124
  console.error(`未找到自定义组件模型文件,请检查以下路径是否存在:`, modelFile);
@@ -169,11 +169,11 @@ yargs
169
169
  if (argv.name) {
170
170
  mainAction.createCmpProjectByTemplate(argv.name);
171
171
  } else {
172
- questions.push({
172
+ const questions = [{
173
173
  name: 'name',
174
174
  type: 'input',
175
175
  message: '请设置自定义组件项目名称:',
176
- });
176
+ }];
177
177
 
178
178
  inquirer.prompt(questions).then((ans) => {
179
179
  // 验证项目名称是否合法
@@ -187,7 +187,7 @@ yargs
187
187
  console.error(errors.join('\n'));
188
188
  process.exit(1);
189
189
  } else {
190
- mainAction.createCmpProjectByTemplate(argv.name);
190
+ mainAction.createCmpProjectByTemplate(ans.name);
191
191
  }
192
192
  });
193
193
  }
@@ -31,8 +31,8 @@ function replaceInFilesByMap(
31
31
  // 检查文件扩展名
32
32
  const ext = path.extname(file);
33
33
  if (fileExtensions.includes(ext)) {
34
-
35
34
  if (needReplaceStrMap &&Object.keys(needReplaceStrMap).length > 0) {
35
+ let content = fs.readFileSync(filePath, 'utf8');
36
36
  Object.keys(needReplaceStrMap).forEach((key) => {
37
37
  const oldStr = key;
38
38
  const newStr = needReplaceStrMap[key];
@@ -51,4 +51,4 @@ function replaceInFilesByMap(
51
51
  }
52
52
  }
53
53
 
54
- module.exports = replaceInFiles;
54
+ module.exports = replaceInFilesByMap;