flu-cli 0.0.2 → 0.0.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.
@@ -1,66 +1,80 @@
1
1
  /**
2
- * Flutter项目创建模块
2
+ * Flutter项目创建器模块
3
3
  *
4
- * 负责执行flutter create命令创建新项目
4
+ * 负责执行Flutter官方命令行工具创建新项目,处理不同项目类型的创建参数
5
+ * 支持应用、模块、包和插件等多种项目类型,并处理Flutter SDK路径配置
5
6
  */
6
7
 
7
- const { exec } = require('child_process');
8
- const path = require('path');
9
- const { printColored } = require('./utils');
10
- const os = require('os');
11
- const { console } = require('inspector');
8
+ import { exec } from 'child_process';
9
+ import { printColored } from './utils.js';
12
10
 
13
11
  /**
14
- * 使用flutter create命令创建新项目
12
+ * 执行flutter create命令创建新项目
15
13
  *
16
- * @param {string} targetDir - 目标目录路径
14
+ * 根据提供的参数调用Flutter SDK的create命令,创建指定类型的Flutter项目
15
+ * 支持自定义Flutter SDK路径,处理不同操作系统下的命令格式差异
16
+ *
17
+ * @param {string} targetDir - 项目创建目标目录绝对路径
17
18
  * @param {string} projectName - 项目名称
18
- * @param {string} packageName - 包名
19
- * @param {string} projectType - 项目类型 ('app'-应用, 'module'-模块)
20
- * @returns {Promise<boolean>} 是否创建成功
19
+ * @param {string} packageName - 应用包名(Android)或Bundle ID(iOS)
20
+ * @param {string} projectType - 项目类型,可选值:'app', 'module', 'package', 'plugin'
21
+ * @param {string} [flutterSdkPath='flutter'] - Flutter SDK路径,默认为系统环境变量中的'flutter'
22
+ * @returns {Promise<boolean>} 创建成功返回true,失败返回false
21
23
  */
