@mono-labs/project 0.1.256 → 0.1.258
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 +14 -1
- package/dist/project/build-mono-readme.js +7 -6
- package/dist/project/generate-readme.js +3 -2
- package/dist/stack/index.d.ts.map +1 -1
- package/dist/stack/index.js +2 -1
- package/package.json +2 -1
- package/src/project/build-mono-readme.ts +7 -6
- package/src/project/generate-readme.ts +3 -2
- package/src/stack/index.ts +2 -1
- package/tsconfig.json +4 -1
package/README.md
CHANGED
|
@@ -37,6 +37,7 @@ import {
|
|
|
37
37
|
- **`resolveMonoDirectory()`** -- Resolves the path to the `.mono/` directory (checks project root and cwd).
|
|
38
38
|
- **`getMonoFiles()`** -- Returns a `MonoFiles` record of all `.mono/*.json` command definitions (excluding `config.json`).
|
|
39
39
|
- **`getMonoConfig()`** -- Loads and returns the parsed `.mono/config.json` as a `MonoConfig` object.
|
|
40
|
+
- **`clearMonoConfigCache()`** -- Clears the cached mono config, forcing a fresh read on the next call to `getMonoConfig()`.
|
|
40
41
|
|
|
41
42
|
### App Configuration
|
|
42
43
|
|
|
@@ -58,9 +59,21 @@ import { loadMergedEnv } from "@mono-labs/project";
|
|
|
58
59
|
|
|
59
60
|
- **`loadMergedEnv()`** -- Loads `.env` and `.env.local` from the project root, merges them (`.env.local` takes precedence), and injects into `process.env` without overwriting existing variables.
|
|
60
61
|
|
|
62
|
+
### Environment Filtering
|
|
63
|
+
|
|
64
|
+
```typescript
|
|
65
|
+
import {
|
|
66
|
+
filterEnvByPrefixes,
|
|
67
|
+
filterEnvByConfig
|
|
68
|
+
} from "@mono-labs/project";
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
- **`filterEnvByPrefixes(env, prefixes, include?)`** -- Returns only env vars whose keys start with one of the given prefixes. Pass an optional `include` array for specific keys that should always be kept regardless of prefix.
|
|
72
|
+
- **`filterEnvByConfig(env?, include?)`** -- Reads prefixes from `.mono/config.json` `envMap` and combines them with default prefixes (`MONO_`, `EAS_`, `APP_`, `TAMAGUI_`). Defaults to `process.env` if `env` is omitted.
|
|
73
|
+
|
|
61
74
|
### Subpath Export
|
|
62
75
|
|
|
63
|
-
The `@mono-labs/project/project` subpath provides access to app config loading and documentation generation utilities.
|
|
76
|
+
The `@mono-labs/project/project` subpath provides access to app config loading, environment filtering, and documentation generation utilities.
|
|
64
77
|
|
|
65
78
|
## Config Types
|
|
66
79
|
|
|
@@ -8,6 +8,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
8
8
|
const node_fs_1 = require("node:fs");
|
|
9
9
|
const node_path_1 = __importDefault(require("node:path"));
|
|
10
10
|
const generate_docs_1 = require("./generate-docs");
|
|
11
|
+
const shared_1 = require("@mono-labs/shared");
|
|
11
12
|
const REPO_ROOT = node_path_1.default.resolve(process.cwd());
|
|
12
13
|
const MONO_DIR = node_path_1.default.join(REPO_ROOT, '.mono');
|
|
13
14
|
const ROOT_PKG_JSON = node_path_1.default.join(REPO_ROOT, 'package.json');
|
|
@@ -126,9 +127,9 @@ async function findWorkspacePackageDirs(repoRoot, workspacePatterns) {
|
|
|
126
127
|
// ---------- .mono parsing ----------
|
|
127
128
|
async function readMonoConfig() {
|
|
128
129
|
const configPath = node_path_1.default.join(MONO_DIR, 'config.json');
|
|
129
|
-
|
|
130
|
+
(0, shared_1.writeLog)(`[readMonoConfig] Looking for mono config at:`, configPath);
|
|
130
131
|
if (!(await exists(configPath))) {
|
|
131
|
-
|
|
132
|
+
(0, shared_1.writeLog)(`[readMonoConfig] No mono config found.`);
|
|
132
133
|
return null;
|
|
133
134
|
}
|
|
134
135
|
try {
|
|
@@ -440,10 +441,10 @@ async function main() {
|
|
|
440
441
|
val.split('\n').forEach((line) => parts.push(line));
|
|
441
442
|
await ensureParentDir(OUTPUT_README);
|
|
442
443
|
await node_fs_1.promises.writeFile(OUTPUT_README, parts.join('\n'), 'utf8');
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
444
|
+
(0, shared_1.writeLog)(`[main] Generated: ${OUTPUT_README}`);
|
|
445
|
+
(0, shared_1.writeLog)(`[main] mono config: ${monoConfig ? 'yes' : 'no'}`);
|
|
446
|
+
(0, shared_1.writeLog)(`[main] mono commands: ${monoCommands.length}`);
|
|
447
|
+
(0, shared_1.writeLog)(`[main] workspace packages: ${packages.length}`);
|
|
447
448
|
}
|
|
448
449
|
main().catch((err) => {
|
|
449
450
|
console.error(err?.stack || String(err));
|
|
@@ -18,6 +18,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
18
18
|
const node_fs_1 = require("node:fs");
|
|
19
19
|
const node_path_1 = __importDefault(require("node:path"));
|
|
20
20
|
const generate_docs_1 = require("./generate-docs");
|
|
21
|
+
const shared_1 = require("@mono-labs/shared");
|
|
21
22
|
// ----------------- config -----------------
|
|
22
23
|
// Always use the working directory as the root for all file actions
|
|
23
24
|
const REPO_ROOT = node_path_1.default.resolve(process.cwd());
|
|
@@ -300,8 +301,8 @@ async function main() {
|
|
|
300
301
|
val.split('\n').forEach((line) => lines.push(line));
|
|
301
302
|
await ensureParentDir(OUTPUT_PATH);
|
|
302
303
|
await node_fs_1.promises.writeFile(OUTPUT_PATH, lines.join('\n'), 'utf8');
|
|
303
|
-
|
|
304
|
-
|
|
304
|
+
(0, shared_1.writeLog)(`Generated ${OUTPUT_PATH}`);
|
|
305
|
+
(0, shared_1.writeLog)(`Packages found: ${packages.length}`);
|
|
305
306
|
}
|
|
306
307
|
main().catch((err) => {
|
|
307
308
|
console.error(err);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/stack/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,aAAa,CAAA;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/stack/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,aAAa,CAAA;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAQtC,MAAM,WAAW,YAAa,SAAQ,GAAG,CAAC,KAAK;IAC7C,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,MAAM,CAAA;IACd,gBAAgB,EAAE,OAAO,CAAA;CAC1B;AAED,MAAM,WAAW,gBAAiB,SAAQ,GAAG,CAAC,UAAU;IACtD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED,8BAAsB,WAAY,SAAQ,GAAG,CAAC,KAAK;IAC1C,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,CAAC,EAAE,MAAM,CAAA;IAC1B,SAAS,CAAC,gBAAgB,EAAE,OAAO,CAAQ;gBAE/B,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,GAAE,gBAAqB;IAmB/D,qBAAqB,IAAI,IAAI;CA0BrC"}
|
package/dist/stack/index.js
CHANGED
|
@@ -36,6 +36,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.CustomStack = void 0;
|
|
37
37
|
const cdk = __importStar(require("aws-cdk-lib"));
|
|
38
38
|
const index_1 = require("../project/index");
|
|
39
|
+
const shared_1 = require("@mono-labs/shared");
|
|
39
40
|
(0, index_1.loadMergedEnv)();
|
|
40
41
|
//cdk deploy --context owner=cody --context region=us-west-1
|
|
41
42
|
const dev = 'dev';
|
|
@@ -77,7 +78,7 @@ class CustomStack extends cdk.Stack {
|
|
|
77
78
|
if (this.ownerName === 'prod' || this.ownerName === 'production') {
|
|
78
79
|
this.enableNATGateway = ctxNat !== 'false';
|
|
79
80
|
}
|
|
80
|
-
|
|
81
|
+
(0, shared_1.writeLog)('[Stack Config]', {
|
|
81
82
|
owner: this.ownerName,
|
|
82
83
|
region: this.region,
|
|
83
84
|
account: this.account,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mono-labs/project",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.258",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"description": "Project configuration utilities for mono-labs",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
"license": "MIT",
|
|
34
34
|
"dependencies": {
|
|
35
|
+
"@mono-labs/shared": "0.1.257",
|
|
35
36
|
"dotenv": "^17.2.0"
|
|
36
37
|
},
|
|
37
38
|
"peerDependencies": {
|
|
@@ -4,6 +4,7 @@ import { promises as fs } from 'node:fs'
|
|
|
4
4
|
import { Dirent } from 'node:fs'
|
|
5
5
|
import path from 'node:path'
|
|
6
6
|
import { generateDocsIndex } from './generate-docs'
|
|
7
|
+
import { writeLog } from '@mono-labs/shared'
|
|
7
8
|
|
|
8
9
|
const REPO_ROOT = path.resolve(process.cwd())
|
|
9
10
|
const MONO_DIR = path.join(REPO_ROOT, '.mono')
|
|
@@ -136,9 +137,9 @@ async function findWorkspacePackageDirs(
|
|
|
136
137
|
// ---------- .mono parsing ----------
|
|
137
138
|
async function readMonoConfig(): Promise<MonoConfig | null> {
|
|
138
139
|
const configPath = path.join(MONO_DIR, 'config.json')
|
|
139
|
-
|
|
140
|
+
writeLog(`[readMonoConfig] Looking for mono config at:`, configPath)
|
|
140
141
|
if (!(await exists(configPath))) {
|
|
141
|
-
|
|
142
|
+
writeLog(`[readMonoConfig] No mono config found.`)
|
|
142
143
|
return null
|
|
143
144
|
}
|
|
144
145
|
try {
|
|
@@ -528,10 +529,10 @@ async function main(): Promise<void> {
|
|
|
528
529
|
await ensureParentDir(OUTPUT_README)
|
|
529
530
|
await fs.writeFile(OUTPUT_README, parts.join('\n'), 'utf8')
|
|
530
531
|
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
532
|
+
writeLog(`[main] Generated: ${OUTPUT_README}`)
|
|
533
|
+
writeLog(`[main] mono config: ${monoConfig ? 'yes' : 'no'}`)
|
|
534
|
+
writeLog(`[main] mono commands: ${monoCommands.length}`)
|
|
535
|
+
writeLog(`[main] workspace packages: ${packages.length}`)
|
|
535
536
|
}
|
|
536
537
|
|
|
537
538
|
main().catch((err) => {
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
import { promises as fs } from 'node:fs'
|
|
15
15
|
import path from 'node:path'
|
|
16
16
|
import { generateDocsIndex } from './generate-docs'
|
|
17
|
+
import { writeLog } from '@mono-labs/shared'
|
|
17
18
|
|
|
18
19
|
interface PackageInfo {
|
|
19
20
|
name: string
|
|
@@ -341,8 +342,8 @@ async function main(): Promise<void> {
|
|
|
341
342
|
await ensureParentDir(OUTPUT_PATH)
|
|
342
343
|
await fs.writeFile(OUTPUT_PATH, lines.join('\n'), 'utf8')
|
|
343
344
|
|
|
344
|
-
|
|
345
|
-
|
|
345
|
+
writeLog(`Generated ${OUTPUT_PATH}`)
|
|
346
|
+
writeLog(`Packages found: ${packages.length}`)
|
|
346
347
|
}
|
|
347
348
|
|
|
348
349
|
main().catch((err) => {
|
package/src/stack/index.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as cdk from 'aws-cdk-lib'
|
|
2
2
|
import { Construct } from 'constructs'
|
|
3
3
|
import { loadMergedEnv } from '../project/index'
|
|
4
|
+
import { writeLog } from '@mono-labs/shared'
|
|
4
5
|
|
|
5
6
|
loadMergedEnv()
|
|
6
7
|
//cdk deploy --context owner=cody --context region=us-west-1
|
|
@@ -63,7 +64,7 @@ export abstract class CustomStack extends cdk.Stack {
|
|
|
63
64
|
this.enableNATGateway = ctxNat !== 'false'
|
|
64
65
|
}
|
|
65
66
|
|
|
66
|
-
|
|
67
|
+
writeLog('[Stack Config]', {
|
|
67
68
|
owner: this.ownerName,
|
|
68
69
|
region: this.region,
|
|
69
70
|
account: this.account,
|