@mono-labs/project 0.0.248 → 0.1.249

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.
Files changed (2) hide show
  1. package/README.md +91 -0
  2. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,91 @@
1
+ # @mono-labs/project
2
+
3
+ Foundational utility package for Mono. Provides project root discovery, `.mono` config loading, and environment variable merging.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ yarn add @mono-labs/project
9
+ ```
10
+
11
+ ## API Reference
12
+
13
+ ### Project Root
14
+
15
+ ```typescript
16
+ import {
17
+ findProjectRoot,
18
+ getRootDirectory,
19
+ getRootJson
20
+ } from "@mono-labs/project";
21
+ ```
22
+
23
+ - **`findProjectRoot(startDir?)`** -- Walk up the directory tree from `startDir` (or `cwd`) to find the nearest `package.json`. Returns the directory path.
24
+ - **`getRootDirectory()`** -- Returns the project root directory path.
25
+ - **`getRootJson()`** -- Reads and returns the root `package.json` as a parsed object.
26
+
27
+ ### Mono Configuration
28
+
29
+ ```typescript
30
+ import {
31
+ resolveMonoDirectory,
32
+ getMonoFiles,
33
+ getMonoConfig
34
+ } from "@mono-labs/project";
35
+ ```
36
+
37
+ - **`resolveMonoDirectory()`** -- Resolves the path to the `.mono/` directory (checks project root and cwd).
38
+ - **`getMonoFiles()`** -- Returns a `MonoFiles` record of all `.mono/*.json` command definitions (excluding `config.json`).
39
+ - **`getMonoConfig()`** -- Loads and returns the parsed `.mono/config.json` as a `MonoConfig` object.
40
+
41
+ ### App Configuration
42
+
43
+ ```typescript
44
+ import {
45
+ loadAppConfig,
46
+ loadProjectConfig
47
+ } from "@mono-labs/project";
48
+ ```
49
+
50
+ - **`loadAppConfig(configType?, startDir?)`** -- Loads a typed config file (`mono.app.json`, `mono.deployment.json`, etc.) from the project. Supports both local development (workspace discovery) and Lambda runtime (bundled config).
51
+ - **`loadProjectConfig()`** -- Alias for `loadAppConfig()`.
52
+
53
+ ### Environment Merging
54
+
55
+ ```typescript
56
+ import { loadMergedEnv } from "@mono-labs/project";
57
+ ```
58
+
59
+ - **`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
+ ### Subpath Export
62
+
63
+ The `@mono-labs/project/project` subpath provides access to app config loading and documentation generation utilities.
64
+
65
+ ## Config Types
66
+
67
+ ```typescript
68
+ import type {
69
+ MonoConfig,
70
+ MonoProjectConfig,
71
+ MonoWorkspaceConfig,
72
+ MonoFiles
73
+ } from "@mono-labs/project";
74
+ ```
75
+
76
+ - **`MonoConfig`** -- Full mono configuration: `envMap?: string[]`, `workspace?: MonoWorkspaceConfig`, `prodFlag?: string`
77
+ - **`MonoWorkspaceConfig`** -- Workspace settings: `packageMaps?: Record<string, string>`, `preactions?: string[]`
78
+ - **`MonoProjectConfig`** -- Project config with `envMap`, `workspace`, and `prodFlag`
79
+ - **`MonoFiles`** -- Record of command definition objects keyed by filename
80
+
81
+ ## Development
82
+
83
+ Build the project package:
84
+
85
+ ```bash
86
+ yarn build:project
87
+ ```
88
+
89
+ This package has no internal dependencies -- it sits at the base of the dependency graph. Both `@mono-labs/expo` and `@mono-labs/cli` depend on it.
90
+
91
+ See the [Contributing guide](../../CONTRIBUTING.md) for full development setup.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mono-labs/project",
3
- "version": "0.0.248",
3
+ "version": "0.1.249",
4
4
  "type": "commonjs",
5
5
  "description": "Project configuration utilities for mono-labs",
6
6
  "main": "dist/index.js",