@mono-labs/cli 0.0.242 → 0.0.244

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 (41) hide show
  1. package/dist/lib/commands/build-process/runMonoCommand.js +2 -0
  2. package/dist/src/tools.js +1 -2
  3. package/lib/commands/build-process/runMonoCommand.ts +1 -0
  4. package/package.json +3 -2
  5. package/src/tools.ts +31 -40
  6. package/lib/app.d.ts +0 -3
  7. package/lib/commands/build-process/boot.d.ts +0 -8
  8. package/lib/commands/build-process/cliFactory.d.ts +0 -32
  9. package/lib/commands/build-process/dataLayer.d.ts +0 -7
  10. package/lib/commands/build-process/index.d.ts +0 -1
  11. package/lib/commands/build-process/readEnv.d.ts +0 -1
  12. package/lib/commands/build-process/runMonoCommand.d.ts +0 -10
  13. package/lib/commands/build-process/runners/processManager.d.ts +0 -5
  14. package/lib/commands/build-process/runners/runBackground.d.ts +0 -2
  15. package/lib/commands/build-process/runners/runForeground.d.ts +0 -6
  16. package/lib/commands/build-process/test.d.ts +0 -1
  17. package/lib/commands/build-process/testflag.d.ts +0 -1
  18. package/lib/commands/build-process/validators.d.ts +0 -1
  19. package/lib/commands/loadFromRoot.d.ts +0 -7
  20. package/lib/commands/prune/index.d.ts +0 -1
  21. package/lib/commands/prune/prune.d.ts +0 -1
  22. package/lib/config.d.ts +0 -2
  23. package/lib/filterUnwantedEnvVars.d.ts +0 -2
  24. package/lib/generateNewEnvList.d.ts +0 -1
  25. package/lib/index.d.ts +0 -2
  26. package/src/cdk/cdk.d.ts +0 -1
  27. package/src/cdk/index.d.ts +0 -1
  28. package/src/expo-files/filterUnwantedEnvVars.d.ts +0 -3
  29. package/src/expo.d.ts +0 -4
  30. package/src/index.d.ts +0 -22
  31. package/src/loadFromRoot.d.ts +0 -32
  32. package/src/merge-env.d.ts +0 -1
  33. package/src/project/build-mono-readme.d.ts +0 -1
  34. package/src/project/build-readme.d.ts +0 -2
  35. package/src/project/generate-docs.d.ts +0 -11
  36. package/src/project/generate-readme.d.ts +0 -1
  37. package/src/project/index.d.ts +0 -45
  38. package/src/project/merge-env.d.ts +0 -1
  39. package/src/stack.d.ts +0 -21
  40. package/src/tools.d.ts +0 -3
  41. package/src/types/expo-config.d.ts +0 -49
@@ -11,6 +11,7 @@ const processManager_1 = require("./runners/processManager");
11
11
  const loadFromRoot_1 = require("../loadFromRoot");
12
12
  const readEnv_1 = require("./readEnv");
13
13
  const node_path_1 = __importDefault(require("node:path"));
