@@ -5,7 +5,7 @@ import { isValidString } from "../../../util/string.js";
55import { loadAllPlaysAsync } from "../datasource/index.js" ;
66
77const INDEX_FILE_PATH = `${ DIRECTORIES . PLAY } /index.js` ;
8- export const processPlayIndex = ( play ) => {
8+ export const processPlayIndex = ( ) => {
99 loadAllPlaysAsync ( ) . then ( ( plays ) => {
1010 const all_dirs = getAllPlaysLocally ( ) ;
1111 writeFile ( plays , all_dirs ) ;
@@ -23,16 +23,33 @@ const writeFile = (plays, dirs) => {
2323 "// Do not modify the content of this file"
2424 ) ;
2525 plays . forEach ( ( play ) => {
26- if ( dirs . indexOf ( play . kebab_name ) > - 1 ) {
27- Log . log ( `Play found locally : ${ play . kebab_name } ` ) ;
26+ let playPath = play . kebab_name ;
27+ if ( play . path ) {
28+ const pathSegmentation = play . path . split ( "/" ) ;
29+ if ( pathSegmentation . length > 1 && play . dev_mode !== true ) {
30+ playPath = pathSegmentation [ 2 ] ;
31+ if ( playPath !== play . kebab_name ) {
32+ Log . log (
33+ `Play name and path is not matching : ${
34+ play . name
35+ } (${ playPath } >> ${ JSON . stringify ( play ) } )`
36+ ) ;
37+ }
38+ }
39+ }
40+ Log . log ( `Checking play locally: ${ play . name } (${ playPath } )` ) ;
41+ if ( dirs . indexOf ( playPath ) > - 1 ) {
42+ Log . log ( `Play found locally : ${ playPath } ` ) ;
2843 fs . appendFileSync (
2944 INDEX_FILE_PATH ,
3045 `\n export { default as ${
31- isValidString ( play . component ) || play . pascal_name
32- } } from 'plays/${ play . kebab_name } /${
33- isValidString ( play . component ) || play . kebab_name
46+ isValidString ( play . component ) || play . title_name
47+ } } from 'plays/${ playPath } /${
48+ isValidString ( play . component ) || play . title_name || play . kebab_name
3449 } ';`
3550 ) ;
51+ } else {
52+ Log . warning ( `Play not found locally : ${ play . name } (${ playPath } )` ) ;
3653 }
3754 } ) ;
3855} ;
0 commit comments