File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed
Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change 1010
1111# production
1212/build
13+ data /
1314
1415# debug
1516npm-debug.log *
Original file line number Diff line number Diff line change @@ -21,6 +21,18 @@ const MODULES = [
2121async function getData < T > (
2222 type : 'commands' | 'permissions' ,
2323) : Promise < Record < string , T > > {
24+ if ( process . env . NODE_ENV === 'development' ) {
25+ // In development, return local data from the data folder
26+ const data = { } as Record < string , T > ;
27+ for ( const mod of MODULES ) {
28+ const fileName = `EssentialsX${ mod . replace ( ' ' , '' ) } -${ type } .json` ;
29+ // eslint-disable-next-line @typescript-eslint/no-require-imports
30+ data [ mod . length ? mod : 'Essentials' ] = require ( `@/data/${ fileName } ` ) ;
31+ }
32+
33+ return data ;
34+ }
35+
2436 const bucket = await getR2Bucket ( ) ;
2537 if ( ! bucket ) {
2638 throw new Error ( 'R2 bucket not found' ) ;
You can’t perform that action at this time.
0 commit comments