feat: initial commit

This commit is contained in:
Carlos
2024-08-12 22:57:35 -04:00
commit 6f68ae8259
13140 changed files with 1104801 additions and 0 deletions

21
node_modules/dotenv-defaults/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2018 Matt Steele
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

78
node_modules/dotenv-defaults/README.md generated vendored Normal file
View File

@@ -0,0 +1,78 @@
# dotenv-defaults
A dotenv system that supports defaults
### Status
![npm](https://img.shields.io/npm/v/dotenv-defaults.svg)
[![Main](https://github.com/mrsteele/dotenv-defaults/actions/workflows/main.yml/badge.svg)](https://github.com/mrsteele/dotenv-defaults/actions/workflows/main.yml)
[![dependabot badge](https://badgen.net/dependabot/mrsteele/dotenv-defaults?icon=dependabot)](https://dependabot.com/)
### Installation
Use the following to install this module.
```
npm i dotenv-defaults --save
```
### Usage
This module supports all the features from the original [dotenv](https://www.npmjs.com/package/dotenv) module, so usage should be simple enough:
```
# .env.defaults, safe to commit
HOST=website.com
EMAIL=test@email.com
```
```
# .env, DO NOT COMMIT
HOST=omnionline.us
```
The result
```js
require('dotenv-defaults').config()
// Or you can also load it directly like this
require('dotenv-defaults/config')
console.log(process.env.HOST)
// Outputs: omnionline.us
console.log(process.env.EMAIL)
// Outputs: test@email.com
```
##### TypeScript
Since this module does not provide TypeScript Type Definitions if you try to import it like `import dotenv from "dotenv-defaults"` TypeScript will return an error.
Instead you should load it like this:
```typescript
import "dotenv-defaults/config"
```
##### CLI
You can also call this module directly when using the node executable.
So, for example if you are running a custom script with node and you want to load your environment variables you can do the following `node -r dotenv-defaults/config your-script.js`. (_When using this method, please make sure that you have installed dotenv-defaults with npm or yarn in the same directory_)
### Differences
The only thing to note is that the original module supported an `options` argument in the `config` function.
This module supports that as well, but there is an added `defaults` property that can allow you to define where that file is located. An example is shown below:
```js
// all of these are the default values...
require(`dotenv-defaults`).config({
path: './.env',
encoding: 'utf8',
defaults: './.env.defaults' // This is new
})
```
### License
MIT

7
node_modules/dotenv-defaults/config.js generated vendored Normal file
View File

@@ -0,0 +1,7 @@
// The purpose of this file is to be able to load the module with...
// ... "require("dotenv-defaults/config")" in JavaScript or "import "dotenv-defaults/config"" in TypeScript...
// ... or "node -r dotenv-defaults/config script.js" from the command line
(function () {
require('./src/index').config()
})()

43
node_modules/dotenv-defaults/package.json generated vendored Normal file
View File

@@ -0,0 +1,43 @@
{
"name": "dotenv-defaults",
"version": "2.0.2",
"description": "dotenv... but with defaults!",
"main": "src/index.js",
"scripts": {
"test": "jest",
"lint": "standard"
},
"repository": {
"type": "git",
"url": "https://github.com/mrsteele/dotenv-defaults.git"
},
"keywords": [
"dotenv",
"defaults",
"extension",
"env",
"default",
"fallback"
],
"author": "Matt Steele <matt@omnionline.us> (http://omnionline.us/)",
"license": "MIT",
"bugs": {
"url": "https://github.com/mrsteele/dotenv-defaults/issues"
},
"files": [
"src",
"config.js"
],
"homepage": "https://github.com/mrsteele/dotenv-defaults#readme",
"dependencies": {
"dotenv": "^8.2.0"
},
"devDependencies": {
"jest": "^25.0.0",
"standard": "^14.3.4"
},
"jest": {
"coverageDirectory": "./coverage/",
"collectCoverage": true
}
}

44
node_modules/dotenv-defaults/src/index.js generated vendored Normal file
View File

@@ -0,0 +1,44 @@
const dotenv = require('dotenv')
/**
* Merges two objects.
* @param {Object} apply - The overwriter
* @param {Object} defaults - The defaults to be overwritten
* @returns {Object} The merged results.
*/
const merge = (apply = {}, defaults = {}) => Object.assign({}, defaults, apply)
/**
* Parses objects like before, but with defaults!
* @param {String} src - The original src.
* @param {String} [defaultSrc=''] - The new-and-improved default source.
* @returns {Object} The parsed results.
*/
const parse = (src, defaultSrc = '') => {
const parsedSrc = dotenv.parse(src)
const parsedDefault = dotenv.parse(defaultSrc)
return merge(parsedSrc, parsedDefault)
}
/**
* Runs the configurations and applies it to process.env.
* @param {Object} [options={}] - The options to determnie how this goes
* @returns {Object} The parsed results.
*/
const config = (options = {}) => {
const src = dotenv.config(options)
// we run this second so it doesn't override things set from src
const defaults = dotenv.config(Object.assign({}, options, {
path: options.defaults || '.env.defaults'
}))
return {
parsed: merge(src.parsed, defaults.parsed)
}
}
module.exports = {
parse,
config
}

71
node_modules/dotenv-defaults/src/index.test.js generated vendored Normal file
View File

@@ -0,0 +1,71 @@
/* global describe, test, expect, afterEach */
const Module = require('./index')
describe('dotenv-defaults', () => {
describe('root', () => {
test('should exist', () => {
expect(Module).toBeDefined()
})
})
describe('config', () => {
afterEach(() => {
delete process.env.TEST
delete process.env.TEST2
})
test('should be a function', () => {
expect(typeof Module.config).toEqual('function')
})
test('should by default write to process.env', () => {
expect(Module.config()).toEqual({
parsed: {
TEST: 'hello',
TEST2: 'whatever'
}
})
})
test('should support alternative defaults', () => {
expect(Module.config({
defaults: '.env.defaults2'
})).toEqual({
parsed: {
TEST: 'hello',
TEST2: 'whatever2'
}
})
})
})
describe('parse', () => {
test('should exist', () => {
expect(Module.parse).toBeDefined()
})
test('should be a function', () => {
expect(typeof Module.parse).toEqual('function')
})
test('should read variables', () => {
expect(Module.parse('TEST=hello')).toEqual({ TEST: 'hello' })
})
test('should include defaults', () => {
const src = 'TEST=hello'
const defaults = 'TEST2=goodbye'
expect(Module.parse(src, defaults)).toEqual({
TEST: 'hello',
TEST2: 'goodbye'
})
})
test('should not override defaults', () => {
const src = 'TEST=hello'
const defaults = 'TEST=goodbye'
expect(Module.parse(src, defaults)).toEqual({ TEST: 'hello' })
})
})
})