This repository was archived by the owner on Aug 7, 2021. It is now read-only.
  
  
  
  
    
    
    
      
    
  
  
    
File tree Expand file tree Collapse file tree 3 files changed +21
-3
lines changed 
plugins/NativeScriptSnapshotPlugin Expand file tree Collapse file tree 3 files changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,12 @@ module.exports = function (hookArgs) {
1212		release : hookArgs . prepareData . release 
1313	} ; 
1414
15- 	if  ( env . snapshot  &&  shouldSnapshot ( shouldSnapshotOptions ) )  { 
15+ 	if  ( env . snapshot  && 
16+ 		shouldSnapshot ( shouldSnapshotOptions )  && 
17+ 		( ! hookArgs . prepareData  || 
18+ 			! hookArgs . prepareData . nativePrepare  || 
19+ 			! hookArgs . prepareData . nativePrepare . skipNativePrepare ) )  { 
20+ 
1621		installSnapshotArtefacts ( hookArgs . prepareData . projectDir ) ; 
1722	} 
1823} 
Original file line number Diff line number Diff line change 11const  os  =  require ( "os" ) ; 
2+ const  {  dirname }  =  require ( "path" ) ; 
3+ const  {  existsSync,  mkdirSync }  =  require ( "fs" ) ; 
24const  {  isAndroid }  =  require ( "../projectHelpers" ) ; 
35
46function  shouldSnapshot ( config )  { 
@@ -21,9 +23,19 @@ function warn(message) {
2123    } 
2224} 
2325
26+ function  ensureDirectoryExistence ( filePath )  { 
27+     var  dir  =  dirname ( filePath ) ; 
28+     if  ( existsSync ( dir ) )  { 
29+         return  true ; 
30+     } 
31+     ensureDirectoryExistence ( dir ) ; 
32+     mkdirSync ( dir ) ; 
33+ } 
34+ 
2435module . exports  =  { 
2536    shouldSnapshot, 
2637    convertToUnixPath, 
2738    isWinOS, 
28-     warn
39+     warn, 
40+     ensureDirectoryExistence
2941} ; 
Original file line number Diff line number Diff line change 88    ANDROID_PROJECT_DIR , 
99    ANDROID_APP_PATH , 
1010}  =  require ( "../../androidProjectHelpers" ) ; 
11+ const  {  ensureDirectoryExistence }  =  require ( "../../lib/utils" ) ; 
1112const  schema  =  require ( "./options.json" ) ; 
1213
1314const  SNAPSHOT_ENTRY_NAME  =  "snapshot-entry" ; 
@@ -57,6 +58,7 @@ exports.NativeScriptSnapshotPlugin = (function () {
5758        snapshotEntryContent  +=  [ ...requireModules ,  ...internalRequireModules ] 
5859            . map ( mod  =>  `require('${ mod }  ) . join ( ";" ) ; 
5960
61+         ensureDirectoryExistence ( snapshotEntryPath ) ; 
6062        writeFileSync ( snapshotEntryPath ,  snapshotEntryContent ,  {  encoding : "utf8"  } ) ; 
6163
6264        // add the module to the entry points to make sure it's content is evaluated 
@@ -68,7 +70,6 @@ exports.NativeScriptSnapshotPlugin = (function () {
6870        // ensure that the runtime is installed only in the snapshotted chunk 
6971        webpackConfig . optimization . runtimeChunk  =  {  name : SNAPSHOT_ENTRY_NAME  } ; 
7072    } 
71- 
7273    NativeScriptSnapshotPlugin . getInternalRequireModules  =  function  ( webpackContext )  { 
7374        const  packageJson  =  getPackageJson ( webpackContext ) ; 
7475        return  ( packageJson  &&  packageJson [ "android" ]  &&  packageJson [ "android" ] [ "requireModules" ] )  ||  [ ] ; 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments