Skip to content

Commit

Permalink
chore(internal): fix deno build (#98)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-bot authored and rattrayalex committed Aug 9, 2023
1 parent 1f701bf commit f011e04
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
3 changes: 3 additions & 0 deletions scripts/denoify.ts
Expand Up @@ -23,6 +23,9 @@ function denoify() {
} else if (specifier.startsWith(pkgName + '/')) {
// convert self-referencing module specifiers to relative paths
specifier = file.getRelativePathAsModuleSpecifierTo(denoDir + specifier.substring(pkgName.length));
} else if (specifier === 'qs') {
decl.replaceWithText(`import { qs } from "https://deno.land/x/deno_qs@0.0.1/mod.ts"`);
continue;
} else if (!decl.isModuleSpecifierRelative()) {
specifier = `npm:${specifier}`;
}
Expand Down
12 changes: 7 additions & 5 deletions src/core.ts
Expand Up @@ -767,14 +767,16 @@ export const ensurePresent = <T>(value: T | null | undefined): T => {
/**
* Read an environment variable.
*
* Will return an empty string if the environment variable doesn't exist or cannot be accessed.
* Will return undefined if the environment variable doesn't exist or cannot be accessed.
*/
export const readEnv = (env: string): string | undefined => {
if (typeof process === 'undefined') {
return undefined;
if (typeof process !== 'undefined') {
return process.env[env] ?? undefined;
}

return process.env[env] ?? undefined;
if (typeof Deno !== 'undefined') {
return Deno.env.get(env);
}
return undefined;
};

export const coerceInteger = (value: unknown): number => {
Expand Down

0 comments on commit f011e04

Please sign in to comment.