From 5c67a4b1fe7ea584a5587e53c6cf17b13edafdee Mon Sep 17 00:00:00 2001 From: Reece Daniels Date: Sun, 30 Jun 2024 18:46:00 +0100 Subject: [PATCH 1/2] add postinstall script for auto install of optional dependencies; update README for keytar & win-dpapi --- .nvmrc | 1 + README.md | 16 ++++++++++++++++ package-lock.json | 11 ++++++++--- package.json | 3 ++- utils/post-install.js | 9 +++++++++ 5 files changed, 36 insertions(+), 4 deletions(-) create mode 100644 .nvmrc create mode 100644 utils/post-install.js diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000..ecb0f8a --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +18.13.0 \ No newline at end of file diff --git a/README.md b/README.md index 7515b40..434de6e 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,22 @@ If `format` is not specified, `object` will be used as the format by default. Cookie order tries to follow [RFC 6265 - Section 5.4, step 2](http://tools.ietf.org/html/rfc6265#section-5.4) as best as possible. +## Optional Dependencies + +Because this package is designed to work cross-platform, two operating system specific dependencies are declared as `optionalDependencies`. + +If you are working on these platforms you should install these manually after running `npm i`. + +### For Windows + +- `win-dpapi` is required +- `npm i win-dpapi@1.1.0` + +### For macOS + +- `keytar` is required +- `npm i keytar@7.9.0` + ## Examples basic usage diff --git a/package-lock.json b/package-lock.json index ff7ab38..53fc252 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,13 @@ { "name": "chrome-cookies-secure", - "version": "2.1.0", + "version": "2.1.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "chrome-cookies-secure", - "version": "2.1.0", + "version": "2.1.1", + "hasInstallScript": true, "license": "MIT", "os": [ "darwin", @@ -15,6 +16,7 @@ ], "dependencies": { "int": "^0.2.0", + "keytar": "^7.9.0", "request": "^2.88.0", "sqlite3": "^5.0.7", "tldjs": "^1.5.1", @@ -1158,8 +1160,9 @@ }, "node_modules/keytar": { "version": "7.9.0", + "resolved": "https://registry.npmjs.org/keytar/-/keytar-7.9.0.tgz", + "integrity": "sha512-VPD8mtVtm5JNtA2AErl6Chp06JBfy7diFQ7TQQhdpWOl6MrCRB+eRbvAZUsbGQS9kiMq0coJsy0W0vHpDCkWsQ==", "hasInstallScript": true, - "license": "MIT", "optional": true, "dependencies": { "node-addon-api": "^4.3.0", @@ -3180,6 +3183,8 @@ }, "keytar": { "version": "7.9.0", + "resolved": "https://registry.npmjs.org/keytar/-/keytar-7.9.0.tgz", + "integrity": "sha512-VPD8mtVtm5JNtA2AErl6Chp06JBfy7diFQ7TQQhdpWOl6MrCRB+eRbvAZUsbGQS9kiMq0coJsy0W0vHpDCkWsQ==", "optional": true, "requires": { "node-addon-api": "^4.3.0", diff --git a/package.json b/package.json index f799ce5..063ec96 100644 --- a/package.json +++ b/package.json @@ -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 (https://bert.org/), Reece Daniels ", "license": "MIT", diff --git a/utils/post-install.js b/utils/post-install.js new file mode 100644 index 0000000..056df1d --- /dev/null +++ b/utils/post-install.js @@ -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 keytar@7.9.0') +} else if (process.platform === 'win32') { + console.log('win32 operating system detected; installing operating system dependency win-dpapi') + execSync('npm i win-dpapi@1.1.0') +} \ No newline at end of file From e8d3344a1ad5fe398a5fcc7e7fd467fb807ed553 Mon Sep 17 00:00:00 2001 From: Reece Daniels Date: Sun, 7 Jul 2024 10:32:03 +0100 Subject: [PATCH 2/2] rm dupe README entry --- README.md | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/README.md b/README.md index 93e66f3..86591a1 100644 --- a/README.md +++ b/README.md @@ -46,22 +46,6 @@ If `format` is not specified, `object` will be used as the format by default. Cookie order tries to follow [RFC 6265 - Section 5.4, step 2](http://tools.ietf.org/html/rfc6265#section-5.4) as best as possible. -## Optional Dependencies - -Because this package is designed to work cross-platform, two operating system specific dependencies are declared as `optionalDependencies`. - -If you are working on these platforms you should install these manually after running `npm i`. - -### For Windows - -- `win-dpapi` is required -- `npm i win-dpapi@1.1.0` - -### For macOS - -- `keytar` is required -- `npm i keytar@7.9.0` - ## Examples basic usage