From 475c7bbe57c5f74158143a03298f174373eecc84 Mon Sep 17 00:00:00 2001 From: kirillgroshkov Date: Tue, 26 Dec 2023 20:06:55 +0100 Subject: [PATCH] fix: move non-mandatory deps to peerDependencies fixes https://github.com/snowflakedb/snowflake-connector-nodejs/issues/449 --- README.md | 14 ++++++++++++-- lib/file_transfer_agent/s3_util.js | 2 +- package.json | 31 +++++++++++++++++++++++------- 3 files changed, 37 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 017cf99b9..2e9510729 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,19 @@ + +This is the fork of [snowflake-connector-nodejs](https://github.com/snowflakedb/snowflake-connector-nodejs) +with the following changes: + +- Fixes https://github.com/snowflakedb/snowflake-connector-nodejs/issues/449 by moving non-mandatory dependencies to peerDependencies. So, folks who don't need e.g AWS SDK don't have to "download the whole internet". + +Published as [@naturalcycles/snowflake-sdk](https://www.npmjs.com/package/@naturalcycles/snowflake-sdk). + +## Readme + ******************************************************************************** NodeJS Driver for Snowflake ********************************************************************************

master - npm + npm apache codecov

@@ -15,7 +25,7 @@ NodeJS Driver for Snowflake Install ====================================================================== -Run `npm i snowflake-sdk` in your existing NodeJs project. +Run `npm i @naturalcycles/snowflake-sdk` in your existing NodeJs project. Docs ====================================================================== diff --git a/lib/file_transfer_agent/s3_util.js b/lib/file_transfer_agent/s3_util.js index 522821125..527e51ddf 100644 --- a/lib/file_transfer_agent/s3_util.js +++ b/lib/file_transfer_agent/s3_util.js @@ -38,7 +38,6 @@ function S3Location(bucketName, s3path) { * @constructor */ function S3Util(s3, filestream) { - const AWS = typeof s3 !== 'undefined' ? s3 : require('@aws-sdk/client-s3'); const fs = typeof filestream !== 'undefined' ? filestream : require('fs'); // magic number, given from error message. @@ -73,6 +72,7 @@ function S3Util(s3, filestream) { useAccelerateEndpoint: useAccelerateEndpoint, }; + const AWS = typeof s3 !== 'undefined' ? s3 : require('@aws-sdk/client-s3'); return new AWS.S3(config); }; diff --git a/package.json b/package.json index 210c0bcc0..788099231 100644 --- a/package.json +++ b/package.json @@ -1,11 +1,8 @@ { - "name": "snowflake-sdk", - "version": "1.9.2", + "name": "@naturalcycles/snowflake-sdk", + "version": "1.9.4", "description": "Node.js driver for Snowflake", "dependencies": { - "@aws-sdk/client-s3": "^3.388.0", - "@azure/storage-blob": "^12.11.0", - "@google-cloud/storage": "^6.9.3", "@techteamer/ocsp": "1.0.1", "agent-base": "^6.0.2", "asn1.js-rfc2560": "^5.0.0", @@ -46,14 +43,34 @@ "test-console": "^2.0.0" }, "peerDependencies": { - "asn1.js": "^5.4.1" + "asn1.js": "^5.4.1", + "@aws-sdk/client-s3": "^3.388.0", + "@azure/storage-blob": "^12.11.0", + "@google-cloud/storage": "^6.9.3" + }, + "peerDependenciesMeta": { + "asn1.js": { + "optional": true + }, + "@aws-sdk/client-s3": { + "optional": true + }, + "@azure/storage-blob": { + "optional": true + }, + "@google-cloud/storage": { + "optional": true + } }, "overrides": { "semver": "^7.5.2" }, "repository": { "type": "git", - "url": "https://github.com/snowflakedb/snowflake-connector-nodejs" + "url": "https://github.com/NaturalCycles/snowflake-connector-nodejs" + }, + "publishConfig": { + "access": "public" }, "scripts": { "lint:check": "eslint",