mirror of
https://github.com/toddbluhm/env-cmd.git
synced 2025-12-08 18:23:33 +00:00
chore: fix CI failing on the master branch
This commit is contained in:
parent
35bee4087a
commit
adf1934f01
2
dist/expand-envs.js
vendored
2
dist/expand-envs.js
vendored
@ -6,6 +6,6 @@ export function expandEnvs(str, envs) {
|
||||
return str.replace(/(?<!\\)\$[a-zA-Z0-9_]+/g, (varName) => {
|
||||
const varValue = envs[varName.slice(1)];
|
||||
// const test = 42;
|
||||
return varValue === undefined ? varName : varValue.toString();
|
||||
return varValue ?? varName;
|
||||
});
|
||||
}
|
||||
|
||||
4
dist/parse-env-file.js
vendored
4
dist/parse-env-file.js
vendored
@ -49,7 +49,7 @@ export async function getEnvFileVars(envFilePath) {
|
||||
*/
|
||||
export function parseEnvString(envFileString) {
|
||||
// First thing we do is stripe out all comments
|
||||
envFileString = stripComments(envFileString.toString());
|
||||
envFileString = stripComments(envFileString);
|
||||
// Next we stripe out all the empty lines
|
||||
envFileString = stripEmptyLines(envFileString);
|
||||
// Merge the file env vars with the current process env vars (the file vars overwrite process vars)
|
||||
@ -110,7 +110,7 @@ export function normalizeEnvObject(input, absolutePath) {
|
||||
const env = {};
|
||||
for (const [key, value] of Object.entries(input)) {
|
||||
// we're intentionally stringifying the value here, to
|
||||
// match what `child_process.spawn` does when loading
|
||||
// match what `child_process.spawn` does when loading
|
||||
// env variables.
|
||||
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
||||
env[key] = `${value}`;
|
||||
|
||||
@ -8,6 +8,6 @@ export function expandEnvs(str: string, envs: Environment): string {
|
||||
return str.replace(/(?<!\\)\$[a-zA-Z0-9_]+/g, (varName) => {
|
||||
const varValue = envs[varName.slice(1)]
|
||||
// const test = 42;
|
||||
return varValue === undefined ? varName : varValue.toString()
|
||||
return varValue ?? varName
|
||||
})
|
||||
}
|
||||
|
||||
@ -56,7 +56,7 @@ export async function getEnvFileVars(envFilePath: string): Promise<Environment>
|
||||
*/
|
||||
export function parseEnvString(envFileString: string): Environment {
|
||||
// First thing we do is stripe out all comments
|
||||
envFileString = stripComments(envFileString.toString())
|
||||
envFileString = stripComments(envFileString)
|
||||
|
||||
// Next we stripe out all the empty lines
|
||||
envFileString = stripEmptyLines(envFileString)
|
||||
@ -126,7 +126,7 @@ export function normalizeEnvObject(input: unknown, absolutePath: string): Enviro
|
||||
const env: Environment = {};
|
||||
for (const [key, value] of Object.entries(input)) {
|
||||
// we're intentionally stringifying the value here, to
|
||||
// match what `child_process.spawn` does when loading
|
||||
// match what `child_process.spawn` does when loading
|
||||
// env variables.
|
||||
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
||||
env[key] = `${value}`
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user