14
+ const dataLayer_1 = require("./dataLayer");
14
15
  function getAllowAllKeys(cfg) {
15
16
  const decls = cfg.options ?? {};
16
17
  return Object.entries(decls)
@@ -30,6 +31,7 @@ async function runMonoCommand(configObject, options = {}) {
30
31
  const { config } = (0, loadFromRoot_1.getMonoConfig)();
31
32
  const devConfig = configObject.environments?.dev ?? {};
32
33
  console.log('configObject:', JSON.stringify(configObject, null, 2));
34
+ (0, dataLayer_1.mergeData)({ ...options });
33
35
  // Usage:
34
36
  const envPath = node_path_1.default.resolve(process.cwd(), '.env');
35
37
  const keymap = (0, readEnv_1.parseEnvFile)(envPath);
package/dist/src/tools.js CHANGED
@@ -18,7 +18,6 @@ function filterEnvByPrefix(env, prefix) {
18
18
  }
19
19
  return filtered;
20
20
  }
21
- const envCast = process.env;
22
21
  function setUpConfig(config) {
23
22
  const { extra = {}, ...other } = (config.expo ?? {});
24
23
  const router = extra['router'] ? { origin: false, ...extra['router'] } : { origin: false };
@@ -29,7 +28,7 @@ function setUpConfig(config) {
29
28
  extra: {
30
29
  ...filterEnvByPrefix(process.env, 'NEXT_PUBLIC_'),
31
30
  eas: {
32
- projectId: process?.env?.EAS_PROJECT_ID,
31
+ projectId: process.env.EAS_PROJECT_ID,
33
32
  },
34
33
  router,
35
34
  ...extra,
@@ -30,6 +30,7 @@ export async function runMonoCommand(configObject: any, options: any = {}): Prom
30
30
  const { config } = getMonoConfig() as { config: any }
31
31
  const devConfig = configObject.environments?.dev ?? {}
32
32
  console.log('configObject:', JSON.stringify(configObject, null, 2))
33
+ mergeData({ ...options })
33
34
 
34
35
  // Usage:
35
36
  const envPath = path.resolve(process.cwd(), '.env')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mono-labs/cli",
3
- "version": "0.0.242",
3
+ "version": "0.0.244",
4
4
  "type": "commonjs",
5
5
  "description": "A CLI tool for building and deploying projects",
6
6
  "main": "dist/index.js",
@@ -85,7 +85,8 @@
85
85
  "devDependencies": {
86
86
  "@types/node": "^25.1.0",
87
87
  "eslint": "^8.57.0",
88
- "typescript": "^5.9.3"
88
+ "typescript": "^5.9.3",
89
+ "expo": ">=52"
89
90
  },
90
91
  "peerDependencies": {
91
92
  "expo": ">=52"
package/src/tools.ts CHANGED
@@ -1,48 +1,39 @@
1
- import type { ExpoConfig, AppJSONConfig } from 'expo/config';
1
+ import type { ExpoConfig, AppJSONConfig } from 'expo/config'
2
2
 
3
- export function replaceTokens(
4
- input: string,
5
- tokens: Record<string, string>
6
- ): string {
7
- return input.replace(/\$\{([^}]+)\}|\$([A-Z0-9_]+)/g, (_m, k1, k2) => {
8
- const key = (k1 || k2) as string;
9
- const val = tokens[key];
10
- return val == null ? '' : String(val);
11
- });
3
+ export function replaceTokens(input: string, tokens: Record<string, string>): string {
4
+ return input.replace(/\$\{([^}]+)\}|\$([A-Z0-9_]+)/g, (_m, k1, k2) => {
5
+ const key = (k1 || k2) as string
6
+ const val = tokens[key]
7
+ return val == null ? '' : String(val)
8
+ })
12
9
  }
13
10
 
14
- function filterEnvByPrefix(
15
- env: NodeJS.ProcessEnv,
16
- prefix: string
17
- ): Record<string, string> {
18
- const filtered: Record<string, string> = {};
19
- for (const [key, value] of Object.entries(env)) {
20
- if (key.startsWith(prefix) && typeof value === 'string') {
21
- filtered[key] = value;
22
- }
23
- }
24
- return filtered;
11
+ function filterEnvByPrefix(env: NodeJS.ProcessEnv, prefix: string): Record<string, string> {
12
+ const filtered: Record<string, string> = {}
13
+ for (const [key, value] of Object.entries(env)) {
14
+ if (key.startsWith(prefix) && typeof value === 'string') {
15
+ filtered[key] = value
16
+ }
17
+ }
18
+ return filtered
25
19
  }
26
20
 
27
- const envCast: any = process.env as any;
28
-
29
21
  export function setUpConfig(config: AppJSONConfig): ExpoConfig {
30
- const { extra = {}, ...other } = (config.expo ?? {}) as any;
31
- const router =
32
- extra['router'] ? { origin: false, ...extra['router'] } : { origin: false };
22
+ const { extra = {}, ...other } = (config.expo ?? {}) as any
23
+ const router = extra['router'] ? { origin: false, ...extra['router'] } : { origin: false }
33
24
 
34
- return {
35
- ...(config as any),
36
- expo: {
37
- ...other,
38
- extra: {
39
- ...filterEnvByPrefix(process.env, 'NEXT_PUBLIC_'),
40
- eas: {
41
- projectId: process?.env?.EAS_PROJECT_ID,
42
- },
43
- router,
44
- ...extra,
45
- },
46
- },
47
- } as ExpoConfig;
25
+ return {
26
+ ...(config as any),
27
+ expo: {
28
+ ...other,
29
+ extra: {
30
+ ...filterEnvByPrefix(process.env, 'NEXT_PUBLIC_'),
31
+ eas: {
32
+ projectId: process.env.EAS_PROJECT_ID,
33
+ },
34
+ router,
35
+ ...extra,
36
+ },
37
+ },
38
+ } as ExpoConfig
48
39
  }
package/lib/app.d.ts DELETED
@@ -1,3 +0,0 @@
1
- import { Command } from 'commander';
2
- export declare const program: Command;
3
- export declare const generateEnvValues: (forceProd?: boolean, ngrokUrl?: string, useAtlas?: boolean) => NodeJS.ProcessEnv;
@@ -1,8 +0,0 @@
1
- export type BootResult = {
2
- rootDir: unknown;
3
- rootJson: unknown;
4
- files: Record<string, unknown>;
5
- config: Record<string, unknown>;
6
- };
7
- export declare function boot(): BootResult;
8
- export default boot;
@@ -1,32 +0,0 @@
1
- import { Command } from 'commander';
2
- type MonoFileDefinition = {
3
- name?: string;
4
- description?: string;
5
- argument?: {
6
- required?: boolean;
7
- type?: string;
8
- description?: string;
9
- default?: unknown;
10
- options?: string[];
11
- allowAll?: boolean;
12
- };
13
- options?: Record<string, {
14
- type?: 'string' | 'boolean';
15
- shortcut?: string;
16
- description?: string;
17
- default?: unknown;
18
- options?: string[];
19
- allowAll?: boolean;
20
- }>;
21
- environments?: Record<string, Record<string, unknown>>;
22
- preactions?: string[];
23
- actions?: string[];
24
- };
25
- /**
26
- * Register commander commands for each mono file definition.
27
- * Handles argument, options, validation, and action wiring.
28
- */
29
- export declare function createConfigCommands(): Command;
30
- export declare function createCliCommands(): Command;
31
- export declare function buildCommands(files: Record<string, MonoFileDefinition>): void;
32
- export default buildCommands;
@@ -1,7 +0,0 @@
1
- declare const dataLayer: Record<string, unknown>;
2
- export declare function setData(key: string, value: unknown): void;
3
- export declare function mergeData(obj?: Record<string, unknown>): Record<string, unknown>;
4
- export declare function getData(key?: string): unknown;
5
- export declare function hasData(key: string): boolean;
6
- export declare function replaceTokens(str: unknown, env?: Record<string, unknown>): unknown;
7
- export default dataLayer;
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export declare function parseEnvFile(filePath: string): Record<string, string>;
@@ -1,10 +0,0 @@
1
- export declare function getAllowAllKeys(cfg: any): string[];
2
- /**
3
- * Orchestrate execution of a single mono command definition.
4
- * Phases:
5
- * 1. Preactions (sequential, blocking) via runForeground
6
- * 2. Actions (background except last; last attached) via runBackground
7
- * Environment selection based on --stage flag and injection of AWS_PROFILE.
8
- */
9
- export declare function runMonoCommand(configObject: any, options?: any): Promise<void>;
10
- export default runMonoCommand;
@@ -1,5 +0,0 @@
1
- import { type ChildProcess } from 'child_process';
2
- export declare const bgChildren: Set<ChildProcess>;
3
- export declare function registerBackground(child: ChildProcess): void;
4
- export declare function killAllBackground(): void;
5
- export declare function ensureSignalHandlers(): void;
@@ -1,2 +0,0 @@
1
- export declare function runBackground(cmd: string, envObj?: Record<string, unknown>, logName?: string, attached?: boolean): Promise<void>;
2
- export default runBackground;
@@ -1,6 +0,0 @@
1
- /**
2
- * Run a command in the foreground, capturing stdout/stderr. Extracts token patterns
3
- * of the form {out:field value} and stores them in the shared dataLayer.
4
- */
5
- export declare function runForeground(cmd: string, envObj?: NodeJS.ProcessEnv, _options?: Record<string, unknown>): Promise<string>;
6
- export default runForeground;
@@ -1 +0,0 @@
1
- export declare function executeCommandsIfWorkspaceAction(action: any, commands: string[] | undefined, fullEnv: NodeJS.ProcessEnv): void;
@@ -1 +0,0 @@
1
- export declare const testFlag: true;
@@ -1 +0,0 @@
1
- export declare function verifyOptionValue(optionKey: string, value: any, optionsData: any): any;
@@ -1,7 +0,0 @@
1
- export declare function getRootDirectory(): string;
2
- export declare function getRootJson(): any;
3
- export declare function getMonoFiles(): string[];
4
- export declare function getMonoConfig(): {
5
- files: Record<string, any>;
6
- config: any;
7
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export declare function pruneRepo(): void;
package/lib/config.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export declare const STAGE_URL = "https://p2po52rai264bk62bec2cmtzdi0rqhnw.lambda-url.us-east-2.on.aws/";
2
- export declare const STAGING_URL: string;
@@ -1,2 +0,0 @@
1
- export declare function filterUnwantedEnvVars(env: NodeJS.ProcessEnv): Record<string, string | undefined>;
2
- export declare function filterUnwantedEnvVarsEAS(env: NodeJS.ProcessEnv): Record<string, string | undefined>;
@@ -1 +0,0 @@
1
- export declare function generateNewEnvList(processEnv: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
package/lib/index.d.ts DELETED
@@ -1,2 +0,0 @@
1
- import './commands/prune/index'
2
- import './commands/build-process/index'
package/src/cdk/cdk.d.ts DELETED
@@ -1 +0,0 @@
1
- export { replaceTokens, setUpConfig } from '../tools'
@@ -1 +0,0 @@
1
- export * from './cdk'
@@ -1,3 +0,0 @@
1
- export declare function filterUnwantedEnvVars(env: Record<string, string>): Record<string, string>;
2
- export declare function filterUnwantedEnvVarsEAS(env: Record<string, string>): Record<string, string>;
3
- export declare function generateNewEnvList(processEnv: Record<string, string>): Record<string, string>;
package/src/expo.d.ts DELETED
@@ -1,4 +0,0 @@
1
- import type { AppJSONConfig, ExpoConfig } from 'expo/config';
2
- export declare function replaceTokens(input: string, tokens: Record<string, string>): string;
3
- export declare function setUpConfig(config: AppJSONConfig): ExpoConfig;
4
- export declare function filterUnwantedEnvVarsEAS(envVars: Record<string, string>): Record<string, string>;
package/src/index.d.ts DELETED
@@ -1,22 +0,0 @@
1
- import {
2
- filterUnwantedEnvVars,
3
- filterUnwantedEnvVarsEAS,
4
- generateNewEnvList,
5
- } from './expo-files/filterUnwantedEnvVars'
6
- type DataLayer = Record<string, unknown>
7
- export declare function setData(key: string, value: unknown): void
8
- export declare function mergeData(obj?: Record<string, unknown>): DataLayer
9
- export declare function getData(key?: string): unknown
10
- export declare function hasData(key: string): boolean
11
- export declare function replaceTokens(
12
- str: unknown,
13
- env?: Record<string, string | undefined>
14
- ): unknown
15
- export { generateNewEnvList, filterUnwantedEnvVars, filterUnwantedEnvVarsEAS }
16
- declare const _default: {
17
- generateNewEnvList: typeof generateNewEnvList
18
- replaceTokens: typeof replaceTokens
19
- filterUnwantedEnvVars: typeof filterUnwantedEnvVars
20
- filterUnwantedEnvVarsEAS: typeof filterUnwantedEnvVarsEAS
21
- }
22
- export default _default
@@ -1,32 +0,0 @@
1
- export interface MonoWorkspaceConfig {
2
- packageMaps: Record<string, string>;
3
- }
4
- export interface MonoProjectConfig {
5
- envMap: string[];
6
- workspace: MonoWorkspaceConfig;
7
- prodFlag: string;
8
- }
9
- export type MonoFiles = Record<string, unknown>;
10
- export interface MonoConfig {
11
- config: MonoProjectConfig;
12
- files: MonoFiles;
13
- }
14
- /**
15
- * Walk up from cwd until we find a directory containing package.json.
16
- * This is treated as the project root.
17
- */
18
- export declare function findProjectRoot(startDir?: string): string;
19
- export declare function getRootDirectory(): string;
20
- export declare function getRootJson(): Record<string, unknown>;
21
- /**
22
- * Resolve the .mono directory.
23
- * Priority:
24
- * 1. project root/.mono
25
- * 2. cwd/.mono
26
- */
27
- export declare function resolveMonoDirectory(): string | null;
28
- export declare function getMonoFiles(): string[];
29
- /**
30
- * Load and validate mono configuration.
31
- */
32
- export declare function getMonoConfig(): MonoConfig;
@@ -1 +0,0 @@
1
- export declare function loadMergedEnv(): NodeJS.ProcessEnv;
@@ -1 +0,0 @@
1
- export {};
@@ -1,2 +0,0 @@
1
- import './build-mono-readme';
2
- import './generate-readme';
@@ -1,11 +0,0 @@
1
- export interface GenerateDocsIndexOptions {
2
- docsDir: string;
3
- excludeFile?: string;
4
- }
5
- /**
6
- * Generate a docs index from markdown files.
7
- *
8
- * @param options - Options for docs index generation
9
- * @returns Markdown-formatted index
10
- */
11
- export declare function generateDocsIndex({ docsDir, excludeFile, }: GenerateDocsIndexOptions): Promise<string>;
@@ -1 +0,0 @@
1
- export {};
@@ -1,45 +0,0 @@
1
- type WorkspaceDetectResult = {
2
- cwd: string
3
- workspaceRoot: string | null
4
- isWorkspaceRoot: boolean
5
- configDir: string
6
- configPath: string
7
- }
8
- type DefaultAppConfig = {
9
- appleAppId?: string
10
- androidAppId?: string
11
- appName?: string
12
- easProjectId?: string
13
- appScheme?: string
14
- }
15
- type DefaultDeployConfig = {
16
- baseDomain?: string
17
- webSubdomain?: string
18
- apiSubdomain?: string
19
- defaultKeyPair?: string
20
- regions: string[]
21
- ec2User: string
22
- warehouseRegion: string
23
- dbInstanceType: string
24
- appInstanceType: string
25
- }
26
- type ConfigTypeMap = {
27
- app: DefaultAppConfig
28
- deployment: DefaultDeployConfig
29
- }
30
- /**
31
- * If TType is a known key, use the mapped type.
32
- * Otherwise use TCustom (default = unknown).
33
- */
34
- type ResolveConfig<TType extends string, TCustom = unknown> = TType extends keyof ConfigTypeMap
35
- ? ConfigTypeMap[TType]
36
- : TCustom
37
- export declare function loadAppConfig<TCustom = unknown, TType extends string = 'app'>(
38
- configType?: TType,
39
- startDir?: string
40
- ): {
41
- config: ResolveConfig<TType, TCustom>
42
- meta: WorkspaceDetectResult
43
- }
44
- export declare const loadProjectConfig: typeof loadAppConfig
45
- export { loadMergedEnv } from './merge-env'
@@ -1 +0,0 @@
1
- export declare function loadMergedEnv(): NodeJS.ProcessEnv;
package/src/stack.d.ts DELETED
@@ -1,21 +0,0 @@
1
- import * as cdk from 'aws-cdk-lib';
2
- import { Construct } from 'constructs';
3
- export interface ICustomStack extends cdk.Stack {
4
- ownerName: string;
5
- region: string;
6
- enableNATGateway: boolean;
7
- }
8
- export interface CustomStackProps extends cdk.StackProps {
9
- ownerName?: string;
10
- region?: string;
11
- enableNATGateway?: boolean;
12
- domainName?: string;
13
- }
14
- export declare abstract class CustomStack extends cdk.Stack {
15
- ownerName: string;
16
- region: string;
17
- domainName?: string;
18
- protected enableNATGateway: boolean;
19
- constructor(scope: Construct, id: string, props?: CustomStackProps);
20
- initializeStackConfig(): void;
21
- }
package/src/tools.d.ts DELETED
@@ -1,3 +0,0 @@
1
- import type { ExpoConfig, AppJSONConfig } from 'expo/config';
2
- export declare function replaceTokens(input: string, tokens: Record<string, string>): string;
3
- export declare function setUpConfig(config: AppJSONConfig): ExpoConfig;
@@ -1,49 +0,0 @@
1
- // src/types/expo-config.d.ts
2
- declare module 'expo/config' {
3
- /**
4
- * Shape of app.json / app.config.js
5
- * Mirrors Expo's internal AppJSONConfig
6
- */
7
- export interface AppJSONConfig {
8
- expo?: ExpoConfig
9
- name?: string
10
- slug?: string
11
- version?: string
12
- orientation?: string
13
- sdkVersion?: string
14
- ios?: Record<string, any>
15
- android?: Record<string, any>
16
- web?: Record<string, any>
17
- extra?: Record<string, any>
18
- updates?: Record<string, any>
19
- runtimeVersion?: string | Record<string, any>
20
- experiments?: Record<string, any>
21
- [key: string]: any
22
- }
23
-
24
- /**
25
- * Normalized Expo config (exp)
26
- */
27
- export interface ExpoConfig {
28
- name?: string
29
- slug?: string
30
- version?: string
31
- orientation?: string
32
- ios?: Record<string, any>
33
- android?: Record<string, any>
34
- web?: Record<string, any>
35
- extra?: Record<string, any>
36
- updates?: Record<string, any>
37
- runtimeVersion?: string | Record<string, any>
38
- experiments?: Record<string, any>
39
- [key: string]: any
40
- }
41
-
42
- export function getConfig(
43
- projectRoot: string,
44
- options?: any
45
- ): {
46
- exp: ExpoConfig
47
- rootConfig?: AppJSONConfig
48
- }
49
- }