GithubHelp home page GithubHelp logo

marcocesarato / dotenv-mono Goto Github PK

View Code? Open in Web Editor NEW
37.0 37.0 3.0 674 KB

This package permit to have a centralized dotenv on a monorepo. It also includes some extra features such as manipulation and saving of changes to the dotenv file, a default centralized file, and a file loader with ordering and priorities.

License: GNU General Public License v3.0

JavaScript 12.90% TypeScript 87.10%
defaults development dotenv dotenv-expand edit env environment local mono monorepo nextjs node nodejs packages production shared storybook test turbo turborepo

dotenv-mono's Introduction

Hi there ๐Ÿ‘‹

I'm Marco Cesarato, a Italian Fullstack Software Engineer.

I'm a weird guy ๐Ÿ‘ฝ who likes making weird things with the technology.

I like to resolve problems, create smart user interfaces and imagine useful interaction, developing rich web experiences & good web and mobile applications. I care about creating high-quality, in terms of UI/UX ๐Ÿ”ญ and performance ๐Ÿš€, applications.

I know likely all the most popular programming languages ๐Ÿ˜†, but I'm ready to pick up new one ๐ŸŒฑ.

  • ๐Ÿ‘ถ Programming since: 2012
  • ๐Ÿ“š Interests: I'm always interested in learning
  • ๐Ÿ˜ Favorite Programming Language: probably are TypeScript and Python, because they can be well structured and is dynamic at the same time, don't need too much external libaries and its learning cost is very low, saving more valuable time
  • ๐ŸŽฎ Hobbies: I like to play to League of Legends and I think to be a decent player, peak elo Master ๐Ÿ˜ƒ

dotenv-mono's People

Contributors

dependabot[bot] avatar dgattey avatar dobesv avatar leosuncin avatar marcocesarato avatar mathieudoyon avatar rdy avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

dotenv-mono's Issues

[Feature request] add a separate script to just load the .env files

Actual behavior

Currently you need to import the library and call the load function

import { load } from 'dotenv-mono';

load()

Requested behavior

Using dotenv you can directly require the library

node -r dotenv/config your/script.js

So, this would be possible

node -r dotenv-mono/load your/script.js

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

This repository currently has no open or pending branches.

Detected dependencies

github-actions
.github/workflows/eslint.yml
  • actions/checkout v3
  • github/codeql-action v2
.github/workflows/node.js.yml
  • actions/checkout v3
  • actions/setup-node v3
  • borales/actions-yarn v4
  • borales/actions-yarn v4
  • borales/actions-yarn v4
npm
package.json
  • dotenv ^16.3.1
  • dotenv-expand ^10.0.0
  • @types/jest ^29.5.2
  • @types/mock-fs ^4.13.1
  • @types/node ^20.3.1
  • @typescript-eslint/eslint-plugin ^5.60.0
  • @typescript-eslint/parser ^5.60.0
  • eslint ^8.43.0
  • eslint-config-prettier ^8.8.0
  • eslint-plugin-jest ^27.2.2
  • eslint-plugin-jest-extended ^2.0.0
  • eslint-plugin-prettier ^4.2.1
  • eslint-plugin-simple-import-sort ^10.0.0
  • husky ^8.0.3
  • jest ^29.5.0
  • jest-extended ^4.0.0
  • lint-staged ^13.2.2
  • mock-fs ^5.2.0
  • prettier ^2.8.8
  • standard-version ^9.5.0
  • ts-jest ^29.1.0
  • typescript ^5.1.3

  • Check this box to trigger a request for Renovate to run again on this repository

Add dotenv-mono binary

Similar to what https://www.npmjs.com/package/dotenv-cli does, can we additionally export dotenv-mono as a executable script?

That would allow to replace the ugly NODE_OPTIONS='-r dotenv-mono/load' vite-node --script src/rake.ts with dotenv-mono -- vite-node --script src/rake.ts. That would even allow to use dotenv-mono to run non-node scripts.

Should `match` assignment in `find` occur earlier?

Given the following project structure (a root-level .env file and a .env file within a src directory; see this repo):

.env
src
 |- .env
 |- index.js

where the contents of the two .env files are as follows:

# .env
VALUE=outer

# src/.env
VALUE=inner

I would expect the following behavior from this JavaScript file:

// src/index.js
require("dotenv-mono").load();
console.log("cwd is", process.cwd());
console.log("process.env.VALUE is", process.env.VALUE);
  1. When executed from the project's root directory, I would expect:
$ node src/index.js
cwd is .../<project-root-dir>
process.env.VALUE is outer
                     ^^^^^
  1. When executed from the src directory, I would expect:
$ node index.js
cwd is .../<project-root-dir>/src
process.env.VALUE is inner
                     ^^^^^

However, in both cases the value of the VALUE environment variable is outer. That is, even when the program is executed from within the src directory, the root-level .env file is used.

๐Ÿค” Am I misunderstanding the documentation on this point?

Starting from the current process directory, this package finds the first file that matches the best filepath and filename criteria with the highest priority. The greater the depth of the up folder, the lesser its priority.

I wonder if this check needs to be swapped with the line before it. If that's the case, I can open a PR with the change.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.