Skip to content

Commit

Permalink
Using the regex instead of function
Browse files Browse the repository at this point in the history
  • Loading branch information
jaas666 committed Dec 3, 2023
1 parent ea7a31d commit c635d4e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
8 changes: 4 additions & 4 deletions src/steps/updateLocalFiles.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ describe("updateLocalFiles", () => {
"./.github/**/*",
"./*.*",
],
"from": /JoshuaKGoldberg/g,
"to": [Function],
"from": /JoshuaKGoldberg\\(\\?!\\\\/console-fail-test\\)\\(\\?!\\\\/all-contributors-auto-action\\)/g,
"to": "StubOwner",
},
],
[
Expand Down Expand Up @@ -234,8 +234,8 @@ describe("updateLocalFiles", () => {
"./.github/**/*",
"./*.*",
],
"from": /JoshuaKGoldberg/g,
"to": [Function],
"from": /JoshuaKGoldberg\\(\\?!\\\\/console-fail-test\\)\\(\\?!\\\\/all-contributors-auto-action\\)/g,
"to": "StubOwner",
},
],
[
Expand Down
12 changes: 2 additions & 10 deletions src/steps/updateLocalFiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,11 @@ export async function updateLocalFiles(options: Options) {
const existingPackage = ((await readFileSafeAsJson("./package.json")) ??
{}) as ExistingPackageData;

const excludedFromReplacements = [
"console-fail-test",
"all-contributors-auto-action",
];

const replacements = [
[/Create TypeScript App/g, options.title],
[
/JoshuaKGoldberg/g,
(match: string) =>
excludedFromReplacements.some((e) => match.includes(e))
? options.owner
: match,
/JoshuaKGoldberg(?!\/console-fail-test)(?!\/all-contributors-auto-action)/g,
options.owner,
],
[/create-typescript-app/g, options.repository],
[/\/\*\n.+\*\/\n\n/gs, ``, ".eslintrc.cjs"],
Expand Down

0 comments on commit c635d4e

Please sign in to comment.