Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@dumlj/feature-dotenv

Package Overview
Dependencies
Maintainers
3
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dumlj/feature-dotenv - npm Package Compare versions

Comparing version 2.5.23 to 2.5.24

6

libs/index.d.ts

@@ -5,3 +5,3 @@ /**

*/
export declare const parseDotEnvFile: (file: string) => Promise<{
export declare function parseDotEnvFile(file: string): Promise<{
content: any;

@@ -14,3 +14,3 @@ variables: string[];

*/
export declare const findMissingVariables: (files: string[]) => Promise<{
export declare function findMissingVariables(files: string[]): Promise<{
variables: Record<string, string[]>;

@@ -29,2 +29,2 @@ files: Record<string, {

*/
export declare const validateDotEnv: (files: string[]) => Promise<string[]>;
export declare function validateDotEnv(files: string[]): Promise<string[]>;

@@ -12,3 +12,3 @@ "use strict";

*/
const parseDotEnvFile = async (file) => {
async function parseDotEnvFile(file) {
const content = (await fs_extra_1.default.readFile(file)).toString('utf-8');

@@ -18,3 +18,3 @@ const parsed = (0, dotenv_1.parse)(content);

return { content, variables };
};
}
exports.parseDotEnvFile = parseDotEnvFile;

@@ -25,7 +25,7 @@ /**

*/
const findMissingVariables = async (files) => {
async function findMissingVariables(files) {
const variables = {};
const fileMap = {};
await Promise.all(files.map(async (file) => {
const { content, variables: names } = await (0, exports.parseDotEnvFile)(file);
const { content, variables: names } = await parseDotEnvFile(file);
names.forEach((name) => {

@@ -47,3 +47,3 @@ if (!Array.isArray(variables[name])) {

return { variables, files: fileMap, missing };
};
}
exports.findMissingVariables = findMissingVariables;

@@ -54,3 +54,3 @@ /**

*/
const validateDotEnv = async (files) => {
async function validateDotEnv(files) {
const cwd = process.cwd();

@@ -61,3 +61,3 @@ if (!(files?.length > 0)) {

const invalids = [];
const { missing, variables, files: fileMap } = await (0, exports.findMissingVariables)(files);
const { missing, variables, files: fileMap } = await findMissingVariables(files);
invalids.push(...missing.map(({ file, variables }) => (variables.length > 0 ? `File ${path_1.default.relative(cwd, file)} lacks environment variables: ${variables.join(', ')}` : '')).filter(Boolean));

@@ -74,4 +74,4 @@ const missingVariables = Array.from(new Set(Object.values(missing).flatMap(({ variables }) => variables)));

return invalids;
};
}
exports.validateDotEnv = validateDotEnv;
//# sourceMappingURL=index.js.map
{
"name": "@dumlj/feature-dotenv",
"version": "2.5.23",
"version": "2.5.24",
"description": "dotenv utilities.",

@@ -13,2 +13,7 @@ "repository": {

"types": "./libs/index.d.ts",
"scripts": {
"compile": "tsc --project ./tsconfig.compile.json",
"dev": "jest --watch",
"test": "jest"
},
"dependencies": {

@@ -26,3 +31,3 @@ "dotenv": "^16.3.1",

},
"gitHead": "af7572cfa6c1e5d6ce8c57588b581e881b1ca679"
"gitHead": "4a0c12e0d7d041313b742ec998b6959a03d91c47"
}

@@ -8,3 +8,2 @@ <!-- This file is dynamically generated. please edit in __readme__ -->

[![codecov](https://codecov.io/gh/dumlj/dumlj-build/graph/badge.svg?token=ELV5W1H0C0)](https://codecov.io/gh/dumlj/dumlj-build)&nbsp;
[![DeepSource](https://app.deepsource.com/gh/dumlj/dumlj-build.svg/?label=active+issues&show_trend=true&token=YtSFFZ702Q016pjWlBWT30Iy)](https://app.deepsource.com/gh/dumlj/dumlj-build/)&nbsp;

@@ -11,0 +10,0 @@ # Feature Dotenv

@@ -9,3 +9,3 @@ import { parse } from 'dotenv'

*/
export const parseDotEnvFile = async (file: string) => {
export async function parseDotEnvFile(file: string) {
const content = (await fs.readFile(file)).toString('utf-8')

@@ -21,3 +21,3 @@ const parsed = parse(content)

*/
export const findMissingVariables = async (files: string[]) => {
export async function findMissingVariables(files: string[]) {
const variables: Record<string, string[]> = {}

@@ -57,3 +57,3 @@ const fileMap: Record<string, { content: string }> = {}

*/
export const validateDotEnv = async (files: string[]) => {
export async function validateDotEnv(files: string[]) {
const cwd = process.cwd()

@@ -60,0 +60,0 @@ if (!(files?.length > 0)) {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc