@orion-js/env 3.1.20 → 3.1.22

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.
@@ -0,0 +1,4 @@
1
+ import { Config } from './getVariables';
2
+ export declare function getDts(config: Config): string;
3
+ export declare function writeDtsFile(config: Config, path: string): void;
4
+ export declare function writeDtsFileFromConfigFile(configFilePath: string, path: string): void;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.writeDtsFileFromConfigFile = exports.writeDtsFile = exports.getDts = void 0;
4
+ const getConfig_1 = require("../cli/add/getConfig");
5
+ const files_1 = require("../files");
6
+ function getDts(config) {
7
+ const keys = [...Object.keys(config.cleanKeys), ...Object.keys(config.encryptedKeys)];
8
+ return `declare module '@orion-js/env' {
9
+ export const env: {
10
+ ${keys.map(key => ` ${key}: string;`).join('\n')}
11
+ }
12
+ }
13
+ `;
14
+ }
15
+ exports.getDts = getDts;
16
+ function writeDtsFile(config, path) {
17
+ const currentFile = (0, files_1.readFile)(path);
18
+ const dts = getDts(config);
19
+ if (currentFile !== dts) {
20
+ (0, files_1.writeFile)(path, dts);
21
+ }
22
+ }
23
+ exports.writeDtsFile = writeDtsFile;
24
+ function writeDtsFileFromConfigFile(configFilePath, path) {
25
+ const config = (0, getConfig_1.getConfig)(configFilePath);
26
+ writeDtsFile(config, path);
27
+ }
28
+ exports.writeDtsFileFromConfigFile = writeDtsFileFromConfigFile;
@@ -1,3 +1,4 @@
1
+ export * from './getDts';
1
2
  export interface Variables {
2
3
  [key: string]: string;
3
4
  }
@@ -1,8 +1,19 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
2
12
  Object.defineProperty(exports, "__esModule", { value: true });
3
13
  exports.env = exports.readEnv = void 0;
4
14
  const getConfig_1 = require("../cli/add/getConfig");
5
15
  const getVariables_1 = require("./getVariables");
16
+ __exportStar(require("./getDts"), exports);
6
17
  let variables = {};
7
18
  const g = global;
8
19
  const secretKey = process.env.ORION_ENV_SECRET_KEY;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orion-js/env",
3
- "version": "3.1.20",
3
+ "version": "3.1.22",
4
4
  "main": "lib/index.js",
5
5
  "author": "nicolaslopezj",
6
6
  "license": "MIT",
@@ -31,5 +31,5 @@
31
31
  "publishConfig": {
32
32
  "access": "public"
33
33
  },
34
- "gitHead": "57400314f6605eb78cb5eed36430806ee4428e28"
34
+ "gitHead": "51b5af5952a486e40392381f769c69cfdfdc7b5e"
35
35
  }