@driveflux/env 0.0.2-develop.5 → 1.0.0-next.1

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.
package/.eslintrc ADDED
@@ -0,0 +1,3 @@
1
+ {
2
+ "extends": ["@driveflux/eslint-config/node.js"]
3
+ }
@@ -1,13 +1,7 @@
1
- $ bun run ./build.ts
2
- 🔍 Scanning folder: ./dist
3
- 📄 Found 4 JS files to process
4
-
5
- 📊 Processing Summary:
6
- Files processed: 4
7
- Total exports found: 7
8
- Duplicates removed: 0
9
- Total processing time: 39.76ms
10
- Average time per file: 9.94ms
11
-
12
- ✅ No duplicate exports found in any files
13
- ✅ Build successful
1
+
2
+ 
3
+ > @driveflux/env@1.0.0-next.1 build /Users/flux/Projects/flux/packages/env
4
+ > fab
5
+
6
+ Successfully compiled: 1 file with swc (263.85ms)
7
+ Successfully compiled: 1 file with swc (328.72ms)
package/CHANGELOG.md CHANGED
@@ -1,37 +1,13 @@
1
1
  # @driveflux/env
2
2
 
3
- ## 0.0.2-develop.5
3
+ ## 1.0.0-next.1
4
4
 
5
5
  ### Patch Changes
6
6
 
7
- - 225b59a: env + updated deps
7
+ - verion bump + minor improvements
8
8
 
9
- ## 0.0.2-develop.4
9
+ ## 1.0.0-next.0
10
10
 
11
- ### Patch Changes
12
-
13
- - 1f995b9: added PrivacyPolicySettings
14
-
15
- ## 0.0.2-develop.3
16
-
17
- ### Patch Changes
18
-
19
- - 0b0dce3: Bundle dotenvx
20
-
21
- ## 0.0.2-develop.2
22
-
23
- ### Patch Changes
24
-
25
- - 6a7cbad: Fixed error
26
-
27
- ## 0.0.2-develop.1
28
-
29
- ### Patch Changes
30
-
31
- - b469487: Fixed slack env names
32
-
33
- ## 0.0.2-develop.0
34
-
35
- ### Patch Changes
11
+ ### Major Changes
36
12
 
