Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add postinstall script for auto install of optional dependencies; upd… #60

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
],
"main": "index.js",
"scripts": {
"test": "mocha tests/index.test.js -t 5000"
"test": "mocha tests/index.test.js -t 5000",
"postinstall": "node ./utils/post-install.js"
},
"author": "Bertrand Fan <[email protected]> (https://bert.org/), Reece Daniels <[email protected]>",
"license": "MIT",
Expand Down
9 changes: 9 additions & 0 deletions utils/post-install.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const { execSync } = require('child_process');

if (process.platform === 'darwin') {
console.log('darwin operating system detected; installing operating system dependency keytar')
execSync('npm i [email protected]')
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of what I read suggests this is discouraged practice. Leaving it open as a draft nevertheless as it is a solution that works.

} else if (process.platform === 'win32') {
console.log('win32 operating system detected; installing operating system dependency win-dpapi')
execSync('npm i [email protected]')
}