22
- async function runFlutterCreate (targetDir, projectName, packageName, projectType = 'app', flutterSdkPath = 'flutter') {
24
+ async function runFlutterCreate (targetDir, projectName, packageName, projectType, flutterSdkPath = 'flutter') {
23
25
  return new Promise((resolve) => {
24
- printColored(`正在创建Flutter项目: ${flutterSdkPath}`, 'green');
25
- try {
26
- // 确保路径是绝对路径
27
- targetDir = path.resolve(targetDir);
28
- let flutterCmd = flutterSdkPath;
29
- if (flutterSdkPath !== 'flutter') {
30
- flutterCmd = path.join(flutterSdkPath, 'bin', 'flutter');
31
- printColored(`使用自定义Flutter SDK路径: ${flutterCmd}`, 'yellow');
32
- }
33
- // 构建命令参数
34
- const orgName = packageName.split('.').slice(0, -1).join('.');
35
- let command = `${flutterCmd} create --org ${orgName} --project-name ${projectName}`;
36
- // 根据项目类型添加参数
37
- if (projectType === 'module') {
26
+ // 构建flutter create命令参数
27
+ let command = `${flutterSdkPath} create`;
28
+
29
+ // 根据项目类型添加参数
30
+ switch (projectType) {
31
+ case 'module':
38
32
  command += ' --template=module';
39
- }
40
- // 添加目标目录
41
- command += ` "${targetDir}"`;
42
- // 执行命令
43
- exec(command, (error, stdout, stderr) => {
44
- if (error) {
45
- printColored(`创建Flutter项目失败: ${error.message}`, 'red');
46
- printColored("请确保Flutter已正确安装并添加到系统PATH中", 'yellow');
47
- printColored("可以尝试在命令行中运行'flutter doctor'检查Flutter安装状态", 'yellow');
48
- resolve(false);
49
- return;
50
- }
33
+ break;
34
+ case 'package':
35
+ command += ' --template=package';
36
+ break;
37
+ case 'plugin':
38
+ command += ' --template=plugin';
39
+ break;
40
+ case 'app':
41
+ default:
42
+ // 默认创建应用项目
43
+ break;
44
+ }
45
+
46
+ // 添加包名参数
47
+ command += ` --org ${packageName}`;
48
+
49
+ // 添加项目名称和目标路径
50
+ command += ` --project-name ${projectName} ${targetDir}`;
51
51
 
52
- if (stderr) {
53
- printColored(`警告: ${stderr}`, 'yellow');
54
- }
52
+ printColored(`执行命令: ${command}`, 'blue');
55
53
 
56
- printColored("Flutter项目创建成功!", 'green');
54
+ // 执行命令
55
+ exec(command, (error, stdout, stderr) => {
56
+ // 输出命令执行过程信息
57
+ if (stdout) printColored(stdout, 'gray');
58
+ if (stderr) printColored(stderr, 'yellow');
59
+
60
+ // 处理错误
61
+ if (error) {
62
+ printColored(`Flutter项目创建失败: ${error.message}`, 'red');
63
+ resolve(false);
64
+ return;
65
+ }
66
+
67
+ // 验证是否包含成功信息
68
+ if (stdout.includes('All done!') || stdout.includes('Created project')) {
69
+ printColored(`Flutter ${projectType}项目创建成功`, 'green');
57
70
  resolve(true);
58
- });
59
- } catch (e) {
60
- printColored(`创建Flutter项目时发生未知错误: ${e.message}`, 'red');
61
- resolve(false);
62
- }
71
+ } else {
72
+ printColored('Flutter项目创建未检测到成功标志', 'yellow');
73
+ resolve(false);
74
+ }
75
+ });
63
76
  });
64
77
  }
65
78
 
66
- module.exports = { runFlutterCreate };
79
+ export { runFlutterCreate };
80
+
package/lib/libCopier.js CHANGED
@@ -6,11 +6,13 @@
6
6
  * 支持创建packages目录并克隆常用库
7
7
  */
8
8
 
9
- const fs = require('fs-extra');
10
- const path = require('path');
11
- const os = require('os');
12
- const { exec } = require('child_process');
13
- const { printColored } = require('./utils');
9
+ import fsExtra from 'fs-extra'
10
+ const { mkdtempSync, existsSync, removeSync, readFileSync, writeFileSync, ensureDirSync, copySync, readdirSync, statSync } = fsExtra;
11
+ import { join } from 'path';
12
+ import { tmpdir } from 'os';
13
+ import { exec } from 'child_process';
14
+ import { printColored } from './utils.js';
15
+
14
16
 
15
17
  /**
16
18
  * 从Git仓库克隆代码到临时目录
@@ -23,7 +25,7 @@ async function cloneGitRepo (gitUrl, branch = 'master') {
23
25
  return new Promise((resolve) => {
24
26
  try {
25
27
  // 创建临时目录
26
- const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'flutter-cli-'));
28
+ const tempDir = mkdtempSync(join(tmpdir(), 'flutter-cli-'));
27
29
  printColored(`正在从Git仓库克隆代码到临时目录: ${tempDir}`, 'blue');
28
30
 
29
31
  // 克隆指定分支的代码
@@ -32,8 +34,8 @@ async function cloneGitRepo (gitUrl, branch = 'master') {
32
34
  exec(command, (error, stdout, stderr) => {
33
35
  if (error) {
34
36
  printColored(`Git仓库克隆失败: ${error.message}`, 'red');
35
- if (fs.existsSync(tempDir)) {
36
- fs.removeSync(tempDir);
37
+ if (existsSync(tempDir)) {
38
+ removeSync(tempDir);
37
39
  }
38
40
  resolve(null);
39
41
  return;
@@ -55,15 +57,15 @@ async function cloneGitRepo (gitUrl, branch = 'master') {
55
57
  *
56
58
  * @param {string} sourceDir - 源目录路径
57
59
  * @param {string} targetDir - 目标目录路径
58
- * @param {string} projectName - 项目名称
59
- * @param {string} projectType - 项目类型
60
- * @param {string} templateType - 模板类型
60
+ * @param {string} projectName - 项目名称
61
+ * @param {string} projectType - 项目类型 ('app'或'module')
62
+ * @param {string} templateType - 模板类型 ('only','min','normal','pro')
61
63
  * @param {string} packageName - 包名
62
64
  * @param {string} branch - Git分支
63
65
  * @param {string} gitUrl - Git仓库URL
64
66
  * @returns {Promise<boolean>} 是否复制成功
65
67
  */
66
- async function copyLibDirectory (
68
+ export async function copyLibDirectory (
67
69
  sourceDir,
68
70
  targetDir,
69
71
  projectName,
@@ -71,7 +73,7 @@ async function copyLibDirectory (
71
73
  templateType,
72
74
  packageName,
73
75
  branch = 'master',
74
- gitUrl = 'https://gitee.com/hot_night/hzy_original_project.git',
76
+ gitUrl = 'https://gitee.com/tengteng_fan/hzy_basic_project.git',
75
77
  ) {
76
78
  try {
77
79
  // 如果提供了gitUrl,从Git仓库获取代码
@@ -83,31 +85,46 @@ async function copyLibDirectory (
83
85
  }
84
86
  sourceDir = tempDir;
85
87
  }
86
-
87
88
  try {
88
89
  // 复制pubspec.yaml
89
90
  // 源目录路径拼接pubspec.yaml文件名
90
- const pubspecSource = path.join(sourceDir, 'pubspec.yaml');
91
+ const pubspecSource = join(sourceDir, 'pubspec.yaml');
91
92
  // 目标目录路径拼接pubspec.yaml文件名
92
- const pubspecTarget = path.join(targetDir, 'pubspec.yaml');
93
+ const pubspecTarget = join(targetDir, 'pubspec.yaml');
93
94
  // 确保目标目录存在
94
- if (fs.existsSync(pubspecSource)) {
95
+ if (existsSync(pubspecSource)) {
95
96
  printColored("正在复制并处理pubspec.yaml...", 'blue');
96
97
 
97
98
  // 读取源文件内容
98
- let sourceContent = fs.readFileSync(pubspecSource, 'utf8');
99
+ let sourceContent = readFileSync(pubspecSource, 'utf8');
99
100
 
100
101
  // 提取dependencies部分
101
102
  let dependenciesContent = 'dependencies:\n';
102
- const dependenciesMatch = sourceContent.match(/dependencies:[\s\S]*?(?=\n\s*dev_dependencies:)/);
103
+ const dependenciesRegex = /dependencies:[\s\S]*?(?=\n\s*dev_dependencies:)/;
104
+ const dependenciesMatch = sourceContent.match(dependenciesRegex);
103
105
  if (dependenciesMatch) {
104
106
  dependenciesContent = dependenciesMatch[0];
105
107
  }
106
108
 
109
+ // 提取assets部分
110
+ let assetsContent = '';
111
+ let assetsRegex = '';
112
+ if (projectType == 'app') {
113
+ assetsRegex = / uses-material-design: true[\s\S]*/;
114
+ } else if (projectType == 'module') {
115
+ assetsRegex = / uses-material-design: true[\s\S]*?(?=\n\s*module:)/;
116
+ }
117
+ const assetsMatch = sourceContent.match(/ uses-material-design: true[\s\S]*/);
118
+ if (assetsMatch) {
119
+ printColored("正在提取assets部分...", 'blue');
120
+ printColored("assetsMatch[0]: " + assetsMatch, 'blue');
121
+ assetsContent = assetsMatch[0];
122
+ }
123
+
107
124
  // 读取目标文件内容
108
125
  let targetContent = '';
109
- if (fs.existsSync(pubspecTarget)) {
110
- targetContent = fs.readFileSync(pubspecTarget, 'utf8');
126
+ if (existsSync(pubspecTarget)) {
127
+ targetContent = readFileSync(pubspecTarget, 'utf8');
111
128
  }
112
129
 
113
130
  // 替换项目名称和描述
@@ -125,134 +142,68 @@ async function copyLibDirectory (
125
142
  }
126
143
 
127
144
  // 替换dependencies部分
128
- const dependenciesRegex = /dependencies:[\s\S]*?(?=\n\s*dev_dependencies:)/;
129
145
  if (targetContent.match(dependenciesRegex)) {
130
146
  targetContent = targetContent.replace(dependenciesRegex, dependenciesContent);
131
147
  } else {
132
148
  // 如果没有找到dependencies部分,添加到文件末尾
133
149
  targetContent += '\n' + dependenciesContent;
134
150
  }
151
+ if (targetContent.match(assetsRegex)) {
152
+ targetContent = targetContent.replace(assetsRegex, assetsContent);
153
+ } else {
154
+ // 如果没有找到assets部分,添加到文件末尾
155
+ targetContent += '\n' + assetsContent;
156
+ }
135
157
 
136
158
  // 写入目标文件
137
- fs.writeFileSync(pubspecTarget, targetContent, 'utf8');
159
+ writeFileSync(pubspecTarget, targetContent, 'utf8');
138
160
  }
139
161
 
140
162
  // 复制lib目录
141
- const libSource = path.join(sourceDir, 'lib');
142
- const libTarget = path.join(targetDir, 'lib');
163
+ const libSource = join(sourceDir, 'lib');
164
+ const libTarget = join(targetDir, 'lib');
143
165
 
144
- if (fs.existsSync(libSource)) {
166
+ if (existsSync(libSource)) {
145
167
  printColored("正在复制lib目录...", 'blue');
146
168
 
147
169
  // 确保目标lib目录存在
148
- fs.ensureDirSync(libTarget);
170
+ ensureDirSync(libTarget);
149
171
 
150
172
  // 复制lib目录内容
151
- fs.copySync(libSource, libTarget, {
173
+ copySync(libSource, libTarget, {
152
174
  overwrite: true,
153
175
  filter: (src) => {
154
176
  // 可以在这里添加过滤逻辑,例如排除某些文件
155
177
  return true;
156
178
  }
157
179
  });
158
-
159
-
160
180
  }
161
181
 
162
182
  // 复制assets目录(如果存在)
163
- const assetsSource = path.join(sourceDir, 'assets');
164
- const assetsTarget = path.join(targetDir, 'assets');
165
-
166
- if (fs.existsSync(assetsSource)) {
183
+ const assetsSource = join(sourceDir, 'assets');
184
+ const assetsTarget = join(targetDir, 'assets');
185
+ if (existsSync(assetsSource)) {
167
186
  printColored("正在复制assets目录...", 'blue');
168
- fs.copySync(assetsSource, assetsTarget, { overwrite: true });
169
- }
170
-
171
- // 复制.vscode目录(如果存在)
172
- const vscodeSource = path.join(sourceDir, '.vscode');
173
- const vscodeTarget = path.join(targetDir, '.vscode');
174
-
175
- if (fs.existsSync(vscodeSource)) {
176
- printColored("正在复制.vscode目录...", 'blue');
177
- fs.copySync(vscodeSource, vscodeTarget, { overwrite: true });
187
+ copySync(assetsSource, assetsTarget, { overwrite: true });
178
188
  }
179
-
180
-
181
- /**
182
- * 待定: 暂时使用本地packages目录,里面的内容通过git clone 下载在package文件里.
183
- * 后续会增加功能选项.根据用户选择使用本地packages目录,
184
- * 还是直接在pubspec.yaml中添加依赖.
185
- */
186
-
187
- // 创建packages目录
188
- const packagesDir = path.join(targetDir, 'packages');
189
-
190
- // 如果packages目录存在,先删除
191
- if (fs.existsSync(packagesDir)) {
192
- printColored("删除已存在的packages目录...", 'blue');
193
- fs.removeSync(packagesDir);
194
- }
195
-
196
- // 重新创建packages目录
197
- printColored("创建packages目录...", 'blue');
198
- fs.ensureDirSync(packagesDir);
199
-
200
- // 克隆常用库到packages目录
201
- printColored("正在克隆常用库到packages目录...", 'blue');
202
-
203
- // 定义克隆仓库的Promise函数
204
- const cloneRepo = (repoUrl, targetDir, repoName) => {
205
- return new Promise((resolve) => {
206
- const command = `git clone ${repoUrl} "${targetDir}"`;
207
- exec(command, (error, stdout, stderr) => {
208
- if (error) {
209
- printColored(`克隆${repoName}库失败: ${error.message}`, 'yellow');
210
- resolve(false);
211
- } else {
212
- printColored(`克隆${repoName}库成功!`, 'green');
213
- resolve(true);
214
- }
215
- });
216
- });
217
- };
218
-
219
- // 并行克隆两个仓库
220
- const toolRepoUrl = 'https://gitee.com/hot_night/hzy_normal_tool.git';
221
- const networkRepoUrl = 'https://gitee.com/hot_night/hzy_normal_network.git';
222
- let proArr = [];
223
- if (templateType === '0') {
224
- proArr = [
225
- cloneRepo(toolRepoUrl, path.join(packagesDir, 'hzy_normal_tool'), 'hzy_normal_tool'),
226
- ];
227
- } else {
228
- proArr = [
229
- cloneRepo(toolRepoUrl, path.join(packagesDir, 'hzy_normal_tool'), 'hzy_normal_tool'),
230
- cloneRepo(networkRepoUrl, path.join(packagesDir, 'hzy_normal_network'), 'hzy_normal_network')
231
- ];
232
- }
233
- // 等待两个仓库克隆完成
234
- await Promise.all(proArr);
235
-
236
-
237
-
238
- printColored("packages目录克隆完成!", 'green');
239
-
240
189
  // 复制test目录 (如果存在)
241
- const testSource = path.join(sourceDir, 'test');
242
- const testTarget = path.join(targetDir, 'test');
243
- if (fs.existsSync(testSource)) {
190
+ const testSource = join(sourceDir, 'test');
191
+ const testTarget = join(targetDir, 'test');
192
+ if (existsSync(testSource)) {
244
193
  printColored("正在复制test目录...", 'blue');
245
- fs.copySync(testSource, testTarget, { overwrite: true });
194
+ copySync(testSource, testTarget, { overwrite: true });
246
195
  }
247
196
  // 全局替换包名和项目名称
248
197
  processLibFiles(libTarget, packageName, projectName);
198
+ printColored("正在处理替换lib文件项目名称...", 'blue');
249
199
  processLibFiles(testTarget, packageName, projectName);
200
+ printColored("正在处理test目录文件项目名称...", 'blue');
250
201
  printColored("项目模板复制完成!", 'green');
251
202
  return true;
252
203
  } finally {
253
204
  // 清理临时目录
254
- if (tempDir && fs.existsSync(tempDir)) {
255
- fs.removeSync(tempDir);
205
+ if (tempDir && existsSync(tempDir)) {
206
+ removeSync(tempDir);
256
207
  }
257
208
  }
258
209
  } catch (e) {
@@ -261,6 +212,120 @@ async function copyLibDirectory (
261
212
  }
262
213
  }
263
214
 
215
+
216
+ /**
217
+ * 复制vscode配置文件
218
+ *
219
+ * @param {string} targetDir - 目标目录路径
220
+ */
221
+ export async function copyVscode (targetDir) {
222
+
223
+ /**
224
+ * 第一步:创建.vscode 文件夹.
225
+ * - 配置.vscode 文件夹的路径.
226
+ *
227
+ * - 如果.vscode 目录存在,先删除
228
+ * - 重新创建 .vscode 目录
229
+ * 第二步: 克隆 vscode_config 仓库代码到.vscode 目录
230
+ * - 从https://gitee.com/tengteng_fan/vscode_config.git仓库克隆代码到临时目录,
231
+ * - 获取临时文件夹中的flutter_vscode文件夹里面的文件
232
+ * - 复制到 .vscode 目录中.
233
+ */
234
+
235
+ // 定义.vscode 目录路径
236
+ const vscodeDir = join(targetDir, '.vscode')
237
+
238
+ if (existsSync(vscodeDir)) {
239
+ printColored("删除已存在的.vscode目录...", 'blue');
240
+ removeSync(vscodeDir);
241
+ }
242
+ printColored("创建.vscode目录...", 'blue');
243
+ ensureDirSync(vscodeDir);
244
+ printColored("克隆vscode_config仓库代码到.vscode目录...", 'blue');
245
+
246
+ const vscodeConfigRepoUrl = 'https://gitee.com/tengteng_fan/vscode_config.git';
247
+ // 配置 vscode_config 临时文件夹
248
+ const tempDir = await cloneGitRepo(vscodeConfigRepoUrl);
249
+ printColored("vscode_config 仓库代码克隆完成...", 'blue');
250
+ // 打印临时目录路径
251
+ printColored(`临时目录路径: ${tempDir}`, 'blue');
252
+ // 定义 vscode_config 目录路径
253
+ const vscodeConfigDir = join(tempDir, 'flutter_vscode');
254
+ // 打印 vscode_config 目录路径
255
+ printColored(`vscode_config 目录路径: ${vscodeConfigDir}`, 'blue');
256
+ // 复制 vscode_config 目录内容到 .vscode 目录
257
+ copySync(vscodeConfigDir, vscodeDir, { overwrite: true });
258
+
259
+ // 清理临时目录
260
+ if (tempDir && existsSync(tempDir)) {
261
+ removeSync(tempDir);
262
+ }
263
+ }
264
+
265
+ export async function copyPackages (targetDir) {
266
+ /**
267
+ * 待定: 暂时使用本地packages目录,里面的内容通过git clone 下载在package文件里.
268
+ * 后续会增加功能选项.根据用户选择使用本地packages目录,
269
+ * 还是直接在pubspec.yaml中添加依赖.
270
+ */
271
+
272
+ // 创建packages目录
273
+ const packagesDir = join(targetDir, 'packages');
274
+
275
+ // 如果packages目录存在,先删除
276
+ if (existsSync(packagesDir)) {
277
+ printColored("删除已存在的packages目录...", 'blue');
278
+ removeSync(packagesDir);
279
+ }
280
+
281
+ // 重新创建packages目录
282
+ printColored("创建packages目录...", 'blue');
283
+ ensureDirSync(packagesDir);
284
+
285
+ // 克隆常用库到packages目录
286
+ printColored("正在克隆常用库到packages目录...", 'blue');
287
+
288
+
289
+
290
+ // 并行克隆两个仓库
291
+ const toolRepoUrl = 'https://gitee.com/hot_night/hzy_normal_tool.git';
292
+ const networkRepoUrl = 'https://gitee.com/hot_night/hzy_normal_network.git';
293
+ let proArr = [];
294
+ if (templateType === '0') {
295
+ proArr = [
296
+ cloneRepo(toolRepoUrl, join(packagesDir, 'hzy_normal_tool'), 'hzy_normal_tool'),
297
+ ];
298
+ } else {
299
+ proArr = [
300
+ cloneRepo(toolRepoUrl, join(packagesDir, 'hzy_normal_tool'), 'hzy_normal_tool'),
301
+ cloneRepo(networkRepoUrl, join(packagesDir, 'hzy_normal_network'), 'hzy_normal_network')
302
+ ];
303
+ }
304
+ // 等待两个仓库克隆完成
305
+ await Promise.all(proArr);
306
+
307
+
308
+
309
+ printColored("packages目录克隆完成!", 'green');
310
+ }
311
+
312
+ // 定义克隆仓库的Promise函数
313
+ const cloneRepo = (repoUrl, targetDir, repoName) => {
314
+ return new Promise((resolve) => {
315
+ const command = `git clone ${repoUrl} "${targetDir}"`;
316
+ exec(command, (error, stdout, stderr) => {
317
+ if (error) {
318
+ printColored(`克隆${repoName}库失败: ${error.message}`, 'yellow');
319
+ resolve(false);
320
+ } else {
321
+ printColored(`克隆${repoName}库成功!`, 'green');
322
+ resolve(true);
323
+ }
324
+ });
325
+ });
326
+ };
327
+
328
+
264
329
  /**
265
330
  * 处理lib目录中的文件,替换包名等
266
331
  *
@@ -271,26 +336,26 @@ function processLibFiles (targetDir, packageName, projectName) {
271
336
  try {
272
337
  // 递归处理目录中的所有文件
273
338
  const processDir = (dir) => {
274
- const files = fs.readdirSync(dir);
339
+ const files = readdirSync(dir);
275
340
 
276
341
  for (const file of files) {
277
- const filePath = path.join(dir, file);
278
- const stat = fs.statSync(filePath);
342
+ const filePath = join(dir, file);
343
+ const stat = statSync(filePath);
279
344
 
280
345
  if (stat.isDirectory()) {
281
346
  // 递归处理子目录
282
347
  processDir(filePath);
283
348
  } else if (stat.isFile() && (file.endsWith('.dart') || file.endsWith('.yaml'))) {
284
349
  // 处理dart和yaml文件
285
- let content = fs.readFileSync(filePath, 'utf8');
350
+ let content = readFileSync(filePath, 'utf8');
286
351
 
287
352
  // 替换packageName和projectName
288
- content = content.replace(/hzy_original_project/g, projectName);
353
+ content = content.replace(/hzy_basic_project/g, projectName);
289
354
  // 替换包名
290
- content = content.replace(/com\.example\.hzy_original_project/g, packageName);
355
+ content = content.replace(/com\.example\.hzy_basic_project/g, packageName);
291
356
 
292
357
  // 写回文件
293
- fs.writeFileSync(filePath, content, 'utf8');
358
+ writeFileSync(filePath, content, 'utf8');
294
359
  }
295
360
  }
296
361
  };
@@ -301,4 +366,3 @@ function processLibFiles (targetDir, packageName, projectName) {
301
366
  }
302
367
  }
303
368
 
304
- module.exports = { copyLibDirectory };