Skip to content

Commit

Permalink
try new approach to integrate/install sqlite3 at postinstall
Browse files Browse the repository at this point in the history
  • Loading branch information
fritx committed Sep 9, 2019
1 parent 711276f commit 8e10fe0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
"ava": "^0.19.1"
},
"dependencies": {
"shelljs": "^0.7.4",
"sqlite3": "3.x"
"shelljs": "^0.7.4"
}
}
7 changes: 4 additions & 3 deletions postinstall.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
require('shelljs/global')
var isArray = require('util').isArray

var sq3version = '3.x'

var args
try {
args = JSON.parse(process.env.npm_config_argv).original
Expand Down Expand Up @@ -34,13 +36,12 @@ if (process.platform === 'darwin') {
}
exec('export LDFLAGS="-L`brew --prefix`/opt/sqlcipher/lib"')
exec('export CPPFLAGS="-I`brew --prefix`/opt/sqlcipher/include"')
cd('node_modules/sqlite3')
exec('npm i --build-from-source --sqlite_libname=sqlcipher --sqlite=`brew --prefix`' + targetStr)
exec('npm i sqlite3@' + sq3version + ' --no-save --build-from-source --sqlite_libname=sqlcipher --sqlite=`brew --prefix`' + targetStr)
} else {
// linux
exec('export LDFLAGS="-L/usr/local/lib"')
exec('export CPPFLAGS="-I/usr/local/include -I/usr/local/include/sqlcipher"')
exec('export CXXFLAGS="$CPPFLAGS"')
cd('node_modules/sqlite3')
exec('npm i --build-from-source --sqlite_libname=sqlcipher --sqlite=/usr/local --verbose' + targetStr)
exec('npm i sqlite3@' + sq3version + ' --no-save --build-from-source --sqlite_libname=sqlcipher --sqlite=/usr/local --verbose' + targetStr)
}

0 comments on commit 8e10fe0

Please sign in to comment.