This repository has been archived by the owner on Feb 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
28 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,8 +43,8 @@ export const sync = async () => { | |
'website', | ||
'https://github.com/codemod-com/website.git', | ||
); | ||
await git.addConfig('user.email', '[email protected]', false, 'local'); | ||
await git.addConfig('user.name', 'Intuita Team', false, 'local'); | ||
await git.addConfig('user.email', '[email protected]', false, 'local'); | ||
await git.addConfig('user.name', 'codemod.com', false, 'local'); | ||
|
||
await git.fetch(['website', 'master']); | ||
await git.fetch(['origin', 'main', '--depth=2']); | ||
|
@@ -94,7 +94,13 @@ export const sync = async () => { | |
continue; | ||
} | ||
|
||
const parsedNewFile = parse(newFile); | ||
let parsedNewFile: ReturnType<typeof parse>; | ||
try { | ||
parsedNewFile = parse(newFile); | ||
} catch (err) { | ||
console.error(`Could not parse new README file under ${path}`); | ||
continue; | ||
} | ||
const newFileShortDescription = parsedNewFile.description | ||
.split('\n') | ||
.at(0); | ||
|
@@ -133,10 +139,14 @@ export const sync = async () => { | |
// the fields just like any other JS object, to perform the comparison. | ||
// Not using valibot's safeParse, because we can just error if that's not an object and we don't care | ||
// about the fields to be of a specific type. | ||
const oldContent = valibotParse( | ||
record(any()), | ||
yaml.load(convertToYaml(parse(oldFile), path)), | ||
); | ||
let oldFileParsedYaml: unknown; | ||
try { | ||
oldFileParsedYaml = yaml.load(convertToYaml(parse(oldFile), path)); | ||
} catch (err) { | ||
console.error(`Could not parse old README file under ${path}`); | ||
continue; | ||
} | ||
const oldContent = valibotParse(record(any()), oldFileParsedYaml); | ||
const newContent = valibotParse( | ||
record(any()), | ||
yaml.load(newReadmeYamlContent), | ||
|