37
- - afe41e3: Created env package
13
+ - 4.5 pre-release
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "loadAllEnv", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return loadAllEnv;
9
+ }
10
+ });
11
+ var _dotenv = /*#__PURE__*/ _interop_require_default(require("dotenv"));
12
+ var _nodefs = /*#__PURE__*/ _interop_require_default(require("node:fs"));
13
+ var _nodepath = /*#__PURE__*/ _interop_require_default(require("node:path"));
14
+ function _interop_require_default(obj) {
15
+ return obj && obj.__esModule ? obj : {
16
+ default: obj
17
+ };
18
+ }
19
+ var loadEnv = function(path) {
20
+ var overwriteEnv = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
21
+ console.log("Loading env file: ", path);
22
+ if (!_nodefs.default.existsSync(path)) {
23
+ console.log('Skipping env file "'.concat(path, '", not found'));
24
+ return;
25
+ }
26
+ var newEnv = _dotenv.default.parse(_nodefs.default.readFileSync(path));
27
+ for(var k in newEnv){
28
+ if (overwriteEnv || typeof process.env[k] === "undefined") {
29
+ process.env[k] = newEnv[k];
30
+ }
31
+ }
32
+ };
33
+ var loadAllEnv = function() {
34
+ var basePath = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : process.cwd(), overwriteEnv = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
35
+ // Load standard env files
36
+ loadEnv(_nodepath.default.join(basePath, ".env"), overwriteEnv);
37
+ loadEnv(_nodepath.default.join(basePath, ".env.local"), overwriteEnv);
38
+ if (process.env.USE_ENV) {
39
+ loadEnv(_nodepath.default.join(basePath, ".env.".concat(process.env.USE_ENV)), overwriteEnv);
40
+ loadEnv(_nodepath.default.join(basePath, ".env.".concat(process.env.USE_ENV, ".local")), overwriteEnv);
41
+ }
42
+ };
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "commonjs"
3
+ }
@@ -0,0 +1,2 @@
1
+ export declare const loadAllEnv: (basePath?: string, overwriteEnv?: boolean) => void;
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAkBA,eAAO,MAAM,UAAU,qDAQtB,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,27 @@
1
+ import dotenv from "dotenv";
2
+ import fs from "node:fs";
3
+ import path from "node:path";
4
+ var loadEnv = function(path) {
5
+ var overwriteEnv = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
6
+ console.log("Loading env file: ", path);
7
+ if (!fs.existsSync(path)) {
8
+ console.log('Skipping env file "'.concat(path, '", not found'));
9
+ return;
10
+ }
11
+ var newEnv = dotenv.parse(fs.readFileSync(path));
12
+ for(var k in newEnv){
13
+ if (overwriteEnv || typeof process.env[k] === "undefined") {
14
+ process.env[k] = newEnv[k];
15
+ }
16
+ }
17
+ };
18
+ export var loadAllEnv = function() {
19
+ var basePath = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : process.cwd(), overwriteEnv = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
20
+ // Load standard env files
21
+ loadEnv(path.join(basePath, ".env"), overwriteEnv);
22
+ loadEnv(path.join(basePath, ".env.local"), overwriteEnv);
23
+ if (process.env.USE_ENV) {
24
+ loadEnv(path.join(basePath, ".env.".concat(process.env.USE_ENV)), overwriteEnv);
25
+ loadEnv(path.join(basePath, ".env.".concat(process.env.USE_ENV, ".local")), overwriteEnv);
26
+ }
27
+ };
package/index.cjs ADDED
@@ -0,0 +1 @@
1
+ module.exports = require('./dist/cjs/index.js')
package/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './dist/index'
package/package.json CHANGED
@@ -1,32 +1,36 @@
1
1
  {
2
2
  "name": "@driveflux/env",
3
- "version": "0.0.2-develop.5",
3
+ "version": "1.0.0-next.1",
4
4
  "type": "module",
5
+ "main": "./dist/cjs/index.js",
6
+ "module": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
5
8
  "exports": {
6
9
  ".": {
7
- "import": "./dist/main.js",
8
- "types": "./dist/main.d.ts"
9
- },
10
- "./init-env": {
11
- "import": "./dist/init-env.js",
12
- "types": "./dist/init-env.d.ts"
13
- },
14
- "./augment-env": {
15
- "import": "./dist/augment-env.js",
16
- "types": "./dist/augment-env.d.ts"
10
+ "import": "./dist/index.js",
11
+ "require": "./dist/cjs/index.js",
12
+ "types": "./dist/index.d.ts"
17
13
  }
18
14
  },
19
- "scripts": {
20
- "build": "bun run ./build.ts",
21
- "build:all": "bun tsc --emitDeclarationOnly && bun run ./build.ts"
15
+ "dependencies": {
16
+ "dotenv": "^16.4.1"
22
17
  },
23
- "dependencies": {},
24
18
  "devDependencies": {
25
- "@types/bun": "^1.3",
26
- "typescript": "5.9.3",
27
- "@driveflux/fix-builds": "0.0.2-develop.16"
19
+ "@driveflux/eslint-config": "1.0.0-next.1",
20
+ "@driveflux/fab": "1.0.0-next.1",
21
+ "@driveflux/tsconfig": "1.0.0-next.1",
22
+ "@swc/cli": "^0.3.9",
23
+ "@swc/core": "^1.4.0",
24
+ "@types/lodash": "^4.14.202",
25
+ "@types/node": "^20.11.16",
26
+ "del-cli": "^5.1.0",
27
+ "eslint": "8.56.0",
28
+ "typescript": "^5.3.3"
28
29
  },
29
- "bin": {
30
- "init-env": "./dist/init-env.js"
30
+ "scripts": {
31
+ "build": "fab",
32
+ "clean": "fab clean",
33
+ "types": "tsc --noEmit",
34
+ "lint": "eslint \"src/**/*.ts\""
31
35
  }
32
- }
36
+ }
package/src/index.ts ADDED
@@ -0,0 +1,27 @@
1
+ import dotenv from 'dotenv'
2
+ import fs from 'node:fs'
3
+ import path from 'node:path'
4
+
5
+ const loadEnv = (path: string, overwriteEnv = true) => {
6
+ console.log('Loading env file: ', path)
7
+ if (!fs.existsSync(path)) {
8
+ console.log(`Skipping env file "${path}", not found`)
9
+ return
10
+ }
11
+ const newEnv = dotenv.parse(fs.readFileSync(path))
12
+ for (const k in newEnv) {
13
+ if(overwriteEnv || typeof process.env[k] === 'undefined') {
14
+ process.env[k] = newEnv[k]
15
+ }
16
+ }
17
+ }
18
+
19
+ export const loadAllEnv = (basePath = process.cwd(), overwriteEnv = true) => {
20
+ // Load standard env files
21
+ loadEnv(path.join(basePath, '.env'), overwriteEnv)
22
+ loadEnv(path.join(basePath, '.env.local'), overwriteEnv)
23
+ if (process.env.USE_ENV) {
24
+ loadEnv(path.join(basePath, `.env.${process.env.USE_ENV}`), overwriteEnv)
25
+ loadEnv(path.join(basePath, `.env.${process.env.USE_ENV}.local`), overwriteEnv)
26
+ }
27
+ }
package/tsconfig.json CHANGED
@@ -1,15 +1,12 @@
1
1
  {
2
- "extends": "../../tsconfig.base.json",
2
+ "$schema": "https://json.schemastore.org/tsconfig",
3
+ "extends": "@driveflux/tsconfig/base.json",
3
4
  "compilerOptions": {
4
- "outDir": "./dist",
5
- "rootDir": "./src",
6
- "composite": true,
7
- "incremental": true
5
+ "rootDir": "src",
6
+ "outDir": "./dist"
8
7
  },
9
- "include": ["./src/**/*.ts"],
10
- "references": [
11
- {
12
- "path": "../fix-builds"
13
- }
14
- ]
15
- }
8
+ "include": [
9
+ "src/**/*.ts"
10
+ ],
11
+ "exclude": ["node_modules"]
12
+ }