Skip to content

Commit bffca9c

Browse files
committed
fix: only replace gitignore file
1 parent 6623b9b commit bffca9c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/template.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import fs from 'fs';
22
import globby from 'globby';
33
import Handlebars from 'handlebars';
44
import isUtf8 from 'is-utf8';
5-
import path from 'path';
5+
import path, { sep } from 'path';
66
import slash from 'slash';
77
import { v4 as uuidv4 } from 'uuid';
88
import { View } from '.';
@@ -91,7 +91,7 @@ export async function copy(args: CopyConfig) {
9191
const targetPath = format(
9292
slash(path.resolve(args.packageDir, relativePath)),
9393
args.view
94-
).replace(/gitignore$/, '.gitignore'); // https://github.com/uetchy/create-create-app/issues/38
94+
).replace(new RegExp(`${sep}gitignore$`, 'g'), `${sep}.gitignore`); // https://github.com/uetchy/create-create-app/issues/38
9595
prepareDirectory(targetPath);
9696

9797
let sourceData = fs.readFileSync(sourcePath);

0 commit comments

Comments
 (0)