add env checks

This commit is contained in:
silverwind 2020-07-21 21:54:29 +02:00
parent 71079e84ca
commit eee1f5e403
Signed by: silverwind
GPG Key ID: 2E62B41C93869443
2 changed files with 13 additions and 6 deletions

@ -42,9 +42,9 @@ module.exports = {
require("@rollup/plugin-commonjs")({
sourceMap: false,
}),
require("rollup-plugin-terser").terser({
output: {comments: false},
}),
// require("rollup-plugin-terser").terser({
// output: {comments: false},
// }),
],
};

@ -15,9 +15,16 @@ import {lstatSync, readFileSync, truncateSync, writeFileSync, accessSync} from "
import {platform} from "os";
import {version} from "./package.json";
const red = str => `\x1b[31m${str}\x1b[0m`;
const green = str => `\x1b[32m${str}\x1b[0m`;
const gray = str => `\x1b[90m${str}\x1b[0m`;
let red, green, gray;
if (!("NO_COLOR" in process.env) && ("FORCE_COLOR" in process.env || process.platform === "win32" || (stdout !== null && stdout.isTTY && env.TERM && env.TERM !== "dumb"))) {
red = str => `\x1b[31m${str}\x1b[0m`;
green = str => `\x1b[32m${str}\x1b[0m`;
gray = str => `\x1b[90m${str}\x1b[0m`;
} else {
red = str => str;
green = str => str;
gray = str => str;
}
env.NODE_ENV = "production";