Skip to content

Commit

Permalink
fix: soft fail on error
Browse files Browse the repository at this point in the history
  • Loading branch information
Tofandel authored and tobias-93 committed Jul 4, 2023
1 parent c9f8d5e commit 0398dbd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Resources/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fos-router",
"version": "2.4.3",
"version": "2.4.6",
"description": "A pretty nice way to use the routes generated by the FOSJsRoutingBundle in your JavaScript.",
"keywords": [
"router",
Expand Down
21 changes: 13 additions & 8 deletions Resources/webpack/FosRouting.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,20 @@ class FosRouting {
return pass;
}, []);
await execFile(this.options.php, ['bin/console', 'fos:js-routing:dump', ...args]);
const content = await readFile(this.options.target);
await rmFile(this.options.target);
if (!prevContent || content.compare(prevContent) !== 0) {
await makeDir(path.dirname(this.finalTarget), {recursive: true});
await writeFile(this.finalTarget, content);
prevContent = content;
if (comp.modifiedFiles && !comp.modifiedFiles.has(this.finalTarget)) {
comp.modifiedFiles.add(this.finalTarget);
try {
const content = await readFile(this.options.target);
await rmFile(this.options.target);
if (!prevContent || content.compare(prevContent) !== 0) {
await makeDir(path.dirname(this.finalTarget), {recursive: true});
await writeFile(this.finalTarget, content);
prevContent = content;
if (comp.modifiedFiles && !comp.modifiedFiles.has(this.finalTarget)) {
comp.modifiedFiles.add(this.finalTarget);
}
}
} catch (e) {
const logger = compiler.getInfrastructureLogger('FosRouting');
logger.error(e.toString());
}
callback();
};
Expand Down

0 comments on commit 0398dbd

Please # to comment.