@@ -51,23 +51,29 @@ if (bundleGeneratedAssetFiles.length) {
51
51
// Generate hash for each asset file
52
52
addFileToManifest ( resourcesDir , assetFile , manifest , function ( ) {
53
53
if ( manifest . length === bundleGeneratedAssetFiles . length ) {
54
- // Generate hash for JS bundle
55
- addFileToManifest ( path . dirname ( jsBundleFilePath ) , path . basename ( jsBundleFilePath ) , manifest , function ( ) {
56
- // ...and the JS bundle "meta"
57
- var jsBundleMetaFilePath = jsBundleFilePath + ".meta" ;
58
- addFileToManifest ( path . dirname ( jsBundleMetaFilePath ) , path . basename ( jsBundleMetaFilePath ) , manifest , function ( ) {
59
- manifest = manifest . sort ( ) ;
60
- var finalHash = crypto . createHash ( HASH_ALGORITHM )
61
- . update ( JSON . stringify ( manifest ) )
62
- . digest ( "hex" ) ;
63
-
64
- var savedResourcesManifestPath = assetsDir + "/" + CODE_PUSH_HASH_FILE_NAME ;
65
- fs . writeFileSync ( savedResourcesManifestPath , finalHash ) ;
66
- } ) ;
67
- } ) ;
54
+ addJsBundleAndMetaToManifest ( ) ;
68
55
}
69
56
} ) ;
70
57
} ) ;
58
+ } else {
59
+ addJsBundleAndMetaToManifest ( ) ;
60
+ }
61
+
62
+ function addJsBundleAndMetaToManifest ( ) {
63
+ addFileToManifest ( path . dirname ( jsBundleFilePath ) , path . basename ( jsBundleFilePath ) , manifest , function ( ) {
64
+ var jsBundleMetaFilePath = jsBundleFilePath + ".meta" ;
65
+ addFileToManifest ( path . dirname ( jsBundleMetaFilePath ) , path . basename ( jsBundleMetaFilePath ) , manifest , function ( ) {
66
+ manifest = manifest . sort ( ) ;
67
+ var finalHash = crypto . createHash ( HASH_ALGORITHM )
68
+ . update ( JSON . stringify ( manifest ) )
69
+ . digest ( "hex" ) ;
70
+
71
+ console . log ( finalHash ) ;
72
+
73
+ var savedResourcesManifestPath = assetsDir + "/" + CODE_PUSH_HASH_FILE_NAME ;
74
+ fs . writeFileSync ( savedResourcesManifestPath , finalHash ) ;
75
+ } ) ;
76
+ } ) ;
71
77
}
72
78
73
79
function addFileToManifest ( folder , assetFile , manifest , done ) {
@@ -98,4 +104,4 @@ function fileExists(file) {
98
104
catch ( e ) { return false ; }
99
105
}
100
106
101
- fs . unlinkSync ( TEMP_FILE_PATH ) ;
107
+ fs . unlinkSync ( TEMP_FILE_PATH ) ;
0 commit comments