@orion-js/core 3.1.20 → 3.1.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,39 +3,20 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.writeDtsFile = exports.getDts = exports.watchEnvFile = void 0;
7
- const writeFile_1 = __importDefault(require("../../helpers/writeFile"));
6
+ exports.watchEnvFile = void 0;
8
7
  const chokidar_1 = __importDefault(require("chokidar"));
9
8
  const safe_1 = __importDefault(require("colors/safe"));
10
- const getFileContents_1 = __importDefault(require("../../helpers/getFileContents"));
11
9
  const env_1 = require("@orion-js/env");
12
10
  const envFilePath = process.env.ORION_ENV_FILE_PATH;
11
+ const dtsFilePath = './app/env.d.ts';
13
12
  const watchEnvFile = async (runner) => {
14
13
  if (!envFilePath)
15
14
  return;
16
- (0, exports.writeDtsFile)();
15
+ (0, env_1.writeDtsFileFromConfigFile)(envFilePath, dtsFilePath);
17
16
  chokidar_1.default.watch(envFilePath, { ignoreInitial: true }).on('change', async () => {
18
17
  console.log(safe_1.default.bold(`=> Environment file changed. Restarting...`));
19
- (0, exports.writeDtsFile)();
18
+ (0, env_1.writeDtsFileFromConfigFile)(envFilePath, dtsFilePath);
20
19
  runner.restart();
21
20
  });
22
21
  };
23
22
  exports.watchEnvFile = watchEnvFile;
24
- const getDts = () => {
25
- const keys = Object.keys((0, env_1.readEnv)());
26
- return `declare module '@orion-js/env' {
27
- export const env: {
28
- ${keys.map(key => ` ${key}: string;`).join('\n')}
29
- }
30
- }
31
- `;
32
- };
33
- exports.getDts = getDts;
34
- const writeDtsFile = async () => {
35
- const currentFile = (0, getFileContents_1.default)('./app/env.d.ts');
36
- const dts = (0, exports.getDts)();
37
- if (currentFile !== dts) {
38
- (0, writeFile_1.default)('./app/env.d.ts', dts);
39
- }
40
- };
41
- exports.writeDtsFile = writeDtsFile;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orion-js/core",
3
- "version": "3.1.20",
3
+ "version": "3.1.23",
4
4
  "main": "index.js",
5
5
  "author": "nicolaslopezj",
6
6
  "license": "MIT",
@@ -16,8 +16,7 @@
16
16
  "upgrade-interactive": "yarn upgrade-interactive"
17
17
  },
18
18
  "dependencies": {
19
- "@orion-js/crypto": "^3.1.12",
20
- "@orion-js/env": "^3.1.20",
19
+ "@orion-js/env": "^3.1.23",
21
20
  "chokidar": "3.5.3",
22
21
  "colors": "^1.4.0",
23
22
  "commander": "^8.3.0",
@@ -35,7 +34,7 @@
35
34
  "engines": {
36
35
  "node": ">=14.0.0"
37
36
  },
38
- "gitHead": "57400314f6605eb78cb5eed36430806ee4428e28",
37
+ "gitHead": "0194171f6f326dfa921cf6e9f341e5b733b7d11e",
39
38
  "devDependencies": {
40
39
  "@shelf/jest-mongodb": "^2.1.0",
41
40
  "@types/prompts": "^2.0.14"