create-tengits-app 1.1.2 → 1.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/bin/cli.js +15 -12
- package/package.json +1 -1
- package/packages/docs/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -191,7 +191,6 @@ const createProject = async () => {
|
|
|
191
191
|
const excludeList = [
|
|
192
192
|
'node_modules',
|
|
193
193
|
'.git',
|
|
194
|
-
'bin',
|
|
195
194
|
'pnpm-lock.yaml',
|
|
196
195
|
'.DS_Store',
|
|
197
196
|
'yarn.lock',
|
|
@@ -200,7 +199,8 @@ const createProject = async () => {
|
|
|
200
199
|
|
|
201
200
|
// 需要保留的文件(即使在其他排除列表中)
|
|
202
201
|
const keepFiles = [
|
|
203
|
-
'bin/setup-ttos.js'
|
|
202
|
+
'bin/setup-ttos.js',
|
|
203
|
+
'.gitignore'
|
|
204
204
|
];
|
|
205
205
|
|
|
206
206
|
// 复制模板文件
|
|
@@ -208,20 +208,22 @@ const createProject = async () => {
|
|
|
208
208
|
|
|
209
209
|
const copyRecursive = (src, dest) => {
|
|
210
210
|
const stats = fs.statSync(src);
|
|
211
|
-
|
|
211
|
+
|
|
212
212
|
if (stats.isDirectory()) {
|
|
213
213
|
const dirName = path.basename(src);
|
|
214
|
-
|
|
215
|
-
return;
|
|
216
|
-
}
|
|
217
|
-
|
|
214
|
+
|
|
218
215
|
fs.ensureDirSync(dest);
|
|
219
216
|
const files = fs.readdirSync(src);
|
|
220
|
-
|
|
217
|
+
|
|
221
218
|
files.forEach(file => {
|
|
222
219
|
const relativePath = path.relative(templateDir, path.join(src, file));
|
|
223
220
|
const shouldKeep = keepFiles.some(keepFile => relativePath === keepFile);
|
|
224
|
-
|
|
221
|
+
|
|
222
|
+
// 对于bin目录,只复制setup-ttos.js文件
|
|
223
|
+
if (dirName === 'bin' && file === 'cli.js') {
|
|
224
|
+
return; // 跳过cli.js文件
|
|
225
|
+
}
|
|
226
|
+
|
|
225
227
|
if (!excludeList.includes(file) || shouldKeep) {
|
|
226
228
|
copyRecursive(path.join(src, file), path.join(dest, file));
|
|
227
229
|
}
|
|
@@ -236,9 +238,10 @@ const createProject = async () => {
|
|
|
236
238
|
templateFiles.forEach(file => {
|
|
237
239
|
if (file !== 'packages') {
|
|
238
240
|
const relativePath = path.relative(templateDir, path.join(templateDir, file));
|
|
239
|
-
const shouldKeep = keepFiles.some(keepFile => relativePath
|
|
240
|
-
|
|
241
|
-
|
|
241
|
+
const shouldKeep = keepFiles.some(keepFile => relativePath === keepFile);
|
|
242
|
+
|
|
243
|
+
// 对于bin目录和.gitignore文件,总是复制
|
|
244
|
+
if (file === 'bin' || file === '.gitignore' || !excludeList.includes(file) || shouldKeep) {
|
|
242
245
|
const srcPath = path.join(templateDir, file);
|
|
243
246
|
const destPath = path.join(targetDir, file);
|
|
244
247
|
copyRecursive(srcPath, destPath);
|
package/package.json
CHANGED