@open-mercato/cli 0.10.1-develop.7990.1.82d0a183c5 → 0.10.1-develop.8004.1.a8a79ee43f
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/.turbo/turbo-build.log +1 -1
- package/build.mjs +1 -0
- package/dist/agentic/guides/module-facts.json +162 -162
- package/dist/agentic/guides/module-facts.v2.json +162 -162
- package/dist/agentic/guides/module-tool.md +21 -0
- package/dist/agentic/guides/modules/agent_orchestrator/index.md +1 -1
- package/dist/agentic/guides/modules/ai_assistant/index.md +1 -1
- package/dist/agentic/guides/modules/api_docs/index.md +1 -1
- package/dist/agentic/guides/modules/api_keys/index.md +1 -1
- package/dist/agentic/guides/modules/attachments/index.md +1 -1
- package/dist/agentic/guides/modules/audit_logs/index.md +1 -1
- package/dist/agentic/guides/modules/auth/index.md +1 -1
- package/dist/agentic/guides/modules/availability/index.md +1 -1
- package/dist/agentic/guides/modules/business_rules/index.md +1 -1
- package/dist/agentic/guides/modules/carrier_inpost/index.md +1 -1
- package/dist/agentic/guides/modules/cart/index.md +1 -1
- package/dist/agentic/guides/modules/catalog/index.md +1 -1
- package/dist/agentic/guides/modules/channel_apns/index.md +1 -1
- package/dist/agentic/guides/modules/channel_discord/index.md +1 -1
- package/dist/agentic/guides/modules/channel_expo/index.md +1 -1
- package/dist/agentic/guides/modules/channel_fcm/index.md +1 -1
- package/dist/agentic/guides/modules/channel_gmail/index.md +1 -1
- package/dist/agentic/guides/modules/channel_imap/index.md +1 -1
- package/dist/agentic/guides/modules/channel_resend/index.md +1 -1
- package/dist/agentic/guides/modules/channel_ses/index.md +1 -1
- package/dist/agentic/guides/modules/channel_smtp/index.md +1 -1
- package/dist/agentic/guides/modules/checkout/index.md +1 -1
- package/dist/agentic/guides/modules/communication_channels/index.md +1 -1
- package/dist/agentic/guides/modules/configs/index.md +1 -1
- package/dist/agentic/guides/modules/content/index.md +1 -1
- package/dist/agentic/guides/modules/currencies/index.md +1 -1
- package/dist/agentic/guides/modules/customer_accounts/index.md +1 -1
- package/dist/agentic/guides/modules/customer_groups/index.md +1 -1
- package/dist/agentic/guides/modules/customers/index.md +1 -1
- package/dist/agentic/guides/modules/dashboards/index.md +1 -1
- package/dist/agentic/guides/modules/data_sync/index.md +1 -1
- package/dist/agentic/guides/modules/design_system/index.md +1 -1
- package/dist/agentic/guides/modules/devices/index.md +1 -1
- package/dist/agentic/guides/modules/dictionaries/index.md +1 -1
- package/dist/agentic/guides/modules/directory/index.md +1 -1
- package/dist/agentic/guides/modules/documents/index.md +1 -1
- package/dist/agentic/guides/modules/ecommerce/index.md +1 -1
- package/dist/agentic/guides/modules/entities/index.md +1 -1
- package/dist/agentic/guides/modules/eudr/index.md +1 -1
- package/dist/agentic/guides/modules/events/index.md +1 -1
- package/dist/agentic/guides/modules/feature_toggles/index.md +1 -1
- package/dist/agentic/guides/modules/forms/index.md +1 -1
- package/dist/agentic/guides/modules/gateway_autopay/index.md +1 -1
- package/dist/agentic/guides/modules/gateway_stripe/index.md +1 -1
- package/dist/agentic/guides/modules/gateway_tpay/index.md +1 -1
- package/dist/agentic/guides/modules/generators/index.md +1 -1
- package/dist/agentic/guides/modules/inbox_ops/index.md +1 -1
- package/dist/agentic/guides/modules/integrations/index.md +1 -1
- package/dist/agentic/guides/modules/messages/index.md +1 -1
- package/dist/agentic/guides/modules/notifications/index.md +1 -1
- package/dist/agentic/guides/modules/onboarding/index.md +1 -1
- package/dist/agentic/guides/modules/payment_gateways/index.md +1 -1
- package/dist/agentic/guides/modules/perspectives/index.md +1 -1
- package/dist/agentic/guides/modules/phone_calls/index.md +1 -1
- package/dist/agentic/guides/modules/planner/index.md +1 -1
- package/dist/agentic/guides/modules/portal/index.md +1 -1
- package/dist/agentic/guides/modules/progress/index.md +1 -1
- package/dist/agentic/guides/modules/promotions/index.md +1 -1
- package/dist/agentic/guides/modules/push_notifications/index.md +1 -1
- package/dist/agentic/guides/modules/query_index/index.md +1 -1
- package/dist/agentic/guides/modules/record_locks/index.md +1 -1
- package/dist/agentic/guides/modules/resources/index.md +1 -1
- package/dist/agentic/guides/modules/sales/index.md +1 -1
- package/dist/agentic/guides/modules/scheduler/index.md +1 -1
- package/dist/agentic/guides/modules/search/index.md +1 -1
- package/dist/agentic/guides/modules/security/index.md +1 -1
- package/dist/agentic/guides/modules/seeds/index.md +1 -1
- package/dist/agentic/guides/modules/shipping_carriers/index.md +1 -1
- package/dist/agentic/guides/modules/sso/index.md +1 -1
- package/dist/agentic/guides/modules/staff/index.md +1 -1
- package/dist/agentic/guides/modules/storage_s3/index.md +1 -1
- package/dist/agentic/guides/modules/sync_akeneo/index.md +1 -1
- package/dist/agentic/guides/modules/sync_excel/index.md +1 -1
- package/dist/agentic/guides/modules/system_status_overlays/index.md +1 -1
- package/dist/agentic/guides/modules/telemetry/index.md +1 -1
- package/dist/agentic/guides/modules/tillio/index.md +1 -1
- package/dist/agentic/guides/modules/translations/index.md +1 -1
- package/dist/agentic/guides/modules/warranty_claims/index.md +1 -1
- package/dist/agentic/guides/modules/webhooks/index.md +1 -1
- package/dist/agentic/guides/modules/wms/index.md +1 -1
- package/dist/agentic/guides/modules/workflows/index.md +1 -1
- package/dist/agentic/guides/reference-module-facts.json +1 -1
- package/dist/agentic/guides/upstream/BACKWARD_COMPATIBILITY.md +4 -0
- package/dist/agentic/guides/upstream/manifest.json +2 -2
- package/dist/agentic/shared/ai/harness/cases.json +23 -9
- package/dist/agentic/shared/ai/harness/source-link-inventory.json +90 -4
- package/dist/i18n/de.json +4 -0
- package/dist/i18n/en.json +4 -0
- package/dist/i18n/es.json +4 -0
- package/dist/i18n/ko.json +4 -0
- package/dist/i18n/pl.json +4 -0
- package/dist/lib/__fixtures__/module-search/built-in.json +235 -0
- package/dist/lib/__fixtures__/module-search/catalog-parity.json +4076 -0
- package/dist/lib/__fixtures__/module-search/modules-index.json +1980 -0
- package/dist/lib/__fixtures__/official-module-package/package.json +33 -0
- package/dist/lib/__integration__/TC-INT-007.spec.js +207 -19
- package/dist/lib/__integration__/TC-INT-007.spec.js.map +2 -2
- package/dist/lib/__integration__/TC-INT-009.spec.js +267 -0
- package/dist/lib/__integration__/TC-INT-009.spec.js.map +7 -0
- package/dist/lib/eject.js +25 -9
- package/dist/lib/eject.js.map +2 -2
- package/dist/lib/generators/entity-ids.js +2 -0
- package/dist/lib/generators/entity-ids.js.map +2 -2
- package/dist/lib/generators/module-di.js +2 -0
- package/dist/lib/generators/module-di.js.map +2 -2
- package/dist/lib/generators/module-entities.js +2 -0
- package/dist/lib/generators/module-entities.js.map +2 -2
- package/dist/lib/generators/module-package-sources.js +6 -4
- package/dist/lib/generators/module-package-sources.js.map +2 -2
- package/dist/lib/generators/module-registry.js +32 -86
- package/dist/lib/generators/module-registry.js.map +2 -2
- package/dist/lib/generators/openapi.js +2 -0
- package/dist/lib/generators/openapi.js.map +2 -2
- package/dist/lib/generators/source-exports.js +73 -0
- package/dist/lib/generators/source-exports.js.map +7 -0
- package/dist/lib/init-secrets.js +33 -1
- package/dist/lib/init-secrets.js.map +2 -2
- package/dist/lib/init-summary.js +44 -0
- package/dist/lib/init-summary.js.map +7 -0
- package/dist/lib/module-github.js +98 -0
- package/dist/lib/module-github.js.map +7 -0
- package/dist/lib/module-identity.js +131 -0
- package/dist/lib/module-identity.js.map +7 -0
- package/dist/lib/module-inspection.js +124 -0
- package/dist/lib/module-inspection.js.map +7 -0
- package/dist/lib/module-install.js +150 -21
- package/dist/lib/module-install.js.map +3 -3
- package/dist/lib/module-package.js +205 -15
- package/dist/lib/module-package.js.map +2 -2
- package/dist/lib/modules-config.js +69 -30
- package/dist/lib/modules-config.js.map +2 -2
- package/dist/lib/resolver.js +33 -34
- package/dist/lib/resolver.js.map +2 -2
- package/dist/mercato.js +17 -37
- package/dist/mercato.js.map +2 -2
- package/package.json +7 -7
- package/src/__tests__/mercato.test.ts +71 -4
- package/src/i18n/de.json +4 -0
- package/src/i18n/en.json +4 -0
- package/src/i18n/es.json +4 -0
- package/src/i18n/ko.json +4 -0
- package/src/i18n/pl.json +4 -0
- package/src/lib/__fixtures__/official-module-package/dist/modules/test_package/widgets/injection/test/widget.js +1 -0
- package/src/lib/__integration__/TC-INT-007.spec.ts +219 -19
- package/src/lib/__integration__/TC-INT-009.spec.ts +279 -0
- package/src/lib/__tests__/eject.test.ts +98 -4
- package/src/lib/__tests__/init-secrets.test.ts +85 -1
- package/src/lib/__tests__/init-summary.test.ts +50 -0
- package/src/lib/__tests__/module-github.test.ts +108 -0
- package/src/lib/__tests__/module-identity.test.ts +144 -0
- package/src/lib/__tests__/module-inspection.test.ts +195 -0
- package/src/lib/__tests__/module-install.test.ts +399 -10
- package/src/lib/__tests__/module-package.test.ts +154 -0
- package/src/lib/__tests__/modules-config.test.ts +55 -0
- package/src/lib/__tests__/resolver.packages.test.ts +29 -0
- package/src/lib/eject.ts +28 -10
- package/src/lib/generators/__tests__/module-id-collisions.test.ts +146 -0
- package/src/lib/generators/__tests__/module-package-sources.test.ts +19 -2
- package/src/lib/generators/__tests__/module-requirements.test.ts +56 -0
- package/src/lib/generators/entity-ids.ts +2 -0
- package/src/lib/generators/module-di.ts +2 -0
- package/src/lib/generators/module-entities.ts +2 -0
- package/src/lib/generators/module-package-sources.ts +7 -5
- package/src/lib/generators/module-registry.ts +33 -115
- package/src/lib/generators/openapi.ts +3 -0
- package/src/lib/generators/source-exports.ts +93 -0
- package/src/lib/init-secrets.ts +37 -0
- package/src/lib/init-summary.ts +54 -0
- package/src/lib/module-github.ts +109 -0
- package/src/lib/module-identity.ts +145 -0
- package/src/lib/module-inspection.ts +133 -0
- package/src/lib/module-install.ts +170 -22
- package/src/lib/module-package.ts +243 -16
- package/src/lib/modules-config.ts +80 -32
- package/src/lib/resolver.ts +35 -39
- package/src/mercato.ts +18 -44
- package/src/types/cross-spawn.d.ts +2 -2
package/src/lib/resolver.ts
CHANGED
|
@@ -2,6 +2,7 @@ import path from 'node:path'
|
|
|
2
2
|
import fs from 'node:fs'
|
|
3
3
|
import ts from 'typescript-js'
|
|
4
4
|
import { parseBooleanWithDefault } from '@open-mercato/shared/lib/boolean'
|
|
5
|
+
import { resolveInstalledPackageRootWithRequire } from './module-package'
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Resolved execution environment for the CLI.
|
|
@@ -25,6 +26,8 @@ export type CliEnvironment = {
|
|
|
25
26
|
export type ModuleEntry = {
|
|
26
27
|
id: string
|
|
27
28
|
from?: '@open-mercato/core' | '@app' | string
|
|
29
|
+
locator?: string
|
|
30
|
+
packageName?: string
|
|
28
31
|
devSupervisorRequiresFullBootstrap?: boolean
|
|
29
32
|
}
|
|
30
33
|
|
|
@@ -49,47 +52,33 @@ export interface PackageResolver {
|
|
|
49
52
|
getPackageRoot(from?: string): string
|
|
50
53
|
}
|
|
51
54
|
|
|
52
|
-
function pkgDirFor(rootDir: string, from?: string, isMonorepo = true): string {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
// Monorepo mode - read from src/modules (TypeScript source)
|
|
62
|
-
if (!from || from === '@open-mercato/core') {
|
|
63
|
-
return path.resolve(rootDir, 'packages/core/src/modules')
|
|
64
|
-
}
|
|
65
|
-
// Support other local packages like '@open-mercato/onboarding' => packages/onboarding/src/modules
|
|
66
|
-
const m = from.match(/^@open-mercato\/(.+)$/)
|
|
67
|
-
if (m) {
|
|
68
|
-
return path.resolve(rootDir, `packages/${m[1]}/src/modules`)
|
|
69
|
-
}
|
|
70
|
-
// Fallback to core modules path
|
|
71
|
-
return path.resolve(rootDir, 'packages/core/src/modules')
|
|
55
|
+
function pkgDirFor(rootDir: string, from?: string, isMonorepo = true, appDir = rootDir): string {
|
|
56
|
+
const packageRoot = pkgRootFor(rootDir, from, isMonorepo, appDir)
|
|
57
|
+
const sourceModules = path.join(packageRoot, 'src', 'modules')
|
|
58
|
+
const distModules = path.join(packageRoot, 'dist', 'modules')
|
|
59
|
+
const workspacePackage = isMonorepo && packageRoot.startsWith(path.join(rootDir, 'packages') + path.sep)
|
|
60
|
+
if (workspacePackage && fs.existsSync(sourceModules)) return sourceModules
|
|
61
|
+
if (fs.existsSync(distModules)) return distModules
|
|
62
|
+
return sourceModules
|
|
72
63
|
}
|
|
73
64
|
|
|
74
|
-
function pkgRootFor(rootDir: string, from?: string, isMonorepo = true): string {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}
|
|
83
|
-
const m = from.match(/^@open-mercato\/(.+)$/)
|
|
84
|
-
if (m) {
|
|
85
|
-
return path.resolve(rootDir, `packages/${m[1]}`)
|
|
65
|
+
function pkgRootFor(rootDir: string, from?: string, isMonorepo = true, appDir = rootDir): string {
|
|
66
|
+
const packageName = from || '@open-mercato/core'
|
|
67
|
+
if (isMonorepo) {
|
|
68
|
+
const workspaceMatch = packageName.match(/^@open-mercato\/(.+)$/)
|
|
69
|
+
if (workspaceMatch) {
|
|
70
|
+
const workspaceRoot = path.join(rootDir, 'packages', workspaceMatch[1])
|
|
71
|
+
if (fs.existsSync(workspaceRoot)) return workspaceRoot
|
|
72
|
+
}
|
|
86
73
|
}
|
|
87
|
-
return path.
|
|
74
|
+
return resolveInstalledPackageRootWithRequire(packageName, appDir) ?? path.join(rootDir, 'node_modules', packageName)
|
|
88
75
|
}
|
|
89
76
|
|
|
90
77
|
function parseModuleEntryFromObjectLiteral(node: ts.ObjectLiteralExpression): ModuleEntry | null {
|
|
91
78
|
let id: string | null = null
|
|
92
79
|
let from: string | null = null
|
|
80
|
+
let locator: string | undefined
|
|
81
|
+
let packageName: string | undefined
|
|
93
82
|
let devSupervisorRequiresFullBootstrap = false
|
|
94
83
|
for (const property of node.properties) {
|
|
95
84
|
if (!ts.isPropertyAssignment(property)) continue
|
|
@@ -102,6 +91,12 @@ function parseModuleEntryFromObjectLiteral(node: ts.ObjectLiteralExpression): Mo
|
|
|
102
91
|
if (key === 'from' && ts.isStringLiteralLike(property.initializer)) {
|
|
103
92
|
from = property.initializer.text
|
|
104
93
|
}
|
|
94
|
+
if (key === 'packageName' && ts.isStringLiteralLike(property.initializer)) {
|
|
95
|
+
packageName = property.initializer.text
|
|
96
|
+
}
|
|
97
|
+
if (key === 'locator' && ts.isStringLiteralLike(property.initializer)) {
|
|
98
|
+
locator = property.initializer.text
|
|
99
|
+
}
|
|
105
100
|
if (key === 'overrides') {
|
|
106
101
|
if (!ts.isObjectLiteralExpression(property.initializer)) {
|
|
107
102
|
devSupervisorRequiresFullBootstrap = true
|
|
@@ -127,6 +122,8 @@ function parseModuleEntryFromObjectLiteral(node: ts.ObjectLiteralExpression): Mo
|
|
|
127
122
|
return {
|
|
128
123
|
id,
|
|
129
124
|
from: from ?? '@open-mercato/core',
|
|
125
|
+
...(locator ? { locator } : {}),
|
|
126
|
+
...(packageName ? { packageName } : {}),
|
|
130
127
|
...(devSupervisorRequiresFullBootstrap ? { devSupervisorRequiresFullBootstrap: true } : {}),
|
|
131
128
|
}
|
|
132
129
|
}
|
|
@@ -365,8 +362,7 @@ function loadEnabledModulesFromConfig(appDir: string): ModuleEntry[] {
|
|
|
365
362
|
const cfgPath = path.resolve(appDir, 'src/modules.ts')
|
|
366
363
|
if (fs.existsSync(cfgPath)) {
|
|
367
364
|
try {
|
|
368
|
-
|
|
369
|
-
if (loadedModules.length > 0) return loadedModules
|
|
365
|
+
return readEnabledModulesFromConfig(cfgPath)
|
|
370
366
|
} catch (error) {
|
|
371
367
|
console.warn(
|
|
372
368
|
'[resolver] Failed to read enabled modules from src/modules.ts, falling back to src/modules scan:',
|
|
@@ -582,7 +578,7 @@ export function createResolver(cwd: string = process.cwd()): PackageResolver {
|
|
|
582
578
|
|
|
583
579
|
getModulePaths: (entry: ModuleEntry) => {
|
|
584
580
|
const appBase = path.resolve(appDir, 'src/modules', entry.id)
|
|
585
|
-
const pkgModulesRoot = pkgDirFor(rootDir, entry.from, _isMonorepo)
|
|
581
|
+
const pkgModulesRoot = pkgDirFor(rootDir, entry.from, _isMonorepo, appDir)
|
|
586
582
|
const pkgBase = path.join(pkgModulesRoot, entry.id)
|
|
587
583
|
return { appBase, pkgBase }
|
|
588
584
|
},
|
|
@@ -601,12 +597,12 @@ export function createResolver(cwd: string = process.cwd()): PackageResolver {
|
|
|
601
597
|
// App output goes to .mercato/generated
|
|
602
598
|
return path.join(appDir, '.mercato', 'generated')
|
|
603
599
|
}
|
|
604
|
-
const pkgRoot = pkgRootFor(rootDir, packageName, _isMonorepo)
|
|
600
|
+
const pkgRoot = pkgRootFor(rootDir, packageName, _isMonorepo, appDir)
|
|
605
601
|
return path.join(pkgRoot, 'generated')
|
|
606
602
|
},
|
|
607
603
|
|
|
608
604
|
getPackageRoot: (from?: string) => {
|
|
609
|
-
return pkgRootFor(rootDir, from, _isMonorepo)
|
|
605
|
+
return pkgRootFor(rootDir, from, _isMonorepo, appDir)
|
|
610
606
|
},
|
|
611
607
|
}
|
|
612
608
|
}
|
|
@@ -624,6 +620,6 @@ export function resolveEnvironment(cwd: string = process.cwd()): CliEnvironment
|
|
|
624
620
|
mode: _isMonorepo ? 'monorepo' : 'standalone',
|
|
625
621
|
rootDir,
|
|
626
622
|
appDir,
|
|
627
|
-
packageRoot: (packageName: string) => pkgRootFor(rootDir, packageName, _isMonorepo),
|
|
623
|
+
packageRoot: (packageName: string) => pkgRootFor(rootDir, packageName, _isMonorepo, appDir),
|
|
628
624
|
}
|
|
629
625
|
}
|
package/src/mercato.ts
CHANGED
|
@@ -9,7 +9,8 @@ export { getCliModules, hasCliModules, registerCliModules }
|
|
|
9
9
|
import { parseBooleanToken } from '@open-mercato/shared/lib/boolean'
|
|
10
10
|
import { getSslConfig } from '@open-mercato/shared/lib/db/ssl'
|
|
11
11
|
import { getRedisUrl, getRedisUrlOrThrow, parseRedisUrl } from '@open-mercato/shared/lib/redis/connection'
|
|
12
|
-
import {
|
|
12
|
+
import { formatInitSummary } from './lib/init-summary'
|
|
13
|
+
import { resolveInitDerivedSecrets, resolveInitSuperadminCredentials } from './lib/init-secrets'
|
|
13
14
|
import { decideExistingDatabase, formatSkipIfInitializedMessage } from './lib/init-existing-database'
|
|
14
15
|
import {
|
|
15
16
|
resolveAutoSpawnWorkersMode,
|
|
@@ -1031,6 +1032,7 @@ export async function run(argv = process.argv) {
|
|
|
1031
1032
|
delete process.env.OM_INIT_REINSTALL
|
|
1032
1033
|
}
|
|
1033
1034
|
const skipIfInitialized = initArgs.includes('--skip-if-initialized')
|
|
1035
|
+
const credentials = skipIfInitialized && !reinstall ? undefined : resolveInitSuperadminCredentials(initArgs)
|
|
1034
1036
|
const skipExamples = initArgs.includes('--no-examples')
|
|
1035
1037
|
const skipDemoUsers = initArgs.includes('--no-demo-users')
|
|
1036
1038
|
const stressTestEnabled =
|
|
@@ -1208,6 +1210,8 @@ export async function run(argv = process.argv) {
|
|
|
1208
1210
|
}
|
|
1209
1211
|
}
|
|
1210
1212
|
|
|
1213
|
+
const { email, password, skipPasswordPolicy } = credentials ?? resolveInitSuperadminCredentials(initArgs)
|
|
1214
|
+
|
|
1211
1215
|
// Step 1: Run generators directly (no process spawn)
|
|
1212
1216
|
console.log('🔧 Preparing modules (registry, entities, DI)...')
|
|
1213
1217
|
const { createResolver } = await import('./lib/resolver')
|
|
@@ -1256,16 +1260,7 @@ export async function run(argv = process.argv) {
|
|
|
1256
1260
|
}
|
|
1257
1261
|
return fallback
|
|
1258
1262
|
}
|
|
1259
|
-
const readEnvDefault = (key: string) => {
|
|
1260
|
-
const value = process.env[key]
|
|
1261
|
-
if (typeof value === 'string' && value.trim().length > 0) return value.trim()
|
|
1262
|
-
return undefined
|
|
1263
|
-
}
|
|
1264
|
-
const defaultEmail = readEnvDefault('OM_INIT_SUPERADMIN_EMAIL') ?? 'superadmin@acme.com'
|
|
1265
|
-
const defaultPassword = readEnvDefault('OM_INIT_SUPERADMIN_PASSWORD') ?? 'secret'
|
|
1266
1263
|
const orgName = findArgValue(['--org=', '--orgName='], 'Acme Corp')
|
|
1267
|
-
const email = findArgValue(['--email='], defaultEmail)
|
|
1268
|
-
const password = findArgValue(['--password='], defaultPassword)
|
|
1269
1264
|
const derivedSecrets = resolveInitDerivedSecrets({ email, env: process.env })
|
|
1270
1265
|
const adminEmailDerived = derivedSecrets.adminEmail
|
|
1271
1266
|
const employeeEmailDerived = derivedSecrets.employeeEmail
|
|
@@ -1299,16 +1294,6 @@ export async function run(argv = process.argv) {
|
|
|
1299
1294
|
process.env.OM_INIT_EMPLOYEE_EMAIL = employeeEmailDerived
|
|
1300
1295
|
}
|
|
1301
1296
|
const roles = findArgValue(['--roles='], 'superadmin,admin,employee')
|
|
1302
|
-
const skipPasswordPolicyRaw = initArgs.find((arg) =>
|
|
1303
|
-
arg === '--skip-password-policy' ||
|
|
1304
|
-
arg.startsWith('--skip-password-policy=') ||
|
|
1305
|
-
arg === '--allow-weak-password' ||
|
|
1306
|
-
arg.startsWith('--allow-weak-password=')
|
|
1307
|
-
)
|
|
1308
|
-
const skipPasswordPolicy = skipPasswordPolicyRaw
|
|
1309
|
-
? parseBooleanToken(skipPasswordPolicyRaw.split('=')[1] ?? 'true') ?? true
|
|
1310
|
-
: true
|
|
1311
|
-
|
|
1312
1297
|
console.log('🔐 Setting up RBAC and users...')
|
|
1313
1298
|
// Run auth setup command via CLI
|
|
1314
1299
|
const setupArgs = [
|
|
@@ -1482,29 +1467,18 @@ export async function run(argv = process.argv) {
|
|
|
1482
1467
|
pushUser('Admin', '🧰', adminEmailDerived, adminPasswordOverride ?? password)
|
|
1483
1468
|
pushUser('Employee', '👷', employeeEmailDerived, employeePasswordOverride ?? password)
|
|
1484
1469
|
}
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
}
|
|
1496
|
-
console.log(
|
|
1497
|
-
console.log('║ Users created: ║')
|
|
1498
|
-
for (const entry of createdUsers) {
|
|
1499
|
-
const label = `${entry.icon} ${entry.label}:`
|
|
1500
|
-
const labelPad = padByCodePointWidth(label, 13)
|
|
1501
|
-
const entryPassword = createdPasswords.get(entry.email.toLowerCase()) ?? password
|
|
1502
|
-
console.log(`║ ${labelPad}${entry.email.padEnd(42)} ║`)
|
|
1503
|
-
console.log(`║ Password: ${entryPassword.padEnd(44)} ║`)
|
|
1504
|
-
}
|
|
1505
|
-
console.log('║ ║')
|
|
1506
|
-
console.log('║ Happy coding! ║')
|
|
1507
|
-
console.log('╚══════════════════════════════════════════════════════════════╝')
|
|
1470
|
+
const summaryColor = parseBooleanToken(process.env.OM_INIT_SUMMARY_COLOR)
|
|
1471
|
+
const summaryColumns = Number(process.env.OM_INIT_SUMMARY_COLUMNS ?? process.stdout.columns)
|
|
1472
|
+
const summary = formatInitSummary({
|
|
1473
|
+
users: createdUsers.map((entry) => ({
|
|
1474
|
+
...entry,
|
|
1475
|
+
password: createdPasswords.get(entry.email.toLowerCase()) ?? password,
|
|
1476
|
+
})),
|
|
1477
|
+
autoStart: parseBooleanToken(process.env.OM_INIT_DEV_AUTOSTART) === true,
|
|
1478
|
+
columns: summaryColumns,
|
|
1479
|
+
color: process.env.NO_COLOR === undefined && (summaryColor ?? (Boolean(process.stdout.isTTY) || parseBooleanToken(process.env.FORCE_COLOR) === true)),
|
|
1480
|
+
})
|
|
1481
|
+
for (const line of summary) console.log(line)
|
|
1508
1482
|
|
|
1509
1483
|
return 0
|
|
1510
1484
|
} catch (error: unknown) {
|
|
@@ -2333,7 +2307,7 @@ export async function run(argv = process.argv) {
|
|
|
2333
2307
|
)
|
|
2334
2308
|
const nextProcess = spawn('node', nextDevCommand.args, {
|
|
2335
2309
|
stdio: ['inherit', 'pipe', 'pipe'],
|
|
2336
|
-
env: runtimeEnv,
|
|
2310
|
+
env: { ...runtimeEnv, NODE_ENV: 'development' },
|
|
2337
2311
|
cwd: appDir,
|
|
2338
2312
|
})
|
|
2339
2313
|
processes.push(nextProcess)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
declare module 'cross-spawn' {
|
|
2
|
-
import type { spawn as spawnFunction } from 'node:child_process'
|
|
2
|
+
import type { spawn as spawnFunction, spawnSync } from 'node:child_process'
|
|
3
3
|
|
|
4
|
-
const spawn: typeof spawnFunction
|
|
4
|
+
const spawn: typeof spawnFunction & { sync: typeof spawnSync }
|
|
5
5
|
|
|
6
6
|
export default spawn
|
|
7
7
|
}
|