flex-plugins-utils-env
Advanced tools
Comparing version 0.19.0 to 4.5.1-dev.202103291654
@@ -1,1 +0,1 @@ | ||
export { default } from './lib/env'; | ||
export { default, default as env, Environment, Lifecycle, Realm } from './lib/env'; |
"use strict"; | ||
/* eslint-disable import/no-unused-modules */ | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Lifecycle = exports.Environment = exports.env = exports.default = void 0; | ||
var env_1 = require("./lib/env"); | ||
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return env_1.default; } }); | ||
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(env_1).default; } }); | ||
Object.defineProperty(exports, "env", { enumerable: true, get: function () { return __importDefault(env_1).default; } }); | ||
Object.defineProperty(exports, "Environment", { enumerable: true, get: function () { return env_1.Environment; } }); | ||
Object.defineProperty(exports, "Lifecycle", { enumerable: true, get: function () { return env_1.Lifecycle; } }); | ||
//# sourceMappingURL=index.js.map |
export declare type Realm = 'dev' | 'stage'; | ||
export declare enum Environment { | ||
Production = "production", | ||
Development = "development", | ||
Test = "test" | ||
} | ||
export declare enum Lifecycle { | ||
Test = "test", | ||
Build = "build", | ||
Prebuild = "prebuild", | ||
Deploy = "deploy", | ||
Predeploy = "predeploy" | ||
} | ||
export declare const skipPreflightCheck: () => boolean; | ||
export declare const allowUnbundledReact: () => boolean; | ||
export declare const getAccountSid: () => string | undefined; | ||
export declare const getAuthToken: () => string | undefined; | ||
export declare const hasHost: () => boolean; | ||
export declare const getHost: () => string | undefined; | ||
export declare const setHost: (host: string) => string; | ||
export declare const hasPort: () => boolean; | ||
export declare const getPort: () => number; | ||
export declare const setPort: (port: number) => string; | ||
export declare const getNodeEnv: () => string; | ||
export declare const setNodeEnv: (_env: Environment) => string; | ||
export declare const getBabelEnv: () => string; | ||
export declare const setBabelEnv: (_env: Environment) => string; | ||
export declare const getLifecycle: () => string; | ||
export declare const isLifecycle: (cycle: Lifecycle) => boolean; | ||
export declare const isHTTPS: () => boolean; | ||
export declare const setWDSSocketHost: (host: string) => string; | ||
export declare const getWDSSocketHost: () => string | undefined; | ||
export declare const setWDSSocketPath: (path: string) => string; | ||
export declare const getWDSSocketPath: () => string | undefined; | ||
export declare const setWDSSocketPort: (port: number) => string; | ||
export declare const getWDSSocketPort: () => number; | ||
export declare const getWSSocket: () => Record<string, string | undefined>; | ||
export declare const isNode: () => boolean; | ||
export declare const isWin32: () => boolean; | ||
export declare const isCI: () => boolean; | ||
/** | ||
* Sets the environment to persist the terminal | ||
*/ | ||
export declare const persistTerminal: () => void; | ||
/** | ||
* Determines if the terminal should be persisted or not | ||
*/ | ||
export declare const isTerminalPersisted: () => boolean; | ||
/** | ||
* Determines whether script should run in quiet mode | ||
*/ | ||
export declare const isQuiet: () => boolean; | ||
/** | ||
* Sets the quiet mode | ||
*/ | ||
export declare const setQuiet: (isQuiet?: boolean) => void; | ||
/** | ||
* Returns true if the caller is the CLI | ||
*/ | ||
export declare const isCLI: () => boolean; | ||
/** | ||
* Sets the caller to be the CLI | ||
*/ | ||
export declare const setCLI: () => void; | ||
/** | ||
* Determines if log level should be trace level | ||
*/ | ||
export declare const isTrace: () => boolean; | ||
/** | ||
* Returns true if running in debug verbose mode | ||
*/ | ||
export declare const isDebug: () => boolean; | ||
/** | ||
* Sets the realm | ||
*/ | ||
export declare const setRealm: (realm: Realm) => void; | ||
/** | ||
* Returns the realm | ||
*/ | ||
export declare const getRealm: () => Realm | string; | ||
declare const _default: { | ||
isNode: () => boolean; | ||
isWin32: () => boolean; | ||
persistTerminal: () => void; | ||
skipPreflightCheck: () => boolean; | ||
allowUnbundledReact: () => boolean; | ||
isTerminalPersisted: () => boolean; | ||
isQuiet: () => boolean; | ||
setQuiet: (isQuiet?: boolean) => void; | ||
isCLI: () => boolean; | ||
setCLI: () => void; | ||
isCI: () => boolean; | ||
isDebug: () => boolean; | ||
isTrace: () => boolean; | ||
getAccountSid: () => string | undefined; | ||
getAuthToken: () => string | undefined; | ||
getRealm: () => string; | ||
setRealm: (realm: Realm) => void; | ||
isCI: () => boolean; | ||
isCLI: () => boolean; | ||
setCLI: () => void; | ||
hasHost: () => boolean; | ||
getHost: () => string | undefined; | ||
setHost: (host: string) => string; | ||
hasPort: () => boolean; | ||
getPort: () => number; | ||
setPort: (port: number) => string; | ||
getNodeEnv: () => string; | ||
setNodeEnv: (_env: Environment) => string; | ||
getBabelEnv: () => string; | ||
setBabelEnv: (_env: Environment) => string; | ||
getLifecycle: () => string; | ||
isLifecycle: (cycle: Lifecycle) => boolean; | ||
isHTTPS: () => boolean; | ||
getWDSSocketHost: () => string | undefined; | ||
setWDSSocketHost: (host: string) => string; | ||
getWDSSocketPath: () => string | undefined; | ||
setWDSSocketPath: (path: string) => string; | ||
setWDSSocketPort: (port: number) => string; | ||
getWDSSocketPort: () => number; | ||
getWSSocket: () => Record<string, string | undefined>; | ||
}; | ||
export default _default; |
@@ -6,7 +6,90 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isNode = void 0; | ||
exports.getRealm = exports.setRealm = exports.isDebug = exports.isTrace = exports.setCLI = exports.isCLI = exports.setQuiet = exports.isQuiet = exports.isTerminalPersisted = exports.persistTerminal = exports.isCI = exports.isWin32 = exports.isNode = exports.getWSSocket = exports.getWDSSocketPort = exports.setWDSSocketPort = exports.getWDSSocketPath = exports.setWDSSocketPath = exports.getWDSSocketHost = exports.setWDSSocketHost = exports.isHTTPS = exports.isLifecycle = exports.getLifecycle = exports.setBabelEnv = exports.getBabelEnv = exports.setNodeEnv = exports.getNodeEnv = exports.setPort = exports.getPort = exports.hasPort = exports.setHost = exports.getHost = exports.hasHost = exports.getAuthToken = exports.getAccountSid = exports.allowUnbundledReact = exports.skipPreflightCheck = exports.Lifecycle = exports.Environment = void 0; | ||
var lodash_get_1 = __importDefault(require("lodash.get")); | ||
exports.isNode = function () { return typeof process === 'object' && "" + process === '[object process]'; }; | ||
/* eslint-disable import/no-unused-modules */ | ||
var Environment; | ||
(function (Environment) { | ||
Environment["Production"] = "production"; | ||
Environment["Development"] = "development"; | ||
Environment["Test"] = "test"; | ||
})(Environment = exports.Environment || (exports.Environment = {})); | ||
var Lifecycle; | ||
(function (Lifecycle) { | ||
Lifecycle["Test"] = "test"; | ||
Lifecycle["Build"] = "build"; | ||
Lifecycle["Prebuild"] = "prebuild"; | ||
Lifecycle["Deploy"] = "deploy"; | ||
Lifecycle["Predeploy"] = "predeploy"; | ||
})(Lifecycle = exports.Lifecycle || (exports.Lifecycle = {})); | ||
/** | ||
* Helper method to test whether env variable is defined | ||
* @param key the env to lookup | ||
* @return whether the key is set | ||
*/ | ||
var isDefined = function (key) { return typeof key === 'string' && key !== ''; }; | ||
/* istanbul ignore next */ | ||
var skipPreflightCheck = function () { return process.env.SKIP_PREFLIGHT_CHECK === 'true'; }; | ||
exports.skipPreflightCheck = skipPreflightCheck; | ||
var allowUnbundledReact = function () { return process.env.UNBUNDLED_REACT === 'true'; }; | ||
exports.allowUnbundledReact = allowUnbundledReact; | ||
var getAccountSid = function () { return process.env.TWILIO_ACCOUNT_SID; }; | ||
exports.getAccountSid = getAccountSid; | ||
var getAuthToken = function () { return process.env.TWILIO_AUTH_TOKEN; }; | ||
exports.getAuthToken = getAuthToken; | ||
var hasHost = function () { return isDefined(process.env.HOST); }; | ||
exports.hasHost = hasHost; | ||
var getHost = function () { return process.env.HOST; }; | ||
exports.getHost = getHost; | ||
var setHost = function (host) { return (process.env.HOST = host); }; | ||
exports.setHost = setHost; | ||
var hasPort = function () { return isDefined(process.env.PORT); }; | ||
exports.hasPort = hasPort; | ||
var getPort = function () { return Number(process.env.PORT); }; | ||
exports.getPort = getPort; | ||
var setPort = function (port) { return (process.env.PORT = String(port)); }; | ||
exports.setPort = setPort; | ||
var getNodeEnv = function () { return process.env.NODE_ENV; }; | ||
exports.getNodeEnv = getNodeEnv; | ||
var setNodeEnv = function (_env) { return (process.env.NODE_ENV = _env); }; | ||
exports.setNodeEnv = setNodeEnv; | ||
var getBabelEnv = function () { return process.env.BABEL_ENV; }; | ||
exports.getBabelEnv = getBabelEnv; | ||
var setBabelEnv = function (_env) { return (process.env.BABEL_ENV = _env); }; | ||
exports.setBabelEnv = setBabelEnv; | ||
var getLifecycle = function () { return process.env.npm_lifecycle_event; }; | ||
exports.getLifecycle = getLifecycle; | ||
var isLifecycle = function (cycle) { return process.env.npm_lifecycle_event === cycle; }; | ||
exports.isLifecycle = isLifecycle; | ||
var isHTTPS = function () { return process.env.HTTPS === 'true'; }; | ||
exports.isHTTPS = isHTTPS; | ||
var setWDSSocketHost = function (host) { return (process.env.WDS_SOCKET_HOST = host); }; | ||
exports.setWDSSocketHost = setWDSSocketHost; | ||
var getWDSSocketHost = function () { return process.env.WDS_SOCKET_HOST; }; | ||
exports.getWDSSocketHost = getWDSSocketHost; | ||
var setWDSSocketPath = function (path) { return (process.env.WDS_SOCKET_PATH = path); }; | ||
exports.setWDSSocketPath = setWDSSocketPath; | ||
var getWDSSocketPath = function () { return process.env.WDS_SOCKET_PATH; }; | ||
exports.getWDSSocketPath = getWDSSocketPath; | ||
var setWDSSocketPort = function (port) { return (process.env.WDS_SOCKET_PORT = port.toString()); }; | ||
exports.setWDSSocketPort = setWDSSocketPort; | ||
var getWDSSocketPort = function () { return Number(process.env.WDS_SOCKET_PORT); }; | ||
exports.getWDSSocketPort = getWDSSocketPort; | ||
var getWSSocket = function () { return ({ | ||
host: process.env.WDS_SOCKET_HOST, | ||
path: process.env.WDS_SOCKET_PATH, | ||
port: process.env.WDS_SOCKET_PORT, | ||
}); }; | ||
exports.getWSSocket = getWSSocket; | ||
/* istanbul ignore next */ | ||
var isNode = function () { return typeof process === 'object' && "" + process === '[object process]'; }; | ||
exports.isNode = isNode; | ||
/* istanbul ignore next */ | ||
var isWin32 = function () { return exports.isNode() && process.platform === 'win32'; }; | ||
exports.isWin32 = isWin32; | ||
/* istanbul ignore next */ | ||
var isCI = function () { return exports.isNode() && process.env.CI === 'true'; }; | ||
exports.isCI = isCI; | ||
/** | ||
* Sets the environment to persist the terminal | ||
*/ | ||
var persistTerminal = function () { | ||
@@ -17,4 +100,16 @@ if (exports.isNode()) { | ||
}; | ||
exports.persistTerminal = persistTerminal; | ||
/** | ||
* Determines if the terminal should be persisted or not | ||
*/ | ||
var isTerminalPersisted = function () { return exports.isNode() && process.env.PERSIST_TERMINAL === 'true'; }; | ||
exports.isTerminalPersisted = isTerminalPersisted; | ||
/** | ||
* Determines whether script should run in quiet mode | ||
*/ | ||
var isQuiet = function () { return exports.isNode() && process.env.QUIET === 'true'; }; | ||
exports.isQuiet = isQuiet; | ||
/** | ||
* Sets the quiet mode | ||
*/ | ||
var setQuiet = function (isQuiet) { | ||
@@ -24,6 +119,18 @@ if (isQuiet === void 0) { isQuiet = true; } | ||
}; | ||
exports.setQuiet = setQuiet; | ||
/** | ||
* Returns true if the caller is the CLI | ||
*/ | ||
var isCLI = function () { return process.env.FLEX_PLUGINS_CLI === 'true'; }; | ||
exports.isCLI = isCLI; | ||
/** | ||
* Sets the caller to be the CLI | ||
*/ | ||
var setCLI = function () { | ||
process.env.FLEX_PLUGINS_CLI = 'true'; | ||
}; | ||
exports.setCLI = setCLI; | ||
/** | ||
* Determines if log level should be trace level | ||
*/ | ||
var isTrace = function () { | ||
@@ -38,4 +145,8 @@ if (exports.isNode()) { | ||
}; | ||
exports.isTrace = isTrace; | ||
/** | ||
* Returns true if running in debug verbose mode | ||
*/ | ||
var isDebug = function () { | ||
if (isTrace()) { | ||
if (exports.isTrace()) { | ||
return true; | ||
@@ -51,5 +162,14 @@ } | ||
}; | ||
exports.isDebug = isDebug; | ||
/** | ||
* Sets the realm | ||
*/ | ||
var setRealm = function (realm) { | ||
process.env.REALM = realm; | ||
}; | ||
exports.setRealm = setRealm; | ||
/** | ||
* Returns the realm | ||
*/ | ||
/* istanbul ignore next */ | ||
var getRealm = function () { | ||
@@ -78,16 +198,42 @@ if (exports.isNode()) { | ||
}; | ||
exports.getRealm = getRealm; | ||
exports.default = { | ||
isWin32: isWin32, | ||
persistTerminal: persistTerminal, | ||
isTerminalPersisted: isTerminalPersisted, | ||
isQuiet: isQuiet, | ||
setQuiet: setQuiet, | ||
isDebug: isDebug, | ||
isTrace: isTrace, | ||
getRealm: getRealm, | ||
setRealm: setRealm, | ||
isCI: isCI, | ||
isCLI: isCLI, | ||
setCLI: setCLI, | ||
isNode: exports.isNode, | ||
isWin32: exports.isWin32, | ||
persistTerminal: exports.persistTerminal, | ||
skipPreflightCheck: exports.skipPreflightCheck, | ||
allowUnbundledReact: exports.allowUnbundledReact, | ||
isTerminalPersisted: exports.isTerminalPersisted, | ||
isQuiet: exports.isQuiet, | ||
setQuiet: exports.setQuiet, | ||
isCLI: exports.isCLI, | ||
setCLI: exports.setCLI, | ||
isCI: exports.isCI, | ||
isDebug: exports.isDebug, | ||
isTrace: exports.isTrace, | ||
getAccountSid: exports.getAccountSid, | ||
getAuthToken: exports.getAuthToken, | ||
getRealm: exports.getRealm, | ||
setRealm: exports.setRealm, | ||
hasHost: exports.hasHost, | ||
getHost: exports.getHost, | ||
setHost: exports.setHost, | ||
hasPort: exports.hasPort, | ||
getPort: exports.getPort, | ||
setPort: exports.setPort, | ||
getNodeEnv: exports.getNodeEnv, | ||
setNodeEnv: exports.setNodeEnv, | ||
getBabelEnv: exports.getBabelEnv, | ||
setBabelEnv: exports.setBabelEnv, | ||
getLifecycle: exports.getLifecycle, | ||
isLifecycle: exports.isLifecycle, | ||
isHTTPS: exports.isHTTPS, | ||
getWDSSocketHost: exports.getWDSSocketHost, | ||
setWDSSocketHost: exports.setWDSSocketHost, | ||
getWDSSocketPath: exports.getWDSSocketPath, | ||
setWDSSocketPath: exports.setWDSSocketPath, | ||
setWDSSocketPort: exports.setWDSSocketPort, | ||
getWDSSocketPort: exports.getWDSSocketPort, | ||
getWSSocket: exports.getWSSocket, | ||
}; | ||
//# sourceMappingURL=env.js.map |
{ | ||
"name": "flex-plugins-utils-env", | ||
"version": "0.19.0", | ||
"version": "4.5.1-dev.202103291654", | ||
"description": "Flex Plugins Environments", | ||
@@ -10,9 +10,9 @@ "keywords": [ | ||
], | ||
"homepage": "https://github.com/twilio/flex-plugins-utils-env#readme", | ||
"homepage": "https://github.com/twilio/flex-plugin-builder", | ||
"bugs": { | ||
"url": "https://github.com/twilio/flex-plugins-utils-env/issues" | ||
"url": "https://github.com/twilio/flex-plugin-builder/issues" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/twilio/flex-plugins-utils-env.git" | ||
"url": "git+https://github.com/twilio/flex-plugin-builder.git" | ||
}, | ||
@@ -35,3 +35,3 @@ "license": "MIT", | ||
"prebuild": "npm run clean", | ||
"build": "tsc", | ||
"build": "../../node_modules/.bin/tsc", | ||
"clean": "rm -rf dist", | ||
@@ -41,4 +41,4 @@ "lint": "eslint --ext ts src/", | ||
"prepublish": "npm run build", | ||
"test": "cd ../.. && jest packages/flex-plugins-utils-env", | ||
"test:watch": "cd ../.. && jest packages/flex-plugins-utils-env --watch" | ||
"test": "cd ../.. && jest packages/flex-dev-utils --color", | ||
"test:watch": "cd ../.. && jest packages/flex-dev-utils --watch --color" | ||
}, | ||
@@ -49,3 +49,3 @@ "dependencies": { | ||
}, | ||
"gitHead": "c30bba85fc858f3833333201ea50a74a4b584702" | ||
"gitHead": "43ac792b54fcf24aba4a5c4dddfb47760ee5a5ce" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 13 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
24988
367
0
1
37
1