uetchy / create-create-app

⚡️ Create your own `create-something` app.
MIT License
96 stars 24 forks source link

fix: failed to copy template files on Windows #17

Closed MurakamiShinyu closed 4 years ago

MurakamiShinyu commented 4 years ago

I looked into the problem with Create Book not working on Windows (https://github.com/vivliostyle/create-book/issues/3) and found that it was caused by this problem on create-create-app.

  const templateFiles = await globby(args.templateDir, { dot: true });

On Windows, this globby(…) returns empty array [], so the templateFiles becomes empty and the template files are not copied to the target directory.

I found this problem occurs when the templateDir contains backslashes (Windows directory separator). So I put slash(…) to convert the backslash to slash, and this works fine:

  const templateFiles = await globby(slash(args.templateDir), { dot: true });

This seems a problem of fast-glob used in globby. Perhaps the following fast-glob issue is relevant: https://github.com/mrmlnc/fast-glob/issues/240

uetchy commented 4 years ago

@MurakamiShinyu Thank you for your contribution! Please add slash in package.json?

MurakamiShinyu commented 4 years ago

@uetchy

Please add slash in package.json?

ok, added.