@orion-js/core
Advanced tools
Comparing version 3.1.9 to 3.1.10
@@ -20,5 +20,5 @@ "use strict"; | ||
(0, writeIndex_1.default)({ basePath: output }); | ||
(0, writeEnvFile_1.writeEnvFile)({ basePath: output, envPath }); | ||
(0, writeEnvFile_1.writeEnvFile)({ basePath: output, envPath, createDtsFile: false }); | ||
console.log(safe_1.default.bold('Build created')); | ||
} | ||
exports.default = default_1; |
@@ -31,3 +31,3 @@ "use strict"; | ||
(0, writeIndex_1.default)({ basePath: runner.basePath }); | ||
(0, writeEnvFile_1.writeEnvFile)({ basePath: runner.basePath, envPath: runner.envPath }); | ||
(0, writeEnvFile_1.writeEnvFile)({ basePath: runner.basePath, envPath: runner.envPath, createDtsFile: true }); | ||
runner.restart(); | ||
@@ -34,0 +34,0 @@ } |
@@ -6,3 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.writeEnvFile = exports.watchEnvFile = void 0; | ||
exports.writeEnvFile = exports.getDts = exports.watchEnvFile = void 0; | ||
const getConfig_1 = require("../../env/add/getConfig"); | ||
@@ -12,2 +12,3 @@ const writeFile_1 = __importDefault(require("../../helpers/writeFile")); | ||
const safe_1 = __importDefault(require("colors/safe")); | ||
const getFileContents_1 = __importDefault(require("../../helpers/getFileContents")); | ||
const watchEnvFile = async (runner) => { | ||
@@ -20,3 +21,4 @@ if (!runner.envPath) | ||
envPath: runner.envPath, | ||
basePath: runner.basePath | ||
basePath: runner.basePath, | ||
createDtsFile: true | ||
}); | ||
@@ -28,3 +30,13 @@ console.log(safe_1.default.bold(`=> Environment file changed. Restarting...`)); | ||
exports.watchEnvFile = watchEnvFile; | ||
const writeEnvFile = async ({ basePath, envPath }) => { | ||
const getDts = config => { | ||
const keys = [...Object.keys(config.cleanKeys), ...Object.keys(config.encryptedKeys)]; | ||
return `declare module '@orion-js/env' { | ||
export const env: { | ||
${keys.map(key => ` ${key}: string;`).join('\n')} | ||
} | ||
} | ||
`; | ||
}; | ||
exports.getDts = getDts; | ||
const writeEnvFile = async ({ basePath, envPath, createDtsFile }) => { | ||
const filePath = `${basePath}/env.js`; | ||
@@ -37,4 +49,11 @@ if (!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; |
{ | ||
"name": "@orion-js/core", | ||
"version": "3.1.9", | ||
"version": "3.1.10", | ||
"main": "index.js", | ||
@@ -19,3 +19,3 @@ "author": "nicolaslopezj", | ||
"dependencies": { | ||
"@orion-js/crypto": "^3.1.9", | ||
"@orion-js/crypto": "^3.1.10", | ||
"chokidar": "3.5.3", | ||
@@ -38,3 +38,3 @@ "colors": "^1.4.0", | ||
}, | ||
"gitHead": "b249f24ee282149ef9a69885662d69b74a4523e6", | ||
"gitHead": "40fa0800303f49ad08890b2bedff2cdadb81360d", | ||
"devDependencies": { | ||
@@ -41,0 +41,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
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
38950
811
Updated@orion-js/crypto@^3.1.10