@@ -724,11 +724,16 @@ class CodeInjector implements ICodeInjector {
724724
725725
726726 /* hash checking */
727- // Here we use pnpm-lock.yaml, because this file will be anywat, even if user doesn't use it
728- const spaPnpmLockPath = path . join ( this . spaTmpPath ( ) , 'pnpm-lock.yaml' ) ;
729- const spaPnpmLock = yaml . parse ( await fs . promises . readFile ( spaPnpmLockPath , 'utf-8' ) ) ;
730- const spaLockHash = hashify ( spaPnpmLock ) ;
731-
727+ let spaLockHash = '' ;
728+ if ( await this . doesUserHasPnpmLockFile ( this . adminforth . config . customization . customComponentsDir ) ) {
729+ const spaPnpmLockPath = path . join ( this . spaTmpPath ( ) , 'pnpm-lock.yaml' ) ;
730+ const spaPnpmLock = yaml . parse ( await fs . promises . readFile ( spaPnpmLockPath , 'utf-8' ) ) ;
731+ spaLockHash = hashify ( spaPnpmLock ) ;
732+ } else {
733+ const spaNpmLockPath = path . join ( this . spaTmpPath ( ) , 'package-lock.json' ) ;
734+ const spaNpmLock = JSON . parse ( await fs . promises . readFile ( spaNpmLockPath , 'utf-8' ) ) ;
735+ spaLockHash = hashify ( spaNpmLock ) ;
736+ }
732737 /* customPackageLock */
733738 let usersLockHash : string = '' ;
734739 let usersPackages : string [ ] = [ ] ;
@@ -946,7 +951,9 @@ class CodeInjector implements ICodeInjector {
946951
947952 // 🚫 Skip big files or files which might be dynamic
948953 if ( file . name === 'node_modules' || file . name === 'dist' ||
949- file . name === 'i18n-messages.json' || file . name === 'i18n-empty.json' ) {
954+ file . name === 'i18n-messages.json' || file . name === 'i18n-empty.json' ||
955+ file . name === 'hashes.json' || file . name === 'package.json' ||
956+ file . name === 'pnpm-lock.yaml' || file . name === 'package-lock.json' ) {
950957 return '' ;
951958 }
952959
@@ -974,7 +981,9 @@ class CodeInjector implements ICodeInjector {
974981
975982 // 🚫 Skip big/dynamic folders or files
976983 if ( file . name === 'node_modules' || file . name === 'dist' ||
977- file . name === 'i18n-messages.json' || file . name === 'i18n-empty.json' || file . name === 'hashes.json' ) {
984+ file . name === 'i18n-messages.json' || file . name === 'i18n-empty.json' ||
985+ file . name === 'hashes.json' || file . name === 'package.json' ||
986+ file . name === 'pnpm-lock.yaml' || file . name === 'package-lock.json' ) {
978987 return ;
979988 }
980989
@@ -1041,9 +1050,7 @@ class CodeInjector implements ICodeInjector {
10411050 const skipBuild = buildHash === sourcesHash ;
10421051 const skipExtract = messagesHash === sourcesHash ;
10431052
1044- afLogger . trace ( `🪲 SPA build hash: ${ buildHash } ` ) ;
10451053 afLogger . trace ( `🪲 SPA messages hash: ${ messagesHash } ` ) ;
1046- afLogger . trace ( `🪲 SPA sources hash: ${ sourcesHash } ` ) ;
10471054
10481055 if ( ! skipBuild ) {
10491056 // remove serveDir if exists
@@ -1072,7 +1079,7 @@ class CodeInjector implements ICodeInjector {
10721079
10731080 if ( ! hotReload ) {
10741081 if ( ! skipBuild ) {
1075- console . log ( `🪲 Build cache miss, building SPA...` ) ;
1082+ console . log ( `🪲 Build cache miss or outdated , building SPA...` ) ;
10761083 let oldHashForFiles = null ;
10771084 try {
10781085 oldHashForFiles = await fs . promises . readFile ( path . join ( this . spaTmpPath ( ) , 'hashes.json' ) , 'utf-8' ) ;
0 commit comments