From 9d10acf05cff104de1e1ac3f7aaaefa1cffebfde Mon Sep 17 00:00:00 2001 From: giorgi khoshtaria <99177635+g1org11@users.noreply.github.com> Date: Wed, 2 Oct 2024 14:52:21 +0400 Subject: [PATCH 1/6] add all fs functionalities --- src/fs/copy.js | 32 ++++++++++++++++++- src/fs/create.js | 20 ++++++++++-- src/fs/delete.js | 18 +++++++++-- src/fs/files/fresh.txt | 1 + .../{wrongFilename.txt => properFilename.md} | 0 src/fs/files_copy/dontLookAtMe.txt | 1 + src/fs/files_copy/fileToRead.txt | 7 ++++ src/fs/{files => files_copy}/fileToRemove.txt | 0 src/fs/files_copy/fresh.txt | 1 + src/fs/files_copy/hello.txt | 1 + src/fs/files_copy/wrongFilename.txt | 3 ++ src/fs/list.js | 23 +++++++++++-- src/fs/read.js | 20 ++++++++++-- src/fs/rename.js | 24 ++++++++++++-- 14 files changed, 140 insertions(+), 11 deletions(-) create mode 100644 src/fs/files/fresh.txt rename src/fs/files/{wrongFilename.txt => properFilename.md} (100%) create mode 100644 src/fs/files_copy/dontLookAtMe.txt create mode 100644 src/fs/files_copy/fileToRead.txt rename src/fs/{files => files_copy}/fileToRemove.txt (100%) create mode 100644 src/fs/files_copy/fresh.txt create mode 100644 src/fs/files_copy/hello.txt create mode 100644 src/fs/files_copy/wrongFilename.txt diff --git a/src/fs/copy.js b/src/fs/copy.js index bd17fe3991..65ff9baa62 100644 --- a/src/fs/copy.js +++ b/src/fs/copy.js @@ -1,5 +1,35 @@ +import { promises as fs } from "fs"; +import path from "path"; +const __dirname = path.resolve(); const copy = async () => { - // Write your code here + // Write your code here + const mainFile = path.join(__dirname, "files"); + const copyFile = path.join(__dirname, "files_copy"); + console.log(mainFile); + + try { + await fs.access(mainFile); + } catch (error) { + throw new Error("FS operation failed"); + } + try { + await fs.access(copyFile); + throw new Error("FS operation failed"); + } catch (error) { + if (error.code !== "ENOENT") { + throw new Error("FS operation failed"); + } + } + + await fs.mkdir(copyFile); + const files = await fs.readdir(mainFile); + console.log(files); + + files.map(async (file) => { + const srcFile = path.join(mainFile, file); + const destFile = path.join(copyFile, file); + await fs.copyFile(srcFile, destFile); + }, console.log("Files copied successfully!")); }; await copy(); diff --git a/src/fs/create.js b/src/fs/create.js index 8d18cf9fc2..8d28315d27 100644 --- a/src/fs/create.js +++ b/src/fs/create.js @@ -1,5 +1,21 @@ +import { promises as fs } from "fs"; +import path from "path"; +const __dirname = path.resolve(); const create = async () => { - // Write your code here + // Write your code here + const filePath = path.join(__dirname, "files", "fresh.txt"); + try { + await fs.access(filePath); + throw new Error("FS operation failed"); + } catch (error) { + if (error) { + await fs.mkdir(path.join(__dirname, "files"), { recursive: true }); + await fs.writeFile(filePath, "I am fresh and young"); + console.log("File created successfully!"); + } else { + throw error; + } + } }; -await create(); \ No newline at end of file +await create(); diff --git a/src/fs/delete.js b/src/fs/delete.js index 4718dbc4c5..9528821879 100644 --- a/src/fs/delete.js +++ b/src/fs/delete.js @@ -1,5 +1,19 @@ +import { promises as fs } from "fs"; +import path from "path"; +const __dirname = path.resolve(); + const remove = async () => { - // Write your code here + // Write your code here + const delateFile = path.join(__dirname, "files", "fileToRemove.txt"); + + try { + await fs.access(delateFile); + } catch (error) { + throw new Error("FS operation failed"); + } + + await fs.unlink(delateFile); + console.log("file delated successfuly"); }; -await remove(); \ No newline at end of file +await remove(); diff --git a/src/fs/files/fresh.txt b/src/fs/files/fresh.txt new file mode 100644 index 0000000000..205d704cb7 --- /dev/null +++ b/src/fs/files/fresh.txt @@ -0,0 +1 @@ +I am fresh and young \ No newline at end of file diff --git a/src/fs/files/wrongFilename.txt b/src/fs/files/properFilename.md similarity index 100% rename from src/fs/files/wrongFilename.txt rename to src/fs/files/properFilename.md diff --git a/src/fs/files_copy/dontLookAtMe.txt b/src/fs/files_copy/dontLookAtMe.txt new file mode 100644 index 0000000000..8979bab743 --- /dev/null +++ b/src/fs/files_copy/dontLookAtMe.txt @@ -0,0 +1 @@ +What are you looking at?! \ No newline at end of file diff --git a/src/fs/files_copy/fileToRead.txt b/src/fs/files_copy/fileToRead.txt new file mode 100644 index 0000000000..5d66c332d6 --- /dev/null +++ b/src/fs/files_copy/fileToRead.txt @@ -0,0 +1,7 @@ +My content +should +be +printed +into +console +! \ No newline at end of file diff --git a/src/fs/files/fileToRemove.txt b/src/fs/files_copy/fileToRemove.txt similarity index 100% rename from src/fs/files/fileToRemove.txt rename to src/fs/files_copy/fileToRemove.txt diff --git a/src/fs/files_copy/fresh.txt b/src/fs/files_copy/fresh.txt new file mode 100644 index 0000000000..205d704cb7 --- /dev/null +++ b/src/fs/files_copy/fresh.txt @@ -0,0 +1 @@ +I am fresh and young \ No newline at end of file diff --git a/src/fs/files_copy/hello.txt b/src/fs/files_copy/hello.txt new file mode 100644 index 0000000000..4e65f7775f --- /dev/null +++ b/src/fs/files_copy/hello.txt @@ -0,0 +1 @@ +Hello Node.js \ No newline at end of file diff --git a/src/fs/files_copy/wrongFilename.txt b/src/fs/files_copy/wrongFilename.txt new file mode 100644 index 0000000000..38cca5db19 --- /dev/null +++ b/src/fs/files_copy/wrongFilename.txt @@ -0,0 +1,3 @@ +# This is a file with a wrong filename + +Hello from **markdown**! \ No newline at end of file diff --git a/src/fs/list.js b/src/fs/list.js index c0a83dea15..a98018b0a9 100644 --- a/src/fs/list.js +++ b/src/fs/list.js @@ -1,5 +1,24 @@ +import { promises as fs } from "fs"; +import path from "path"; +const __dirname = path.resolve(); + const list = async () => { - // Write your code here + // Write your code here + const file = path.join(__dirname, "files"); + try { + await fs.access(file); + } catch (error) { + throw new Error("FS operation failed"); + } + + try { + const files = await fs.readdir(file); + files.forEach((element) => { + console.log(element); + }); + } catch (error) { + throw new Error("FS operation failed"); + } }; -await list(); \ No newline at end of file +await list(); diff --git a/src/fs/read.js b/src/fs/read.js index 52c78cc6ee..7f78365cc1 100644 --- a/src/fs/read.js +++ b/src/fs/read.js @@ -1,5 +1,21 @@ +import { promises as fs } from "fs"; +import path from "path"; +const __dirname = path.resolve(); + const read = async () => { - // Write your code here + // Write your code here + const file = path.join(__dirname, "files", "fileToRead.txt"); + try { + await fs.access(file); + } catch (error) { + throw new Error("FS operation failed"); + } + try { + const filesContent = await fs.readFile(file, "utf-8"); + console.log(filesContent); + } catch (error) { + throw new Error("FS operation failed"); + } }; -await read(); \ No newline at end of file +await read(); diff --git a/src/fs/rename.js b/src/fs/rename.js index 2bb99ecdb5..7fb8f10d5e 100644 --- a/src/fs/rename.js +++ b/src/fs/rename.js @@ -1,5 +1,25 @@ +import { promises as fs } from "fs"; +import path from "path"; +const __dirname = path.resolve(); const rename = async () => { - // Write your code here + // Write your code here + const wrongFileName = path.join(__dirname, "files", "wrongFilename.txt"); + const rightFileName = path.join(__dirname, "files", "properFilename.md"); + try { + await fs.access(wrongFileName); + } catch (error) { + throw new Error("FS operation failed"); + } + try { + await fs.access(rightFileName); + throw new Error("FS operation failed"); + } catch (error) { + if (error.code !== "ENOENT") { + throw new Error("FS operation failed"); + } + } + await fs.rename(wrongFileName, rightFileName); + console.log("File renamed successfully!"); }; -await rename(); \ No newline at end of file +await rename(); From 0edb7c34ca8173b90f7dc73102137dda3e689f84 Mon Sep 17 00:00:00 2001 From: giorgi khoshtaria <99177635+g1org11@users.noreply.github.com> Date: Wed, 2 Oct 2024 16:21:34 +0400 Subject: [PATCH 2/6] add cli --- src/cli/.env | 2 ++ src/cli/args.js | 14 ++++++++++++-- src/cli/env.js | 12 ++++++++++-- 3 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 src/cli/.env diff --git a/src/cli/.env b/src/cli/.env new file mode 100644 index 0000000000..73e6491283 --- /dev/null +++ b/src/cli/.env @@ -0,0 +1,2 @@ +RSS_name1=value1 +RSS_name2=value2 diff --git a/src/cli/args.js b/src/cli/args.js index 8283f7f7aa..7744916337 100644 --- a/src/cli/args.js +++ b/src/cli/args.js @@ -1,5 +1,15 @@ const parseArgs = () => { - // Write your code here + // Write your code here + const args = process.argv.slice(2); + const result = []; + for (let i = 0; i < args.length; i += 2) { + const key = args[i].replace("--", ""); + const value = args[i + 1]; + if (value !== undefined) { + result.push(`${key} is ${value}`); + } + } + console.log(result.join(", ")); }; -parseArgs(); \ No newline at end of file +parseArgs(); diff --git a/src/cli/env.js b/src/cli/env.js index fe4aa4a8df..ca07490f74 100644 --- a/src/cli/env.js +++ b/src/cli/env.js @@ -1,5 +1,13 @@ +import dotenv from "dotenv"; +dotenv.config(); const parseEnv = () => { - // Write your code here + const envVars = []; + for (const [key, value] of Object.entries(process.env)) { + if (key.startsWith("RSS_")) { + envVars.push(`${key}=${value}`); + } + } + console.log(envVars.join(", ")); }; -parseEnv(); \ No newline at end of file +parseEnv(); From eb3d4cf7303bed3cb449f588634643afc8dac732 Mon Sep 17 00:00:00 2001 From: giorgi khoshtaria <99177635+g1org11@users.noreply.github.com> Date: Wed, 2 Oct 2024 16:48:06 +0400 Subject: [PATCH 3/6] add hash functionality --- src/hash/calcHash.js | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/src/hash/calcHash.js b/src/hash/calcHash.js index 450f8f72e2..9f00766562 100644 --- a/src/hash/calcHash.js +++ b/src/hash/calcHash.js @@ -1,5 +1,28 @@ +import fs from "fs"; +import crypto from "crypto"; +import path from "path"; + +const __dirname = path.resolve(); + const calculateHash = async () => { - // Write your code here + // Write your code here + const filePath = path.join(__dirname, "files", "fileToCalculateHashFor.txt"); + const hash = crypto.createHash("sha256"); + + const fileStream = fs.createReadStream(filePath); + + fileStream.on("data", (chunk) => { + hash.update(chunk); + }); + + fileStream.on("end", () => { + const result = hash.digest("hex"); + console.log(result); + }); + + fileStream.on("error", (error) => { + console.error("Error reading file:", error); + }); }; -await calculateHash(); \ No newline at end of file +await calculateHash(); From a4f4fdff88e6ec21348b725e879719ea9a8a2081 Mon Sep 17 00:00:00 2001 From: giorgi khoshtaria <99177635+g1org11@users.noreply.github.com> Date: Wed, 2 Oct 2024 21:21:04 +0400 Subject: [PATCH 4/6] add zip functionality --- node_modules/.package-lock.json | 20 + node_modules/dotenv/CHANGELOG.md | 475 ++++++++++++++++ node_modules/dotenv/LICENSE | 23 + node_modules/dotenv/README-es.md | 448 +++++++++++++++ node_modules/dotenv/README.md | 728 +++++++++++++++++++++++++ node_modules/dotenv/config.d.ts | 1 + node_modules/dotenv/config.js | 9 + node_modules/dotenv/lib/cli-options.js | 11 + node_modules/dotenv/lib/env-options.js | 24 + node_modules/dotenv/lib/main.d.ts | 153 ++++++ node_modules/dotenv/lib/main.js | 361 ++++++++++++ node_modules/dotenv/package.json | 65 +++ package-lock.json | 31 ++ package.json | 5 +- src/streams/files/fileToWrite.txt | 4 + src/streams/read.js | 17 +- src/streams/write.js | 24 +- src/zip/compress.js | 26 +- src/zip/decompress.js | 26 +- src/zip/files/archive.gz | Bin 0 -> 32 bytes 20 files changed, 2442 insertions(+), 9 deletions(-) create mode 100644 node_modules/.package-lock.json create mode 100644 node_modules/dotenv/CHANGELOG.md create mode 100644 node_modules/dotenv/LICENSE create mode 100644 node_modules/dotenv/README-es.md create mode 100644 node_modules/dotenv/README.md create mode 100644 node_modules/dotenv/config.d.ts create mode 100644 node_modules/dotenv/config.js create mode 100644 node_modules/dotenv/lib/cli-options.js create mode 100644 node_modules/dotenv/lib/env-options.js create mode 100644 node_modules/dotenv/lib/main.d.ts create mode 100644 node_modules/dotenv/lib/main.js create mode 100644 node_modules/dotenv/package.json create mode 100644 package-lock.json create mode 100644 src/zip/files/archive.gz diff --git a/node_modules/.package-lock.json b/node_modules/.package-lock.json new file mode 100644 index 0000000000..7df1ba9204 --- /dev/null +++ b/node_modules/.package-lock.json @@ -0,0 +1,20 @@ +{ + "name": "node-nodejs-basics", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "node_modules/dotenv": { + "version": "16.4.5", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.5.tgz", + "integrity": "sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg==", + "license": "BSD-2-Clause", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://dotenvx.com" + } + } + } +} diff --git a/node_modules/dotenv/CHANGELOG.md b/node_modules/dotenv/CHANGELOG.md new file mode 100644 index 0000000000..e35152ae27 --- /dev/null +++ b/node_modules/dotenv/CHANGELOG.md @@ -0,0 +1,475 @@ +# Changelog + +All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. + +## [Unreleased](https://github.com/motdotla/dotenv/compare/v16.4.5...master) + +## [16.4.5](https://github.com/motdotla/dotenv/compare/v16.4.4...v16.4.5) (2024-02-19) + +### Changed + +- 🐞 fix recent regression when using `path` option. return to historical behavior: do not attempt to auto find `.env` if `path` set. (regression was introduced in `16.4.3`) [#814](https://github.com/motdotla/dotenv/pull/814) + +## [16.4.4](https://github.com/motdotla/dotenv/compare/v16.4.3...v16.4.4) (2024-02-13) + +### Changed + +- 🐞 Replaced chaining operator `?.` with old school `&&` (fixing node 12 failures) [#812](https://github.com/motdotla/dotenv/pull/812) + +## [16.4.3](https://github.com/motdotla/dotenv/compare/v16.4.2...v16.4.3) (2024-02-12) + +### Changed + +- Fixed processing of multiple files in `options.path` [#805](https://github.com/motdotla/dotenv/pull/805) + +## [16.4.2](https://github.com/motdotla/dotenv/compare/v16.4.1...v16.4.2) (2024-02-10) + +### Changed + +- Changed funding link in package.json to [`dotenvx.com`](https://dotenvx.com) + +## [16.4.1](https://github.com/motdotla/dotenv/compare/v16.4.0...v16.4.1) (2024-01-24) + +- Patch support for array as `path` option [#797](https://github.com/motdotla/dotenv/pull/797) + +## [16.4.0](https://github.com/motdotla/dotenv/compare/v16.3.2...v16.4.0) (2024-01-23) + +- Add `error.code` to error messages around `.env.vault` decryption handling [#795](https://github.com/motdotla/dotenv/pull/795) +- Add ability to find `.env.vault` file when filename(s) passed as an array [#784](https://github.com/motdotla/dotenv/pull/784) + +## [16.3.2](https://github.com/motdotla/dotenv/compare/v16.3.1...v16.3.2) (2024-01-18) + +### Added + +- Add debug message when no encoding set [#735](https://github.com/motdotla/dotenv/pull/735) + +### Changed + +- Fix output typing for `populate` [#792](https://github.com/motdotla/dotenv/pull/792) +- Use subarray instead of slice [#793](https://github.com/motdotla/dotenv/pull/793) + +## [16.3.1](https://github.com/motdotla/dotenv/compare/v16.3.0...v16.3.1) (2023-06-17) + +### Added + +- Add missing type definitions for `processEnv` and `DOTENV_KEY` options. [#756](https://github.com/motdotla/dotenv/pull/756) + +## [16.3.0](https://github.com/motdotla/dotenv/compare/v16.2.0...v16.3.0) (2023-06-16) + +### Added + +- Optionally pass `DOTENV_KEY` to options rather than relying on `process.env.DOTENV_KEY`. Defaults to `process.env.DOTENV_KEY` [#754](https://github.com/motdotla/dotenv/pull/754) + +## [16.2.0](https://github.com/motdotla/dotenv/compare/v16.1.4...v16.2.0) (2023-06-15) + +### Added + +- Optionally write to your own target object rather than `process.env`. Defaults to `process.env`. [#753](https://github.com/motdotla/dotenv/pull/753) +- Add import type URL to types file [#751](https://github.com/motdotla/dotenv/pull/751) + +## [16.1.4](https://github.com/motdotla/dotenv/compare/v16.1.3...v16.1.4) (2023-06-04) + +### Added + +- Added `.github/` to `.npmignore` [#747](https://github.com/motdotla/dotenv/pull/747) + +## [16.1.3](https://github.com/motdotla/dotenv/compare/v16.1.2...v16.1.3) (2023-05-31) + +### Removed + +- Removed `browser` keys for `path`, `os`, and `crypto` in package.json. These were set to false incorrectly as of 16.1. Instead, if using dotenv on the front-end make sure to include polyfills for `path`, `os`, and `crypto`. [node-polyfill-webpack-plugin](https://github.com/Richienb/node-polyfill-webpack-plugin) provides these. + +## [16.1.2](https://github.com/motdotla/dotenv/compare/v16.1.1...v16.1.2) (2023-05-31) + +### Changed + +- Exposed private function `_configDotenv` as `configDotenv`. [#744](https://github.com/motdotla/dotenv/pull/744) + +## [16.1.1](https://github.com/motdotla/dotenv/compare/v16.1.0...v16.1.1) (2023-05-30) + +### Added + +- Added type definition for `decrypt` function + +### Changed + +- Fixed `{crypto: false}` in `packageJson.browser` + +## [16.1.0](https://github.com/motdotla/dotenv/compare/v16.0.3...v16.1.0) (2023-05-30) + +### Added + +- Add `populate` convenience method [#733](https://github.com/motdotla/dotenv/pull/733) +- Accept URL as path option [#720](https://github.com/motdotla/dotenv/pull/720) +- Add dotenv to `npm fund` command +- Spanish language README [#698](https://github.com/motdotla/dotenv/pull/698) +- Add `.env.vault` support. 🎉 ([#730](https://github.com/motdotla/dotenv/pull/730)) + +ℹ️ `.env.vault` extends the `.env` file format standard with a localized encrypted vault file. Package it securely with your production code deploys. It's cloud agnostic so that you can deploy your secrets anywhere – without [risky third-party integrations](https://techcrunch.com/2023/01/05/circleci-breach/). [read more](https://github.com/motdotla/dotenv#-deploying) + +### Changed + +- Fixed "cannot resolve 'fs'" error on tools like Replit [#693](https://github.com/motdotla/dotenv/pull/693) + +## [16.0.3](https://github.com/motdotla/dotenv/compare/v16.0.2...v16.0.3) (2022-09-29) + +### Changed + +- Added library version to debug logs ([#682](https://github.com/motdotla/dotenv/pull/682)) + +## [16.0.2](https://github.com/motdotla/dotenv/compare/v16.0.1...v16.0.2) (2022-08-30) + +### Added + +- Export `env-options.js` and `cli-options.js` in package.json for use with downstream [dotenv-expand](https://github.com/motdotla/dotenv-expand) module + +## [16.0.1](https://github.com/motdotla/dotenv/compare/v16.0.0...v16.0.1) (2022-05-10) + +### Changed + +- Minor README clarifications +- Development ONLY: updated devDependencies as recommended for development only security risks ([#658](https://github.com/motdotla/dotenv/pull/658)) + +## [16.0.0](https://github.com/motdotla/dotenv/compare/v15.0.1...v16.0.0) (2022-02-02) + +### Added + +- _Breaking:_ Backtick support 🎉 ([#615](https://github.com/motdotla/dotenv/pull/615)) + +If you had values containing the backtick character, please quote those values with either single or double quotes. + +## [15.0.1](https://github.com/motdotla/dotenv/compare/v15.0.0...v15.0.1) (2022-02-02) + +### Changed + +- Properly parse empty single or double quoted values 🐞 ([#614](https://github.com/motdotla/dotenv/pull/614)) + +## [15.0.0](https://github.com/motdotla/dotenv/compare/v14.3.2...v15.0.0) (2022-01-31) + +`v15.0.0` is a major new release with some important breaking changes. + +### Added + +- _Breaking:_ Multiline parsing support (just works. no need for the flag.) + +### Changed + +- _Breaking:_ `#` marks the beginning of a comment (UNLESS the value is wrapped in quotes. Please update your `.env` files to wrap in quotes any values containing `#`. For example: `SECRET_HASH="something-with-a-#-hash"`). + +..Understandably, (as some teams have noted) this is tedious to do across the entire team. To make it less tedious, we recommend using [dotenv cli](https://github.com/dotenv-org/cli) going forward. It's an optional plugin that will keep your `.env` files in sync between machines, environments, or team members. + +### Removed + +- _Breaking:_ Remove multiline option (just works out of the box now. no need for the flag.) + +## [14.3.2](https://github.com/motdotla/dotenv/compare/v14.3.1...v14.3.2) (2022-01-25) + +### Changed + +- Preserve backwards compatibility on values containing `#` 🐞 ([#603](https://github.com/motdotla/dotenv/pull/603)) + +## [14.3.1](https://github.com/motdotla/dotenv/compare/v14.3.0...v14.3.1) (2022-01-25) + +### Changed + +- Preserve backwards compatibility on exports by re-introducing the prior in-place exports 🐞 ([#606](https://github.com/motdotla/dotenv/pull/606)) + +## [14.3.0](https://github.com/motdotla/dotenv/compare/v14.2.0...v14.3.0) (2022-01-24) + +### Added + +- Add `multiline` option 🎉 ([#486](https://github.com/motdotla/dotenv/pull/486)) + +## [14.2.0](https://github.com/motdotla/dotenv/compare/v14.1.1...v14.2.0) (2022-01-17) + +### Added + +- Add `dotenv_config_override` cli option +- Add `DOTENV_CONFIG_OVERRIDE` command line env option + +## [14.1.1](https://github.com/motdotla/dotenv/compare/v14.1.0...v14.1.1) (2022-01-17) + +### Added + +- Add React gotcha to FAQ on README + +## [14.1.0](https://github.com/motdotla/dotenv/compare/v14.0.1...v14.1.0) (2022-01-17) + +### Added + +- Add `override` option 🎉 ([#595](https://github.com/motdotla/dotenv/pull/595)) + +## [14.0.1](https://github.com/motdotla/dotenv/compare/v14.0.0...v14.0.1) (2022-01-16) + +### Added + +- Log error on failure to load `.env` file ([#594](https://github.com/motdotla/dotenv/pull/594)) + +## [14.0.0](https://github.com/motdotla/dotenv/compare/v13.0.1...v14.0.0) (2022-01-16) + +### Added + +- _Breaking:_ Support inline comments for the parser 🎉 ([#568](https://github.com/motdotla/dotenv/pull/568)) + +## [13.0.1](https://github.com/motdotla/dotenv/compare/v13.0.0...v13.0.1) (2022-01-16) + +### Changed + +* Hide comments and newlines from debug output ([#404](https://github.com/motdotla/dotenv/pull/404)) + +## [13.0.0](https://github.com/motdotla/dotenv/compare/v12.0.4...v13.0.0) (2022-01-16) + +### Added + +* _Breaking:_ Add type file for `config.js` ([#539](https://github.com/motdotla/dotenv/pull/539)) + +## [12.0.4](https://github.com/motdotla/dotenv/compare/v12.0.3...v12.0.4) (2022-01-16) + +### Changed + +* README updates +* Minor order adjustment to package json format + +## [12.0.3](https://github.com/motdotla/dotenv/compare/v12.0.2...v12.0.3) (2022-01-15) + +### Changed + +* Simplified jsdoc for consistency across editors + +## [12.0.2](https://github.com/motdotla/dotenv/compare/v12.0.1...v12.0.2) (2022-01-15) + +### Changed + +* Improve embedded jsdoc type documentation + +## [12.0.1](https://github.com/motdotla/dotenv/compare/v12.0.0...v12.0.1) (2022-01-15) + +### Changed + +* README updates and clarifications + +## [12.0.0](https://github.com/motdotla/dotenv/compare/v11.0.0...v12.0.0) (2022-01-15) + +### Removed + +- _Breaking:_ drop support for Flow static type checker ([#584](https://github.com/motdotla/dotenv/pull/584)) + +### Changed + +- Move types/index.d.ts to lib/main.d.ts ([#585](https://github.com/motdotla/dotenv/pull/585)) +- Typescript cleanup ([#587](https://github.com/motdotla/dotenv/pull/587)) +- Explicit typescript inclusion in package.json ([#566](https://github.com/motdotla/dotenv/pull/566)) + +## [11.0.0](https://github.com/motdotla/dotenv/compare/v10.0.0...v11.0.0) (2022-01-11) + +### Changed + +- _Breaking:_ drop support for Node v10 ([#558](https://github.com/motdotla/dotenv/pull/558)) +- Patch debug option ([#550](https://github.com/motdotla/dotenv/pull/550)) + +## [10.0.0](https://github.com/motdotla/dotenv/compare/v9.0.2...v10.0.0) (2021-05-20) + +### Added + +- Add generic support to parse function +- Allow for import "dotenv/config.js" +- Add support to resolve home directory in path via ~ + +## [9.0.2](https://github.com/motdotla/dotenv/compare/v9.0.1...v9.0.2) (2021-05-10) + +### Changed + +- Support windows newlines with debug mode + +## [9.0.1](https://github.com/motdotla/dotenv/compare/v9.0.0...v9.0.1) (2021-05-08) + +### Changed + +- Updates to README + +## [9.0.0](https://github.com/motdotla/dotenv/compare/v8.6.0...v9.0.0) (2021-05-05) + +### Changed + +- _Breaking:_ drop support for Node v8 + +## [8.6.0](https://github.com/motdotla/dotenv/compare/v8.5.1...v8.6.0) (2021-05-05) + +### Added + +- define package.json in exports + +## [8.5.1](https://github.com/motdotla/dotenv/compare/v8.5.0...v8.5.1) (2021-05-05) + +### Changed + +- updated dev dependencies via npm audit + +## [8.5.0](https://github.com/motdotla/dotenv/compare/v8.4.0...v8.5.0) (2021-05-05) + +### Added + +- allow for `import "dotenv/config"` + +## [8.4.0](https://github.com/motdotla/dotenv/compare/v8.3.0...v8.4.0) (2021-05-05) + +### Changed + +- point to exact types file to work with VS Code + +## [8.3.0](https://github.com/motdotla/dotenv/compare/v8.2.0...v8.3.0) (2021-05-05) + +### Changed + +- _Breaking:_ drop support for Node v8 (mistake to be released as minor bump. later bumped to 9.0.0. see above.) + +## [8.2.0](https://github.com/motdotla/dotenv/compare/v8.1.0...v8.2.0) (2019-10-16) + +### Added + +- TypeScript types + +## [8.1.0](https://github.com/motdotla/dotenv/compare/v8.0.0...v8.1.0) (2019-08-18) + +### Changed + +- _Breaking:_ drop support for Node v6 ([#392](https://github.com/motdotla/dotenv/issues/392)) + +# [8.0.0](https://github.com/motdotla/dotenv/compare/v7.0.0...v8.0.0) (2019-05-02) + +### Changed + +- _Breaking:_ drop support for Node v6 ([#302](https://github.com/motdotla/dotenv/issues/392)) + +## [7.0.0] - 2019-03-12 + +### Fixed + +- Fix removing unbalanced quotes ([#376](https://github.com/motdotla/dotenv/pull/376)) + +### Removed + +- Removed `load` alias for `config` for consistency throughout code and documentation. + +## [6.2.0] - 2018-12-03 + +### Added + +- Support preload configuration via environment variables ([#351](https://github.com/motdotla/dotenv/issues/351)) + +## [6.1.0] - 2018-10-08 + +### Added + +- `debug` option for `config` and `parse` methods will turn on logging + +## [6.0.0] - 2018-06-02 + +### Changed + +- _Breaking:_ drop support for Node v4 ([#304](https://github.com/motdotla/dotenv/pull/304)) + +## [5.0.0] - 2018-01-29 + +### Added + +- Testing against Node v8 and v9 +- Documentation on trim behavior of values +- Documentation on how to use with `import` + +### Changed + +- _Breaking_: default `path` is now `path.resolve(process.cwd(), '.env')` +- _Breaking_: does not write over keys already in `process.env` if the key has a falsy value +- using `const` and `let` instead of `var` + +### Removed + +- Testing against Node v7 + +## [4.0.0] - 2016-12-23 + +### Changed + +- Return Object with parsed content or error instead of false ([#165](https://github.com/motdotla/dotenv/pull/165)). + +### Removed + +- `verbose` option removed in favor of returning result. + +## [3.0.0] - 2016-12-20 + +### Added + +- `verbose` option will log any error messages. Off by default. +- parses email addresses correctly +- allow importing config method directly in ES6 + +### Changed + +- Suppress error messages by default ([#154](https://github.com/motdotla/dotenv/pull/154)) +- Ignoring more files for NPM to make package download smaller + +### Fixed + +- False positive test due to case-sensitive variable ([#124](https://github.com/motdotla/dotenv/pull/124)) + +### Removed + +- `silent` option removed in favor of `verbose` + +## [2.0.0] - 2016-01-20 + +### Added + +- CHANGELOG to ["make it easier for users and contributors to see precisely what notable changes have been made between each release"](http://keepachangelog.com/). Linked to from README +- LICENSE to be more explicit about what was defined in `package.json`. Linked to from README +- Testing nodejs v4 on travis-ci +- added examples of how to use dotenv in different ways +- return parsed object on success rather than boolean true + +### Changed + +- README has shorter description not referencing ruby gem since we don't have or want feature parity + +### Removed + +- Variable expansion and escaping so environment variables are encouraged to be fully orthogonal + +## [1.2.0] - 2015-06-20 + +### Added + +- Preload hook to require dotenv without including it in your code + +### Changed + +- clarified license to be "BSD-2-Clause" in `package.json` + +### Fixed + +- retain spaces in string vars + +## [1.1.0] - 2015-03-31 + +### Added + +- Silent option to silence `console.log` when `.env` missing + +## [1.0.0] - 2015-03-13 + +### Removed + +- support for multiple `.env` files. should always use one `.env` file for the current environment + +[7.0.0]: https://github.com/motdotla/dotenv/compare/v6.2.0...v7.0.0 +[6.2.0]: https://github.com/motdotla/dotenv/compare/v6.1.0...v6.2.0 +[6.1.0]: https://github.com/motdotla/dotenv/compare/v6.0.0...v6.1.0 +[6.0.0]: https://github.com/motdotla/dotenv/compare/v5.0.0...v6.0.0 +[5.0.0]: https://github.com/motdotla/dotenv/compare/v4.0.0...v5.0.0 +[4.0.0]: https://github.com/motdotla/dotenv/compare/v3.0.0...v4.0.0 +[3.0.0]: https://github.com/motdotla/dotenv/compare/v2.0.0...v3.0.0 +[2.0.0]: https://github.com/motdotla/dotenv/compare/v1.2.0...v2.0.0 +[1.2.0]: https://github.com/motdotla/dotenv/compare/v1.1.0...v1.2.0 +[1.1.0]: https://github.com/motdotla/dotenv/compare/v1.0.0...v1.1.0 +[1.0.0]: https://github.com/motdotla/dotenv/compare/v0.4.0...v1.0.0 diff --git a/node_modules/dotenv/LICENSE b/node_modules/dotenv/LICENSE new file mode 100644 index 0000000000..c430ad8bd0 --- /dev/null +++ b/node_modules/dotenv/LICENSE @@ -0,0 +1,23 @@ +Copyright (c) 2015, Scott Motte +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/node_modules/dotenv/README-es.md b/node_modules/dotenv/README-es.md new file mode 100644 index 0000000000..154c139094 --- /dev/null +++ b/node_modules/dotenv/README-es.md @@ -0,0 +1,448 @@ +
+🎉 announcing dotenvx. run anywhere, multi-environment, encrypted envs. +
+ +  + +
+ +

+ + Dotenv es apoyado por la comunidad. + +

+Gracias espaciales a: +
+
+ +
+ Warp +
+ Warp es una rápida e impresionante terminal basada en Rust, reinventado para funcionar como una aplicación moderna. +
+ Haga más en la CLI con edición de texto real, resultado básado en bloques, y busqueda de comandos de IA. +
+
+
+ +
+ Retool +
+ Retool ayuda a los desarrolladores a crear software interno personalizado, como aplicaciones CRUD y paneles de administración, realmente rápido. +
+ Construya Interfaces de Usuario de forma visual con componentes flexibles, conéctese a cualquier fuente de datos, y escriba lógica de negocio en JavaScript. +
+
+
+ +
+ WorkOS +
+ Su Apliación, Lista para la Empresa. +
+ Agrega Inicio de Sesión Único, Autenticación Multi-Factor, y mucho más, en minutos en lugar de meses. +
+
+
+
+
+
+
+ +
+ +# dotenv [![NPM version](https://img.shields.io/npm/v/dotenv.svg?style=flat-square)](https://www.npmjs.com/package/dotenv) + +dotenv + +Dotenv es un módulo de dependencia cero que carga las variables de entorno desde un archivo `.env` en [`process.env`](https://nodejs.org/docs/latest/api/process.html#process_process_env). El almacenamiento de la configuración del entorno separado del código está basado en la metodología [The Twelve-Factor App](http://12factor.net/config). + +[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard) +[![LICENSE](https://img.shields.io/github/license/motdotla/dotenv.svg)](LICENSE) + +## Instalación + +```bash +# instalación local (recomendado) +npm install dotenv --save +``` + +O installación con yarn? `yarn add dotenv` + +## Uso + +Cree un archivo `.env` en la raíz de su proyecto: + +```dosini +S3_BUCKET="YOURS3BUCKET" +SECRET_KEY="YOURSECRETKEYGOESHERE" +``` + +Tan prónto como sea posible en su aplicación, importe y configure dotenv: + +```javascript +require('dotenv').config() +console.log(process.env) // elimine esto después que haya confirmado que esta funcionando +``` + +.. o usa ES6? + +```javascript +import * as dotenv from 'dotenv' // vea en https://github.com/motdotla/dotenv#como-uso-dotenv-con-import +// REVISAR LINK DE REFERENCIA DE IMPORTACIÓN +dotenv.config() +import express from 'express' +``` + +Eso es todo. `process.env` ahora tiene las claves y los valores que definiste en tu archivo `.env`: + +```javascript +require('dotenv').config() + +... + +s3.getBucketCors({Bucket: process.env.S3_BUCKET}, function(err, data) {}) +``` + +### Valores multilínea + +Si necesita variables de varias líneas, por ejemplo, claves privadas, ahora se admiten en la versión (`>= v15.0.0`) con saltos de línea: + +```dosini +PRIVATE_KEY="-----BEGIN RSA PRIVATE KEY----- +... +Kh9NV... +... +-----END RSA PRIVATE KEY-----" +``` + +Alternativamente, puede usar comillas dobles y usar el carácter `\n`: + +```dosini +PRIVATE_KEY="-----BEGIN RSA PRIVATE KEY-----\nKh9NV...\n-----END RSA PRIVATE KEY-----\n" +``` + +### Comentarios + +Los comentarios pueden ser agregados en tu archivo o en la misma línea: + +```dosini +# This is a comment +SECRET_KEY=YOURSECRETKEYGOESHERE # comment +SECRET_HASH="something-with-a-#-hash" +``` + +Los comentarios comienzan donde existe un `#`, entonces, si su valor contiene un `#`, enciérrelo entre comillas. Este es un cambio importante desde la versión `>= v15.0.0` en adelante. + +### Análisis + +El motor que analiza el contenido de su archivo que contiene variables de entorno está disponible para su uso. Este Acepta una Cadena o un Búfer y devolverá un Objeto con las claves y los valores analizados. + +```javascript +const dotenv = require('dotenv') +const buf = Buffer.from('BASICO=basico') +const config = dotenv.parse(buf) // devolverá un objeto +console.log(typeof config, config) // objeto { BASICO : 'basico' } +``` + +### Precarga + +Puede usar el `--require` (`-r`) [opción de línea de comando](https://nodejs.org/api/cli.html#-r---require-module) para precargar dotenv. Al hacer esto, no necesita requerir ni cargar dotnev en el código de su aplicación. + +```bash +$ node -r dotenv/config tu_script.js +``` + +Las opciones de configuración a continuación se admiten como argumentos de línea de comandos en el formato `dotenv_config_