Skip to content

Commit 17b3088

Browse files
committed
Include source in the npm package for users with no GitHub access
1 parent 2c08dbb commit 17b3088

File tree

3 files changed

+88
-27
lines changed

3 files changed

+88
-27
lines changed

INSTALL.md

Lines changed: 78 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1292,29 +1292,28 @@ installing.
12921292

12931293
### <a name="offline"></a> 3.12 Node-oracledb Installation Without Internet Access
12941294

1295-
There are two ways to install node-oracledb on computers that do not
1296-
have internet access or do not have access to the [npm registry][4].
1297-
You can either do a normal install on another machine, or manually
1298-
extract the node-oracledb packages.
1295+
There are several ways to install node-oracledb on computers that do
1296+
not have internet access, or have no access to either the [npm
1297+
registry][4] or [github.com][1].
12991298

1300-
#### 3.12.1 Normal Install on an Intermediary Machine
1299+
#### 3.12.1 Installing on an Intermediary Machine
13011300

1302-
On an identical machine that does have access, install node-oracle
1303-
following the [Node-oracledb Installation Instructions](#instructions)
1304-
for that operating system.
1301+
On an identical machine that has access to the internet, install
1302+
node-oracle following the [Node-oracledb Installation
1303+
Instructions](#instructions) for that operating system.
13051304

13061305
Then copy `node_modules/oracledb` and Oracle client libraries to the
13071306
offline computer. Windows users should see [Copying node-oracledb
13081307
Binaries on Windows](#winbins) and make sure the correct Visual Studio
13091308
Redistributable is also installed.
13101309

1311-
#### 3.12.2 Manual Install Using Pre-built Binaries
1310+
#### 3.12.2 Manually Extracting Pre-built Binaries
13121311

13131312
If pre-built node-oracledb binaries are available for your version
13141313
of Node.js and operating system, you can install manually:
13151314

1316-
- On a computer that has internet access, navigate to a release on the
1317-
[GitHub Release][41] page.
1315+
- On a computer that has access to github.com, navigate to a release
1316+
on the [GitHub Release][41] page.
13181317

13191318
Download the release's main node-oracledb package, for example
13201319
`oracledb-2.0.15.tgz`.
@@ -1354,21 +1353,25 @@ of Node.js and operating system, you can install manually:
13541353
|-- CHANGELOG.md
13551354
|-- LICENSE.md
13561355
|-- README.md
1356+
|-- binding.gyp
13571357
|-- index.js
13581358
|-- lib
1359-
|-- |-- connection.js
1360-
|-- |-- lob.js
1361-
|-- |-- oracledb.js
1362-
|-- |-- pool.js
1363-
|-- |-- querystream.js
1364-
|-- |-- resultset.js
1365-
|-- |-- util.js
1366-
|-- oracledb-2.0.15.tgz
1359+
| |-- connection.js
1360+
| |-- lob.js
1361+
| |-- oracledb.js
1362+
| |-- pool.js
1363+
| |-- querystream.js
1364+
| |-- resultset.js
1365+
| |-- util.js
1366+
|-- odpi
1367+
| |-- . . .
13671368
|-- package
1368-
|-- |-- extractpackage.js
1369-
|-- |-- oracledbinstall.js
1370-
|-- |-- util.js
1369+
| |-- extractpackage.js
1370+
| |-- oracledbinstall.js
1371+
| |-- util.js
13711372
|-- package.json
1373+
|-- src
1374+
|-- . . .
13721375
```
13731376

13741377
- Locate `node_modules/oracledb/package/extractpackage.js` and use it
@@ -1387,6 +1390,57 @@ of Node.js and operating system, you can install manually:
13871390
Binaries on Windows](#winbins) and make sure the correct Visual
13881391
Studio Redistributable is also installed.
13891392

1393+
#### 3.12.3 Installing node-oracledb without GitHub Access
1394+
1395+
Some companies block access to github.com so `npm install oracledb`
1396+
will fail to download binaries, as will installing source code from
1397+
GitHub with `npm install oracle/node-oracledb.git#v2.0.15`.
1398+
1399+
1400+
To install node-oracledb in this case, compile the source code
1401+
included in the npm package:
1402+
1403+
- Use `npm install -verbose oracledb` and locate the URL it uses to
1404+
download the node-oracledb package, for example
1405+
`https://registry.npmjs.org/oracledb/-/oracledb-2.0.15.tgz`
1406+
1407+
Download and save the package.
1408+
1409+
- Create a directory such as `oracledb_build` and extract the package
1410+
inside it:
1411+
1412+
```
1413+
mkdir oracledb_build
1414+
mv oracledb-2.0.15.tgz oracledb_build
1415+
cd oracledb_build
1416+
tar -xzf oracledb-2.0.15.tgz
1417+
```
1418+
1419+
The directory contents will be the same as shown in the previous
1420+
section.
1421+
1422+
- Edit `package.json` and delete the line that invokes the binary
1423+
download script:
1424+
1425+
```
1426+
"install": "node package/oracledbinstall.js",
1427+
```
1428+
1429+
- Either add a dependency on [nan](https://www.npmjs.com/package/nan)
1430+
to `package.json`, or manually install it:
1431+
1432+
```
1433+
npm install nan
1434+
```
1435+
1436+
- Install the build prerequisites for compilation, following the
1437+
[Node-oracledb Installation Instructions](#instructions).
1438+
1439+
- Build node-oracledb from outside the directory:
1440+
1441+
```
1442+
npm install ./oracledb_build
1443+
```
13901444

13911445
## <a name="installingv1"></a> 4. Installing Node-oracledb 1.x
13921446

@@ -1398,6 +1452,8 @@ add-on you must explictly use its version when installing:
13981452
npm install [email protected]
13991453
```
14001454

1455+
This version always requires compilation.
1456+
14011457
## <a name="otherresources"></a> 5. Useful Resources for Node-oracledb
14021458

14031459
Node-oracledb can be installed on the pre-built [*Database App

package/Makefile

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,10 @@ GIT=git
2828
NODE=node
2929
NPM=npm
3030

31-
GITSHA=$(shell $(GIT) rev-parse --short HEAD)
31+
GITSHA=$(shell $(GIT) rev-parse HEAD)
32+
SUBMOD=$(shell $(CD) ../odpi && $(GIT) rev-parse HEAD)
33+
NODEVER=$(shell $(NODE) --version)
3234
BUILDDATE=$(shell $(DATE))
33-
SUBMOD="$(shell $(CD) .. && $(GIT) submodule)" # Old git needs to run this in toplevel
3435

3536
# createpackage.js assumes these paths
3637
BINARY_PATH_LOCAL=../build/Release/oracledb.node
@@ -58,8 +59,10 @@ endif
5859
# invokes oracledbinstall.js at install time
5960
npmpackage:
6061
@$(RMDIR) $(TMPDIR)
61-
$(MKDIR) -m 755 $(TMPDIR) && $(CP) ./package.json ../index.js ../README.md $(LICENSE_PATH_LOCAL) ../CHANGELOG.md $(TMPDIR) && (echo "NJS SHA: $(GITSHA)" && echo "Package date: $(BUILDDATE)" ) >> $(TMPDIR)/LICENSE.md
62-
$(MKDIR) -m 755 $(TMPDIR)/lib && $(CP) ../lib/*.js $(TMPDIR)/lib
62+
$(MKDIR) -m 755 $(TMPDIR) && $(CP) ./package.json ../index.js ../README.md $(LICENSE_PATH_LOCAL) ../CHANGELOG.md ../binding.gyp $(TMPDIR)
63+
$(MKDIR) -m 755 $(TMPDIR)/lib && $(CP) ../lib/*.js $(TMPDIR)/lib && $(ECHO) "$(GITSHA) $(BUILDDATE)" > $(TMPDIR)/lib/rel.txt
64+
$(MKDIR) -m 755 $(TMPDIR)/src && $(CP) ../src/* $(TMPDIR)/src
65+
$(MKDIR) -m 755 $(TMPDIR)/odpi && $(MKDIR) -m 755 $(TMPDIR)/odpi/src && $(MKDIR) -m 755 $(TMPDIR)/odpi/include && $(CP) ../odpi/src/* $(TMPDIR)/odpi/src && $(CP) ../odpi/include/* $(TMPDIR)/odpi/include
6366
$(MKDIR) -m 755 $(TMPDIR)/package && $(CP) oracledbinstall.js extractpackage.js util.js $(TMPDIR)/package
6467
($(CD) $(TMPDIR) && $(TAR) -czf ../oracledb-$(VER).tgz ./*)
6568
@$(ECHO) "==> Created generic npm production package for node-oracledb $(VER)"
@@ -73,7 +76,8 @@ npmpackage:
7376
# Create a package containing (i) the license file and (ii) the
7477
# node-oracledb binary for the current environment
7578
binarypackage: $(BINARY_PATH_LOCAL) $(LICENSE_PATH_LOCAL)
76-
$(CP) $(LICENSE_PATH_LOCAL) $(LICENSE_PATH_LOCAL).bk && (echo "NJS SHA: $(GITSHA)" && echo $(SUBMOD) && echo "Package date: $(BUILDDATE)") >> $(LICENSE_PATH_LOCAL)
79+
$(GIT) checkout $(LICENSE_PATH_LOCAL)
80+
$(CP) $(LICENSE_PATH_LOCAL) $(LICENSE_PATH_LOCAL).bk && $(ECHO) "$(GITSHA) $(SUBMOD) $(NODEVER) $(BUILDDATE)" >> $(LICENSE_PATH_LOCAL)
7781
$(NODE) createpackage.js
7882
$(MV) $(LICENSE_PATH_LOCAL).bk $(LICENSE_PATH_LOCAL)
7983
@$(ECHO) "==> Created binary package for Node.js `$(NODE) --version`"

package/oracledbinstall.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,7 @@ function installBinary() {
317317
.then(compressedReadstream => {
318318
return packageUtil.extract({
319319
licenseDest: packageUtil.LICENSE_PATH_LOCAL,
320+
writeLicense: true,
320321
binaryDest: packageUtil.BINARY_PATH_LOCAL,
321322
compressedReadstream: compressedReadstream
322323
});

0 commit comments

Comments
 (0)