Skip to content

Commit

Permalink
fix ci
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari committed Sep 14, 2023
1 parent 1493419 commit a01f7b7
Showing 1 changed file with 0 additions and 32 deletions.
32 changes: 0 additions & 32 deletions packages/rsc-builder/buildRsc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,21 +73,6 @@ async function processFile(
await fse.writeFile(filename, newContents);
}

function getIndexFile(directory: string) {
const items = fse.readdirSync(directory);

const indexFile = items.reduce((prev, curr) => {
if (!/^index.(js|ts)/.test(curr)) {
return prev;
}
return curr;
}, '');

return {
filename: path.join(directory, indexFile),
};
}

async function findAll(
directories: string[],
grep: RegExp | null,
Expand Down Expand Up @@ -124,24 +109,11 @@ async function run(argv: yargs.ArgumentsCamelCase<CommandOptions>) {
];
}

const indexFile = getIndexFile(projectSrc);

try {
processFile(indexFile.filename);
} catch (error: any) {
error.message = `${path.relative(process.cwd(), indexFile.filename)}: ${error.message}`;
throw error;
}

const components = await findAll(directories, grep, findComponents);

components.forEach(async (component) => {
try {
processFile(component.filename);

if (component.indexFilename) {
processFile(component.indexFilename);
}
} catch (error: any) {
error.message = `${path.relative(process.cwd(), component.filename)}: ${error.message}`;
throw error;
Expand All @@ -153,10 +125,6 @@ async function run(argv: yargs.ArgumentsCamelCase<CommandOptions>) {
hooks.forEach(async (hook) => {
try {
processFile(hook.filename);

if (hook.indexFilename) {
processFile(hook.indexFilename);
}
} catch (error: any) {
error.message = `${path.relative(process.cwd(), hook.filename)}: ${error.message}`;
throw error;
Expand Down

0 comments on commit a01f7b7

Please sign in to comment.