Skip to content

Commit c7b4ca9

Browse files
committed
chore: update version to 0.0.6 in package.json; refactor runCommand to be non-blocking in vite-plugin-laravel-localizer
1 parent 94ef861 commit c7b4ca9

File tree

2 files changed

+17
-16
lines changed

2 files changed

+17
-16
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@devwizard/laravel-localizer-react",
3-
"version": "0.0.5",
3+
"version": "0.0.6",
44
"type": "module",
55
"description": "React integration for Laravel Localizer with Vite plugin, useLocalizer hook, and automatic TypeScript generation",
66
"main": "dist/index.js",

src/vite-plugin-laravel-localizer.ts

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -57,20 +57,21 @@ export const laravelLocalizer = ({
5757
patterns = patterns.map((pattern) => pattern.replace(/\\/g, '/'));
5858

5959
/**
60-
* Execute the generation command
60+
* Execute the generation command (non-blocking)
6161
*/
62-
const runCommand = async (): Promise<void> => {
63-
try {
64-
if (debug) {
65-
context.info('Generating translation types...');
66-
}
67-
68-
await execAsync(command);
69-
70-
context.info('Translation types generated successfully');
71-
} catch (error) {
72-
context.error('Error generating translation types: ' + error);
62+
const runCommand = (): void => {
63+
if (debug) {
64+
context.info('Generating translation types...');
7365
}
66+
67+
// Run command without awaiting to prevent blocking
68+
execAsync(command)
69+
.then(() => {
70+
context.info('Translation types generated successfully');
71+
})
72+
.catch((error) => {
73+
context.error('Error generating translation types: ' + error);
74+
});
7475
};
7576

7677
return {
@@ -82,20 +83,20 @@ export const laravelLocalizer = ({
8283
*/
8384
buildStart() {
8485
context = this;
85-
return runCommand();
86+
runCommand();
8687
},
8788

8889
/**
8990
* Watch for changes in development mode
9091
*/
91-
async handleHotUpdate({ file, server }) {
92+
handleHotUpdate({ file, server }) {
9293
if (shouldRun(patterns, { file, server })) {
9394
if (debug) {
9495
const fileName = file.split('/').pop();
9596
context.info(`Detected change in ${fileName}`);
9697
}
9798

98-
await runCommand();
99+
runCommand();
99100
}
100101
},
101102
};

0 commit comments

Comments
 (0)