1
- /* Copyright (c) 2018, 2022 , Oracle and/or its affiliates. */
1
+ /* Copyright (c) 2018, 2023 , Oracle and/or its affiliates. */
2
2
3
3
/******************************************************************************
4
4
*
32
32
* USAGE
33
33
* Run this with 'npm run buildpackage'
34
34
*
35
- * It requires Node 8 or later
36
- *
37
35
*****************************************************************************/
38
36
39
37
'use strict' ;
@@ -43,6 +41,15 @@ const execSync = require('child_process').execSync;
43
41
const nodbUtil = require ( '../lib/util.js' ) ;
44
42
const packageJSON = require ( "../package.json" ) ;
45
43
44
+ const jsStagingInfoFile = nodbUtil . RELEASE_DIR + '/oracledb-' + nodbUtil . PACKAGE_JSON_VERSION + '-js-buildinfo.txt' ;
45
+
46
+ let njsGitSha ;
47
+ try {
48
+ njsGitSha = execSync ( 'git --git-dir=./.git rev-parse --verify HEAD' ) . toString ( ) . replace ( / [ \n \r ] / , '' ) ;
49
+ } catch ( err ) {
50
+ njsGitSha = 'unknown NJS SHA' ;
51
+ }
52
+
46
53
// Save files that get overwritten
47
54
const origPackageJson = fs . readFileSync ( 'package.json' ) ;
48
55
let origNpmignore ;
@@ -73,6 +80,9 @@ async function packageUp() {
73
80
fs . mkdirSync ( nodbUtil . RELEASE_DIR , { recursive : true , mode : 0o755 } ) ;
74
81
await copyDir ( nodbUtil . STAGING_DIR , nodbUtil . RELEASE_DIR ) ;
75
82
83
+ // Record the SHA of the bundle's non-binary files
84
+ fs . appendFileSync ( jsStagingInfoFile , njsGitSha + "\n" ) ;
85
+
76
86
// Don't include source code etc. in the npm package. This is
77
87
// done dynamically because .npmignore cannot exclude source code
78
88
// by default otherwise compiling from a GitHub tag or branch
0 commit comments