Skip to content

Commit

Permalink
Fix missing gitignore in create recipes (#969)
Browse files Browse the repository at this point in the history
Be default, npm will exclude `.gitignore` files when packing for
publication, so add a little special casing here.
  • Loading branch information
scotttrinh authored Apr 17, 2024
1 parent 1512b94 commit 8aea770
Show file tree
Hide file tree
Showing 9 changed files with 3 additions and 1 deletion.
Empty file modified packages/create/src/cli.ts
100644 → 100755
Empty file.
4 changes: 3 additions & 1 deletion packages/create/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ async function _walkDir(
await fs.mkdir(dest, { recursive: true });
const trueFilepath = path.join(source, file.entry.name);
const untaggedFilepath = path.join(untaggedSource, filename);
const destFilepath = path.join(dest, filename);
// n.b. special handling to avoid npm publishing from excluding .gitignore
const destFilename = filename === "gitignore" ? ".gitignore" : filename;
const destFilepath = path.join(dest, destFilename);

if (opts.injectVars[untaggedFilepath]) {
let content = await fs.readFile(trueFilepath, { encoding: "utf8" });
Expand Down

0 comments on commit 8aea770

Please sign in to comment.