Skip to content

Commit 26c6384

Browse files
committed
Record the SHA of the bundled JavaScript etc files
1 parent c3f295c commit 26c6384

File tree

2 files changed

+20
-9
lines changed

2 files changed

+20
-9
lines changed

package/README.md

+7-6
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,13 @@ In a clone or copy of the repository:
1919
related build metadata information files from all `package/Staging`
2020
directories to the `package/Staging` directory on one machine.
2121

22-
- Run `npm run buildpackage`. This calls `buildpackage.js` to make the
23-
node-oracledb package containing the node-oracledb JavaScript files, the
24-
available binaries, and a `package.json` that has `install` and `prune` script
25-
targets. The package will be created in the top level directory. It can be
26-
uploaded to npmjs.com, or to your own local server, and then used as a
27-
dependency in your projects.
22+
- On the machine with all the binaries in `package/Staging`, run `npm run
23+
buildpackage`. This calls `buildpackage.js` to make the node-oracledb
24+
package containing the node-oracledb JavaScript files, the available
25+
binaries, and a `package.json` that has `install` and `prune` script targets.
26+
The package will be created in the top level directory. It can be uploaded
27+
to npmjs.com by maintainers of node-oracledb, or you can upload to your own
28+
local server and then use it as a dependency in your projects.
2829

2930
# Package Installation
3031

package/buildpackage.js

+13-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2018, 2022, Oracle and/or its affiliates. */
1+
/* Copyright (c) 2018, 2023, Oracle and/or its affiliates. */
22

33
/******************************************************************************
44
*
@@ -32,8 +32,6 @@
3232
* USAGE
3333
* Run this with 'npm run buildpackage'
3434
*
35-
* It requires Node 8 or later
36-
*
3735
*****************************************************************************/
3836

3937
'use strict';
@@ -43,6 +41,15 @@ const execSync = require('child_process').execSync;
4341
const nodbUtil = require('../lib/util.js');
4442
const packageJSON = require("../package.json");
4543

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+
4653
// Save files that get overwritten
4754
const origPackageJson = fs.readFileSync('package.json');
4855
let origNpmignore;
@@ -73,6 +80,9 @@ async function packageUp() {
7380
fs.mkdirSync(nodbUtil.RELEASE_DIR, { recursive: true, mode: 0o755 });
7481
await copyDir(nodbUtil.STAGING_DIR, nodbUtil.RELEASE_DIR);
7582

83+
// Record the SHA of the bundle's non-binary files
84+
fs.appendFileSync(jsStagingInfoFile, njsGitSha + "\n");
85+
7686
// Don't include source code etc. in the npm package. This is
7787
// done dynamically because .npmignore cannot exclude source code
7888
// by default otherwise compiling from a GitHub tag or branch

0 commit comments

Comments
 (0)