mirror of
https://github.com/toddbluhm/env-cmd.git
synced 2025-12-08 18:23:33 +00:00
Merge pull request #128 from vitaliytv/master
fix: add type module support
This commit is contained in:
commit
e5163d7012
2
dist/parse-env-file.js
vendored
2
dist/parse-env-file.js
vendored
@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const utils_1 = require("./utils");
|
||||
const REQUIRE_HOOK_EXTENSIONS = ['.json', '.js'];
|
||||
const REQUIRE_HOOK_EXTENSIONS = ['.json', '.js', '.cjs'];
|
||||
/**
|
||||
* Gets the environment vars from an env file
|
||||
*/
|
||||
|
||||
2
dist/parse-rc-file.js
vendored
2
dist/parse-rc-file.js
vendored
@ -23,7 +23,7 @@ async function getRCFileVars({ environments, filePath }) {
|
||||
const ext = path_1.extname(absolutePath).toLowerCase();
|
||||
let parsedData;
|
||||
try {
|
||||
if (ext === '.json' || ext === '.js') {
|
||||
if (ext === '.json' || ext === '.js' || ext === '.cjs') {
|
||||
const possiblePromise = require(absolutePath); /* eslint-disable-line */
|
||||
parsedData = utils_1.isPromise(possiblePromise) ? await possiblePromise : possiblePromise;
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@ import * as fs from 'fs'
|
||||
import * as path from 'path'
|
||||
import { resolveEnvFilePath, isPromise } from './utils'
|
||||
|
||||
const REQUIRE_HOOK_EXTENSIONS = ['.json', '.js']
|
||||
const REQUIRE_HOOK_EXTENSIONS = ['.json', '.js', '.cjs']
|
||||
|
||||
/**
|
||||
* Gets the environment vars from an env file
|
||||
|
||||
@ -26,7 +26,7 @@ export async function getRCFileVars (
|
||||
const ext = extname(absolutePath).toLowerCase()
|
||||
let parsedData: { [key: string]: any }
|
||||
try {
|
||||
if (ext === '.json' || ext === '.js') {
|
||||
if (ext === '.json' || ext === '.js' || ext === '.cjs') {
|
||||
const possiblePromise = require(absolutePath) /* eslint-disable-line */
|
||||
parsedData = isPromise(possiblePromise) ? await possiblePromise : possiblePromise
|
||||
} else {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user