@mono-labs/cli 0.0.191 → 0.0.194
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/lib/index.js +2 -1
- package/package.json +18 -16
- package/src/merge-env.js +32 -0
- package/src/stack.ts +2 -2
- package/index.js +0 -14
package/lib/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mono-labs/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.194",
|
|
4
4
|
"description": "A CLI tool for building and deploying projects",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "index.js",
|
|
7
|
-
"types": "types.d.ts",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/types.d.ts",
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
10
|
-
"types": "./types.d.ts",
|
|
11
|
-
"import": "./index.js"
|
|
10
|
+
"types": "./dist/types.d.ts",
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
12
|
},
|
|
13
13
|
"./expo": {
|
|
14
|
-
"types": "./
|
|
15
|
-
"default": "./
|
|
14
|
+
"types": "./dist/types/expo.d.ts",
|
|
15
|
+
"default": "./dist/expo.js"
|
|
16
16
|
},
|
|
17
17
|
"./tools": {
|
|
18
|
-
"types": "./
|
|
19
|
-
"default": "./
|
|
18
|
+
"types": "./dist/types/tools.d.ts",
|
|
19
|
+
"default": "./dist/tools.js"
|
|
20
20
|
},
|
|
21
21
|
"./cdk": {
|
|
22
|
-
"types": "./
|
|
23
|
-
"default": "./
|
|
22
|
+
"types": "./dist/types/cdk/cdk.d.ts",
|
|
23
|
+
"default": "./dist/cdk/index.js"
|
|
24
24
|
},
|
|
25
25
|
"./stack": {
|
|
26
|
-
"types": "./
|
|
27
|
-
"default": "./
|
|
26
|
+
"types": "./dist/types/stack.d.ts",
|
|
27
|
+
"default": "./dist/stack.js"
|
|
28
28
|
},
|
|
29
29
|
"./project": {
|
|
30
|
-
"types": "./
|
|
31
|
-
"default": "./
|
|
30
|
+
"types": "./dist/types/project/index.d.ts",
|
|
31
|
+
"default": "./dist/project/index.js"
|
|
32
32
|
}
|
|
33
33
|
},
|
|
34
34
|
"repository": {
|
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
"mono": "./bin/mono.js"
|
|
44
44
|
},
|
|
45
45
|
"scripts": {
|
|
46
|
+
"build": "tsc",
|
|
46
47
|
"start": "node bin/mono.js",
|
|
47
48
|
"dev": "node bin/mono.js",
|
|
48
49
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
@@ -77,7 +78,8 @@
|
|
|
77
78
|
},
|
|
78
79
|
"devDependencies": {
|
|
79
80
|
"eslint": "^8.57.0",
|
|
80
|
-
"expo": "^54.0.31"
|
|
81
|
+
"expo": "^54.0.31",
|
|
82
|
+
"typescript": "^5.9.3"
|
|
81
83
|
},
|
|
82
84
|
"files": [
|
|
83
85
|
"bin/",
|
package/src/merge-env.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import dotenv from 'dotenv';
|
|
4
|
+
|
|
5
|
+
export function loadMergedEnv() {
|
|
6
|
+
const ENV_PATH = path.resolve(process.cwd(), '.env');
|
|
7
|
+
const ENV_LOCAL_PATH = path.resolve(process.cwd(), '.env.local');
|
|
8
|
+
|
|
9
|
+
// Load base .env
|
|
10
|
+
const base =
|
|
11
|
+
fs.existsSync(ENV_PATH) ? dotenv.parse(fs.readFileSync(ENV_PATH)) : {};
|
|
12
|
+
|
|
13
|
+
// Load overrides .env.local
|
|
14
|
+
const local =
|
|
15
|
+
fs.existsSync(ENV_LOCAL_PATH) ?
|
|
16
|
+
dotenv.parse(fs.readFileSync(ENV_LOCAL_PATH))
|
|
17
|
+
: {};
|
|
18
|
+
|
|
19
|
+
// Merge: local overrides base
|
|
20
|
+
const merged = {
|
|
21
|
+
...base,
|
|
22
|
+
...local,
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
// Inject into process.env (do NOT overwrite existing real env vars)
|
|
26
|
+
for (const [key, value] of Object.entries(merged)) {
|
|
27
|
+
if (process.env[key] === undefined) {
|
|
28
|
+
process.env[key] = value;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return process.env;
|
|
32
|
+
}
|
package/src/stack.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as cdk from 'aws-cdk-lib';
|
|
2
2
|
import { Construct } from 'constructs';
|
|
3
|
-
import
|
|
3
|
+
import { loadMergedEnv } from './project/merge-env.js';
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
loadMergedEnv();
|
|
6
6
|
//cdk deploy --context owner=cody --context region=us-west-1
|
|
7
7
|
|
|
8
8
|
const dev = 'dev';
|
package/index.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// Main entry point for @mono-labs/cli package
|
|
2
|
-
import { generateNewEnvList } from './lib/generateNewEnvList.js';
|
|
3
|
-
import {
|
|
4
|
-
filterUnwantedEnvVars,
|
|
5
|
-
filterUnwantedEnvVarsEAS,
|
|
6
|
-
} from './lib/filterUnwantedEnvVars.js';
|
|
7
|
-
import { replaceTokens } from './lib/commands/build-process/dataLayer.js';
|
|
8
|
-
// Default export for convenience
|
|
9
|
-
export default {
|
|
10
|
-
replaceTokens,
|
|
11
|
-
generateNewEnvList,
|
|
12
|
-
filterUnwantedEnvVars,
|
|
13
|
-
filterUnwantedEnvVarsEAS,
|
|
14
|
-
};
|