Skip to content

Commit

Permalink
fix env
Browse files Browse the repository at this point in the history
  • Loading branch information
liuxingbaoyu committed Mar 1, 2024
1 parent ef886ca commit 45736fd
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/babel-helpers/scripts/generate-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { minify } from "terser";
import { transformSync } from "@babel/core";
import presetTypescript from "@babel/preset-typescript";
import { gzipSync } from "zlib";
import { IS_BABEL_8 } from "$repo-utils";

const HELPERS_FOLDER = new URL("../src/helpers", import.meta.url);
const IGNORED_FILES = new Set(["package.json"]);
Expand Down Expand Up @@ -51,7 +52,7 @@ export default Object.freeze({
}
const { minVersion } = minVersionMatch.groups;

if (process.env.BABEL_8_BREAKING && code.includes("@onlyBabel7")) {
if (IS_BABEL_8() && code.includes("@onlyBabel7")) {
continue;
}

Expand Down
4 changes: 4 additions & 0 deletions scripts/repo-utils/index.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ try {
USE_ESM = type === "module";
} catch (_) {}

function bool(value) {
return value && value !== "false" && value !== "0";
}
exports.USE_ESM = USE_ESM;
exports.IS_BABEL_8 = () => bool(process.env.BABEL_8_BREAKING);

if (typeof jest !== "undefined") {
const dummy = () => {};
Expand Down
1 change: 1 addition & 0 deletions scripts/repo-utils/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export const USE_ESM: boolean;
export const IS_BABEL_8: () => boolean;
export function commonJS(metaUrl: string): {
__dirname: string;
__filename: string;
Expand Down

0 comments on commit 45736fd

Please sign in to comment.