Skip to content

Commit

Permalink
For #389
Browse files Browse the repository at this point in the history
  • Loading branch information
haydenbleasel committed Jan 12, 2025
1 parent e88520f commit e8d9dd9
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions scripts/init.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ const { log } = console;

const url = 'https://github.com/haydenbleasel/next-forge';

// Escapes special characters in filenames that would cause issues in bash commands
// Adds backslash before: () [] {} ^ $ * + ? . | and \
const cleanFileName = (file) => file.replace(/([()[\]{}^$*+?.|\\])/g, '\\$1');
const cleanFileName = (file) => file.replace(/"/g, '\\"').replace(/\\/g, '/');

const execSyncOpts = { stdio: 'ignore' };

Expand Down Expand Up @@ -238,7 +236,7 @@ program

const hasChanged =
!fromFiles.includes(file) ||
execSync(`git diff ${from} ${to} -- ${cleanFileName(file)}`)
execSync(`git diff ${from} ${to} -- "${cleanFileName(file)}"`)
.toString()
.trim() !== '';

Expand Down

0 comments on commit e8d9dd9

Please sign in to comment.