mirror of
https://github.com/zrwusa/data-structure-typed.git
synced 2025-01-18 11:14:05 +00:00
fix: Skip writing when the ci process cannot read the subpackages directory.
This commit is contained in:
parent
c3122e7fc7
commit
e4ebf5fae1
|
@ -254,7 +254,14 @@ function updateExamples(testDir: string, sourceBaseDir: string): void {
|
|||
* Replace content between markers in README.md.
|
||||
*/
|
||||
function replaceExamplesInReadme(readmePath: string, newExamples: string[]): void {
|
||||
const readmeContent = fs.readFileSync(readmePath, 'utf-8');
|
||||
let readmeContent: string;
|
||||
|
||||
try {
|
||||
readmeContent = fs.readFileSync(readmePath, 'utf-8');
|
||||
} catch (error) {
|
||||
console.warn(`Failed to read ${fileName} at ${readmePath}: ${error}`);
|
||||
return;
|
||||
}
|
||||
|
||||
const startIdx = readmeContent.indexOf(START_MARKER);
|
||||
const endIdx = readmeContent.indexOf(END_MARKER);
|
||||
|
@ -269,7 +276,7 @@ function replaceExamplesInReadme(readmePath: string, newExamples: string[]): voi
|
|||
const updatedContent = `${before}\n\n${newExamples.join('\n\n')}\n\n${after}`;
|
||||
fs.writeFileSync(readmePath, updatedContent, 'utf-8');
|
||||
|
||||
console.log(`README.md updated with new examples.`);
|
||||
console.log(`${fileName} updated with new examples.`);
|
||||
}
|
||||
|
||||
// Run the script
|
||||
|
|
Loading…
Reference in a new issue