@orion-js/core
Advanced tools
Comparing version 3.1.12 to 3.1.20
@@ -9,5 +9,4 @@ "use strict"; | ||
const writeIndex_1 = __importDefault(require("../start/watchAndCompile/writeIndex")); | ||
const writeEnvFile_1 = require("../start/watchAndCompile/writeEnvFile"); | ||
const compile_1 = require("./compile"); | ||
async function default_1({ output, envPath }) { | ||
async function default_1({ output }) { | ||
if (!output) { | ||
@@ -21,5 +20,4 @@ output = './build'; | ||
(0, writeIndex_1.default)({ basePath: output }); | ||
(0, writeEnvFile_1.writeEnvFile)({ basePath: output, envPath, createDtsFile: false }); | ||
console.log(safe_1.default.bold('Build created')); | ||
} | ||
exports.default = default_1; |
@@ -17,4 +17,2 @@ #!/usr/bin/env node | ||
require("dotenv/config"); | ||
const init_1 = __importDefault(require("./env/init")); | ||
const add_1 = __importDefault(require("./env/add")); | ||
const program = new commander_1.Command(); | ||
@@ -36,3 +34,2 @@ const run = function (action) { | ||
.option('--clean', 'Build the typescript project from scratch') | ||
.option('--env-path <path>', 'Specify the env file name') | ||
.action(run(start_1.default)); | ||
@@ -44,15 +41,4 @@ program.command('test').allowUnknownOption().description('Deprecated command').action(run(test_1.default)); | ||
.option('-o, --output [output]', 'Output directory') | ||
.option('--env-path <path>', 'Specify the env file name') | ||
.action(run(build_1.default)); | ||
program | ||
.command('env-init') | ||
.description('Creates a new encrypted env file') | ||
.option('--env-path <path>', 'Specify the env file name') | ||
.action(run(init_1.default)); | ||
program | ||
.command('env-add') | ||
.description('Adds a new environment to the encrypted env file') | ||
.option('--env-path <path>', 'Specify the env file name') | ||
.action(run(add_1.default)); | ||
program | ||
.command('create') | ||
@@ -59,0 +45,0 @@ .description('Creates a new Orionjs project') |
@@ -39,3 +39,2 @@ "use strict"; | ||
stop, | ||
envPath: options.envPath, | ||
basePath: `${process.cwd()}/.orion/build` | ||
@@ -42,0 +41,0 @@ }; |
@@ -12,3 +12,2 @@ "use strict"; | ||
const writeIndex_1 = __importDefault(require("./writeIndex")); | ||
const writeEnvFile_1 = require("./writeEnvFile"); | ||
function getHost(runner) { | ||
@@ -32,3 +31,2 @@ const reportWatchStatusChanged = (diagnostic) => { | ||
(0, writeIndex_1.default)({ basePath: runner.basePath }); | ||
(0, writeEnvFile_1.writeEnvFile)({ basePath: runner.basePath, envPath: runner.envPath, createDtsFile: true }); | ||
runner.restart(); | ||
@@ -35,0 +33,0 @@ } |
@@ -6,4 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.writeEnvFile = exports.getDts = exports.watchEnvFile = void 0; | ||
const getConfig_1 = require("../../env/add/getConfig"); | ||
exports.writeDtsFile = exports.getDts = exports.watchEnvFile = void 0; | ||
const writeFile_1 = __importDefault(require("../../helpers/writeFile")); | ||
@@ -13,13 +12,11 @@ const chokidar_1 = __importDefault(require("chokidar")); | ||
const getFileContents_1 = __importDefault(require("../../helpers/getFileContents")); | ||
const env_1 = require("@orion-js/env"); | ||
const envFilePath = process.env.ORION_ENV_FILE_PATH; | ||
const watchEnvFile = async (runner) => { | ||
if (!runner.envPath) | ||
if (!envFilePath) | ||
return; | ||
const filePath = runner.envPath; | ||
chokidar_1.default.watch(filePath, { ignoreInitial: true }).on('change', async () => { | ||
(0, exports.writeEnvFile)({ | ||
envPath: runner.envPath, | ||
basePath: runner.basePath, | ||
createDtsFile: true | ||
}); | ||
(0, exports.writeDtsFile)(); | ||
chokidar_1.default.watch(envFilePath, { ignoreInitial: true }).on('change', async () => { | ||
console.log(safe_1.default.bold(`=> Environment file changed. Restarting...`)); | ||
(0, exports.writeDtsFile)(); | ||
runner.restart(); | ||
@@ -29,4 +26,4 @@ }); | ||
exports.watchEnvFile = watchEnvFile; | ||
const getDts = config => { | ||
const keys = [...Object.keys(config.cleanKeys), ...Object.keys(config.encryptedKeys)]; | ||
const getDts = () => { | ||
const keys = Object.keys((0, env_1.readEnv)()); | ||
return `declare module '@orion-js/env' { | ||
@@ -40,19 +37,9 @@ export const env: { | ||
exports.getDts = getDts; | ||
const writeEnvFile = async ({ basePath, envPath, createDtsFile }) => { | ||
const filePath = `${basePath}/env.js`; | ||
if (!envPath) { | ||
(0, writeFile_1.default)(filePath, `global.__orion_env__ = null`); | ||
return; | ||
const writeDtsFile = async () => { | ||
const currentFile = (0, getFileContents_1.default)('./app/env.d.ts'); | ||
const dts = (0, exports.getDts)(); | ||
if (currentFile !== dts) { | ||
(0, writeFile_1.default)('./app/env.d.ts', dts); | ||
} | ||
const config = (0, getConfig_1.getConfig)(envPath); | ||
const configJSON = JSON.stringify(config, null, 2); | ||
if (createDtsFile) { | ||
const currentFile = (0, getFileContents_1.default)('./app/env.d.ts'); | ||
const dts = (0, exports.getDts)(config); | ||
if (currentFile !== dts) { | ||
(0, writeFile_1.default)('./app/env.d.ts', dts); | ||
} | ||
} | ||
(0, writeFile_1.default)(filePath, `global.__orion_env__ = ${configJSON}`); | ||
}; | ||
exports.writeEnvFile = writeEnvFile; | ||
exports.writeDtsFile = writeDtsFile; |
@@ -24,3 +24,2 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
require("./env"); | ||
require("./moduleAlias"); | ||
@@ -27,0 +26,0 @@ require("./app"); |
{ | ||
"name": "@orion-js/core", | ||
"version": "3.1.12", | ||
"version": "3.1.20", | ||
"main": "index.js", | ||
@@ -20,2 +20,3 @@ "author": "nicolaslopezj", | ||
"@orion-js/crypto": "^3.1.12", | ||
"@orion-js/env": "^3.1.20", | ||
"chokidar": "3.5.3", | ||
@@ -38,3 +39,3 @@ "colors": "^1.4.0", | ||
}, | ||
"gitHead": "a6b82a931bea3179dfac4099579096c4f7a780bb", | ||
"gitHead": "57400314f6605eb78cb5eed36430806ee4428e28", | ||
"devDependencies": { | ||
@@ -41,0 +42,0 @@ "@shelf/jest-mongodb": "^2.1.0", |
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance 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
34391
12
33
687
11
+ Added@orion-js/env@^3.1.20
+ Added@orion-js/env@3.10.0(transitive)
+ Addedcommander@9.5.0(transitive)
+ Addedyaml@2.6.0(transitive)