jaypie 1.0.44 → 1.0.45
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/README.md +28 -0
- package/eslint.config.mjs +2 -0
- package/package.json +5 -5
- package/src/dynamicExport.function.js +2 -1
- package/.eslintignore +0 -1
package/README.md
CHANGED
|
@@ -496,6 +496,34 @@ if (envBoolean("AWESOME", { defaultValue: true })) {
|
|
|
496
496
|
}
|
|
497
497
|
```
|
|
498
498
|
|
|
499
|
+
#### `envsKey`
|
|
500
|
+
|
|
501
|
+
`envsKey(key:string, { env:string = process.env.PROJECT_ENV || process.env.DEFAULT_ENV })`
|
|
502
|
+
|
|
503
|
+
return `process.env.${KEY} || ENV_${ENV}_${KEY} || false`
|
|
504
|
+
|
|
505
|
+
```bash
|
|
506
|
+
DEFAULT_ENV=sandbox
|
|
507
|
+
|
|
508
|
+
MONGODB_URI=...
|
|
509
|
+
ENV_SANDBOX_MONGODB_URI=...
|
|
510
|
+
ENV_DEVELOPMENT_MONGODB_URI=...
|
|
511
|
+
|
|
512
|
+
PROJECT_ENV=development
|
|
513
|
+
```
|
|
514
|
+
|
|
515
|
+
Return order:
|
|
516
|
+
1. `MONGODB_URI` - the exact key always takes precedence, if set
|
|
517
|
+
2. `ENV_DEVELOPMENT_MONGODB_URI` - the `PROJECT_ENV`, if set. Usually this is set in the deploy workflow
|
|
518
|
+
3. `ENV_SANDBOX_MONGODB_URI` - the `DEFAULT_ENV`, if set. Usually this is set in the local environment
|
|
519
|
+
4. `false`
|
|
520
|
+
|
|
521
|
+
```javascript
|
|
522
|
+
import { envsKey } from "jaypie";
|
|
523
|
+
|
|
524
|
+
const url = envsKey("MONGODB_URI");
|
|
525
|
+
```
|
|
526
|
+
|
|
499
527
|
#### `force`
|
|
500
528
|
|
|
501
529
|
Coerce a value into a type or throw an error.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jaypie",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.45",
|
|
4
4
|
"author": "Finlayson Studio",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -28,18 +28,18 @@
|
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@jaypie/aws": "^1.0.8",
|
|
31
|
-
"@jaypie/core": "^1.0.
|
|
31
|
+
"@jaypie/core": "^1.0.42",
|
|
32
32
|
"@jaypie/datadog": "^1.0.3",
|
|
33
33
|
"@jaypie/express": "^1.0.13",
|
|
34
34
|
"@jaypie/lambda": "^1.0.13",
|
|
35
35
|
"@jaypie/mongoose": "^1.0.9"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@jaypie/testkit": "^1.0.
|
|
38
|
+
"@jaypie/testkit": "^1.0.26",
|
|
39
39
|
"@rollup/plugin-commonjs": "^26.0.1",
|
|
40
40
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
41
|
-
"eslint": "^
|
|
42
|
-
"eslint-config-jaypie": "^1.0.
|
|
41
|
+
"eslint": "^9.7.0",
|
|
42
|
+
"eslint-config-jaypie": "^1.0.17",
|
|
43
43
|
"hygen": "^6.2.11",
|
|
44
44
|
"jest-extended": "^4.0.2",
|
|
45
45
|
"prettier": "^3.2.5",
|
|
@@ -9,8 +9,8 @@ const _importedModule = {};
|
|
|
9
9
|
async function dynamicImport(module) {
|
|
10
10
|
if (!_importedModule[module]) {
|
|
11
11
|
try {
|
|
12
|
-
// eslint-disable-next-line import/no-unresolved
|
|
13
12
|
_importedModule[module] = await import(module);
|
|
13
|
+
// eslint-disable-next-line no-unused-vars
|
|
14
14
|
} catch (error) {
|
|
15
15
|
if (process.env.NODE_ENV === "test") {
|
|
16
16
|
if (!_importedModule[module]) {
|
|
@@ -55,6 +55,7 @@ export default async ({
|
|
|
55
55
|
try {
|
|
56
56
|
// Attempt to import the module
|
|
57
57
|
return await dynamicImport(moduleImport);
|
|
58
|
+
// eslint-disable-next-line no-unused-vars
|
|
58
59
|
} catch (error) {
|
|
59
60
|
log
|
|
60
61
|
.lib({ lib: JAYPIE.LIB.JAYPIE })
|
package/.eslintignore
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
dist/
|