This repository was archived by the owner on Aug 7, 2021. It is now read-only.
File tree 2 files changed +29
-0
lines changed
2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change
1
+ const { join } = require ( "path" ) ;
2
+ const { readFileSync, existsSync, writeFileSync } = require ( "fs" ) ;
3
+ const envOptionsCacheFileLocation = join ( __dirname , "env.cache.json" ) ;
4
+
5
+ module . exports = function ( hookArgs ) {
6
+ const platformInfo = hookArgs . platformInfo ;
7
+ if ( platformInfo && platformInfo . appFilesUpdaterOptions && platformInfo . appFilesUpdaterOptions . bundle ) {
8
+ return ( args , originalMethod ) => {
9
+ return originalMethod ( ...args ) . then ( originalShouldPrepare => {
10
+ const currentEnvString = JSON . stringify ( platformInfo . env || { } ) ;
11
+ if ( existsSync ( envOptionsCacheFileLocation ) ) {
12
+ const oldEnvOptionsString = readFileSync ( envOptionsCacheFileLocation ) . toString ( ) ;
13
+ if ( oldEnvOptionsString === currentEnvString ) {
14
+ return originalShouldPrepare ;
15
+ }
16
+ }
17
+
18
+ writeFileSync ( envOptionsCacheFileLocation , currentEnvString ) ;
19
+
20
+ return true ;
21
+ } ) ;
22
+ } ;
23
+ }
24
+ }
Original file line number Diff line number Diff line change 30
30
"script" : " lib/before-watchPatterns.js" ,
31
31
"inject" : true
32
32
},
33
+ {
34
+ "type" : " before-shouldPrepare" ,
35
+ "script" : " lib/before-shouldPrepare.js" ,
36
+ "inject" : true
37
+ },
33
38
{
34
39
"type" : " after-prepare" ,
35
40
"script" : " lib/after-prepare.js" ,
You can’t perform that action at this time.
0 commit comments