create-weapp-vite 2.0.65 → 2.0.66

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/dist/cli.js CHANGED
@@ -1,4 +1,4 @@
1
- import { n as TemplateName, t as createProject } from "./src-D7vAuXs8.js";
1
+ import { n as TemplateName, t as createProject } from "./src-s0htxdlk.js";
2
2
  import logger from "@weapp-core/logger";
3
3
  import fs from "fs-extra";
4
4
  import path from "node:path";
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import { n as TemplateName, t as createProject } from "./src-D7vAuXs8.js";
1
+ import { n as TemplateName, t as createProject } from "./src-s0htxdlk.js";
2
2
  export { TemplateName, createProject };
@@ -289,6 +289,10 @@ function resolveWorkspaceTemplateDir(templateName) {
289
289
  const templateDirName = TEMPLATE_DIR_MAP[templateName];
290
290
  return templateDirName ? path.resolve(moduleDir, "../../../templates", templateDirName) : path.resolve(moduleDir, "../../../templates", templateName);
291
291
  }
292
+ function normalizeTemplateRelativePath(relativePath) {
293
+ if (!relativePath || relativePath === ".") return "";
294
+ return relativePath.split("\\").join("/");
295
+ }
292
296
  async function resolveTemplateDirs(templateName) {
293
297
  const packagedTemplateDir = path.resolve(moduleDir, "../templates", templateName);
294
298
  const workspaceTemplateDir = resolveWorkspaceTemplateDir(templateName);
@@ -298,8 +302,10 @@ async function resolveTemplateDirs(templateName) {
298
302
  preferredTemplateDir: await fs.pathExists(packagedTemplateDir) ? packagedTemplateDir : workspaceTemplateDir
299
303
  };
300
304
  }
301
- function shouldSkipTemplateFile(filePath) {
302
- return filePath.includes("node_modules") || filePath.includes(`${path.sep}.weapp-vite${path.sep}`) || filePath.includes("vite.config.ts.timestamp") || filePath.includes(`${path.sep}dist${path.sep}`) || filePath.endsWith(`${path.sep}CHANGELOG.md`) || filePath.includes(`${path.sep}.turbo${path.sep}`) || filePath.endsWith(`${path.sep}.DS_Store`);
305
+ function shouldSkipTemplateFile(filePath, templateRoot) {
306
+ const relativePath = normalizeTemplateRelativePath(path.relative(templateRoot, filePath));
307
+ if (!relativePath) return false;
308
+ return relativePath === "node_modules" || relativePath.startsWith("node_modules/") || relativePath.includes("/node_modules/") || relativePath === ".weapp-vite" || relativePath.startsWith(".weapp-vite/") || relativePath.includes("/.weapp-vite/") || relativePath === "vite.config.ts.timestamp" || relativePath.endsWith("/vite.config.ts.timestamp") || relativePath === "dist" || relativePath.startsWith("dist/") || relativePath.includes("/dist/") || relativePath === "CHANGELOG.md" || relativePath.endsWith("/CHANGELOG.md") || relativePath === ".turbo" || relativePath.startsWith(".turbo/") || relativePath.includes("/.turbo/") || relativePath === ".DS_Store" || relativePath.endsWith("/.DS_Store");
303
309
  }
304
310
  function normalizeLines(value) {
305
311
  return value.replace(CRLF_RE, "\n").split("\n");
@@ -317,7 +323,7 @@ function mergeGitignoreSource(existing, template) {
317
323
  }
318
324
  async function copyTemplateDir(sourceDir, fallbackDir, targetDir) {
319
325
  const copyOptions = { filter(src) {
320
- return !shouldSkipTemplateFile(src);
326
+ return !shouldSkipTemplateFile(src, sourceDir);
321
327
  } };
322
328
  try {
323
329
  await fs.copy(sourceDir, targetDir, copyOptions);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "create-weapp-vite",
3
3
  "type": "module",
4
- "version": "2.0.65",
4
+ "version": "2.0.66",
5
5
  "description": "create-weapp-vite",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",