@holo-js/cli 0.1.3 → 0.1.5
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/dist/bin/holo.mjs +192 -35
- package/dist/{broadcast-YZS4OFCM.mjs → broadcast-RT5KVZWP.mjs} +5 -5
- package/dist/{cache-V43YMG4K.mjs → cache-NHCCHT44.mjs} +5 -5
- package/dist/{cache-migrations-ZUOI2A7N.mjs → cache-migrations-R2RL2RVD.mjs} +15 -16
- package/dist/{chunk-EUIVXVJL.mjs → chunk-57SJ566R.mjs} +1 -1
- package/dist/chunk-5BLEC66P.mjs +284 -0
- package/dist/{chunk-JX2ZH6XY.mjs → chunk-5EU32E7X.mjs} +3 -3
- package/dist/{chunk-Q5F6C2D4.mjs → chunk-BAFQ2GOA.mjs} +1 -1
- package/dist/{chunk-CUL4RJTG.mjs → chunk-F4MT6GBK.mjs} +1 -1
- package/dist/{chunk-3OTCSFDG.mjs → chunk-MXKNQACM.mjs} +544 -82
- package/dist/{chunk-QYLSMF7V.mjs → chunk-OZUDZEAW.mjs} +142 -28
- package/dist/{chunk-66FHW725.mjs → chunk-R6BWRY3E.mjs} +28 -2
- package/dist/{chunk-RB65DLR4.mjs → chunk-SCCPDJGO.mjs} +156 -16
- package/dist/{chunk-VT5IDQG6.mjs → chunk-UZTDQKIY.mjs} +61 -44
- package/dist/{chunk-HE6FYNVN.mjs → chunk-VCEO6N5T.mjs} +3563 -2505
- package/dist/{config-LS5USBRB.mjs → config-5JSC6KJG.mjs} +3 -3
- package/dist/{dev-KGRIGLJY.mjs → dev-OSLYSBTL.mjs} +7 -7
- package/dist/{discovery-GBLAUTXS.mjs → discovery-JLT2EOGH.mjs} +3 -3
- package/dist/{generators-WSF23UKM.mjs → generators-ZIWACCBE.mjs} +134 -16
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +189 -32
- package/dist/media-migrations-UBAL2YVV.mjs +117 -0
- package/dist/{queue-6N7HQMRL.mjs → queue-I66EISVS.mjs} +14 -14
- package/dist/{queue-migrations-O6QSSDPQ.mjs → queue-migrations-UIAMAB6E.mjs} +24 -20
- package/dist/{runtime-RI4OWTIT.mjs → runtime-MMQGO4PP.mjs} +9 -7
- package/dist/{runtime-OOSJ5JBY.mjs → runtime-ZKD6URAV.mjs} +1 -1
- package/dist/{scaffold-IYWZKT3W.mjs → scaffold-ISDVICNQ.mjs} +18 -4
- package/dist/{security-AE6LGNC4.mjs → security-OZXTMYXF.mjs} +10 -7
- package/package.json +13 -12
- package/dist/broadcast-ZYFKUFM5.mjs +0 -85
- package/dist/cache-ODBZT6IP.mjs +0 -67
- package/dist/cache-migrations-KPOEH6GP.mjs +0 -155
- package/dist/chunk-BWW5TDFI.mjs +0 -4
- package/dist/chunk-D4GG556Y.mjs +0 -23
- package/dist/chunk-ET7UXHHQ.mjs +0 -166
- package/dist/chunk-G5ADO27Q.mjs +0 -463
- package/dist/chunk-GSQ3HTRO.mjs +0 -165
- package/dist/chunk-H7TJ4FB3.mjs +0 -848
- package/dist/chunk-ICJR7TS4.mjs +0 -66
- package/dist/chunk-ICKN56JY.mjs +0 -342
- package/dist/chunk-M7J3YTHR.mjs +0 -26
- package/dist/chunk-S7P7EBM3.mjs +0 -787
- package/dist/chunk-SRWJU3A5.mjs +0 -11
- package/dist/chunk-T4OVZZEE.mjs +0 -3204
- package/dist/chunk-URK7C3VQ.mjs +0 -538
- package/dist/chunk-XUYKPU5Q.mjs +0 -272
- package/dist/config-DMWBMMGD.mjs +0 -26
- package/dist/dev-LVHDCPVS.mjs +0 -43
- package/dist/discovery-R733D2PO.mjs +0 -29
- package/dist/generators-32R45P6Z.mjs +0 -426
- package/dist/queue-QG5EXOG4.mjs +0 -626
- package/dist/queue-migrations-JWKU45Y3.mjs +0 -163
- package/dist/runtime-ANBO7VQM.mjs +0 -33
- package/dist/runtime-ZRPK5DIT.mjs +0 -56
- package/dist/scaffold-ULATB4CA.mjs +0 -121
- package/dist/security-OCOPEH2V.mjs +0 -69
package/dist/chunk-GSQ3HTRO.mjs
DELETED
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
loadGeneratedProjectRegistry
|
|
3
|
-
} from "./chunk-H7TJ4FB3.mjs";
|
|
4
|
-
import {
|
|
5
|
-
APP_CONFIG_FILE_NAMES,
|
|
6
|
-
DATABASE_CONFIG_FILE_NAMES,
|
|
7
|
-
isModulePackage,
|
|
8
|
-
pathExists,
|
|
9
|
-
resolveFirstExistingPath
|
|
10
|
-
} from "./chunk-G5ADO27Q.mjs";
|
|
11
|
-
|
|
12
|
-
// src/project/config.ts
|
|
13
|
-
import { mkdir, writeFile } from "fs/promises";
|
|
14
|
-
import { dirname, extname, join, resolve } from "path";
|
|
15
|
-
import {
|
|
16
|
-
loadConfigDirectory,
|
|
17
|
-
holoAppDefaults,
|
|
18
|
-
holoDatabaseDefaults
|
|
19
|
-
} from "@holo-js/config";
|
|
20
|
-
import {
|
|
21
|
-
DEFAULT_HOLO_PROJECT_PATHS,
|
|
22
|
-
normalizeHoloProjectConfig,
|
|
23
|
-
renderGeneratedSchemaPlaceholder
|
|
24
|
-
} from "@holo-js/db";
|
|
25
|
-
async function loadProjectConfig(projectRoot, options = {}) {
|
|
26
|
-
const appConfigPath = await resolveFirstExistingPath(projectRoot, APP_CONFIG_FILE_NAMES);
|
|
27
|
-
if (!appConfigPath) {
|
|
28
|
-
if (options.required) {
|
|
29
|
-
throw new Error(`Missing config/app.(ts|mts|js|mjs) in ${projectRoot}. Run a generator command first to create it.`);
|
|
30
|
-
}
|
|
31
|
-
return {
|
|
32
|
-
config: normalizeHoloProjectConfig()
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
const loaded = await loadConfigDirectory(projectRoot, {
|
|
36
|
-
processEnv: process.env
|
|
37
|
-
});
|
|
38
|
-
const baseConfig = normalizeHoloProjectConfig({
|
|
39
|
-
paths: loaded.app.paths,
|
|
40
|
-
database: loaded.database
|
|
41
|
-
});
|
|
42
|
-
const registry = await loadGeneratedProjectRegistry(projectRoot);
|
|
43
|
-
return {
|
|
44
|
-
manifestPath: appConfigPath,
|
|
45
|
-
config: registry ? normalizeHoloProjectConfig({
|
|
46
|
-
paths: baseConfig.paths,
|
|
47
|
-
models: registry.models.map((entry) => entry.sourcePath),
|
|
48
|
-
migrations: registry.migrations.map((entry) => entry.sourcePath),
|
|
49
|
-
seeders: registry.seeders.map((entry) => entry.sourcePath),
|
|
50
|
-
database: loaded.database
|
|
51
|
-
}) : baseConfig
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
async function serializeProjectConfig(projectRoot, config, manifestPath) {
|
|
55
|
-
const loaded = await loadConfigDirectory(projectRoot, {
|
|
56
|
-
processEnv: process.env
|
|
57
|
-
}).catch(() => void 0);
|
|
58
|
-
const appConfig = loaded?.app ?? holoAppDefaults;
|
|
59
|
-
const contents = JSON.stringify({
|
|
60
|
-
name: appConfig.name,
|
|
61
|
-
key: appConfig.key,
|
|
62
|
-
url: appConfig.url,
|
|
63
|
-
debug: appConfig.debug,
|
|
64
|
-
env: appConfig.env,
|
|
65
|
-
paths: config.paths
|
|
66
|
-
}, null, 2);
|
|
67
|
-
const extension = extname(manifestPath);
|
|
68
|
-
const isCommonJs = extension === ".js" && !await isModulePackage(projectRoot);
|
|
69
|
-
if (isCommonJs) {
|
|
70
|
-
return [
|
|
71
|
-
"const { defineAppConfig } = require('@holo-js/config')",
|
|
72
|
-
"",
|
|
73
|
-
"module.exports = defineAppConfig(",
|
|
74
|
-
contents,
|
|
75
|
-
")",
|
|
76
|
-
""
|
|
77
|
-
].join("\n");
|
|
78
|
-
}
|
|
79
|
-
return [
|
|
80
|
-
"import { defineAppConfig } from '@holo-js/config'",
|
|
81
|
-
"",
|
|
82
|
-
"export default defineAppConfig(",
|
|
83
|
-
contents,
|
|
84
|
-
")",
|
|
85
|
-
""
|
|
86
|
-
].join("\n");
|
|
87
|
-
}
|
|
88
|
-
async function serializeDatabaseConfig(projectRoot, _targetPath) {
|
|
89
|
-
const loaded = await loadConfigDirectory(projectRoot, {
|
|
90
|
-
processEnv: process.env
|
|
91
|
-
}).catch(() => void 0);
|
|
92
|
-
const databaseConfig = loaded?.database ?? holoDatabaseDefaults;
|
|
93
|
-
const contents = JSON.stringify({
|
|
94
|
-
defaultConnection: databaseConfig.defaultConnection,
|
|
95
|
-
connections: databaseConfig.connections
|
|
96
|
-
}, null, 2);
|
|
97
|
-
return [
|
|
98
|
-
"import { defineDatabaseConfig } from '@holo-js/config'",
|
|
99
|
-
"",
|
|
100
|
-
"export default defineDatabaseConfig(",
|
|
101
|
-
contents,
|
|
102
|
-
")",
|
|
103
|
-
""
|
|
104
|
-
].join("\n");
|
|
105
|
-
}
|
|
106
|
-
async function writeProjectConfig(projectRoot, config, manifestPath) {
|
|
107
|
-
const targetPath = manifestPath ?? join(projectRoot, "config/app.ts");
|
|
108
|
-
await mkdir(dirname(targetPath), { recursive: true });
|
|
109
|
-
await writeFile(targetPath, await serializeProjectConfig(projectRoot, config, targetPath), "utf8");
|
|
110
|
-
return targetPath;
|
|
111
|
-
}
|
|
112
|
-
function resolveGeneratedSchemaPath(projectRoot, config) {
|
|
113
|
-
return resolve(projectRoot, config.paths.generatedSchema);
|
|
114
|
-
}
|
|
115
|
-
async function ensureGeneratedSchemaPlaceholder(projectRoot, config) {
|
|
116
|
-
const filePath = resolveGeneratedSchemaPath(projectRoot, config);
|
|
117
|
-
if (await pathExists(filePath)) {
|
|
118
|
-
return filePath;
|
|
119
|
-
}
|
|
120
|
-
await mkdir(dirname(filePath), { recursive: true });
|
|
121
|
-
await writeFile(filePath, renderGeneratedSchemaPlaceholder(), "utf8");
|
|
122
|
-
return filePath;
|
|
123
|
-
}
|
|
124
|
-
async function ensureProjectConfig(projectRoot) {
|
|
125
|
-
const loaded = await loadProjectConfig(projectRoot);
|
|
126
|
-
if (loaded.manifestPath) {
|
|
127
|
-
await ensureDatabaseConfig(projectRoot);
|
|
128
|
-
return loaded;
|
|
129
|
-
}
|
|
130
|
-
const manifestPath = await writeProjectConfig(projectRoot, normalizeHoloProjectConfig());
|
|
131
|
-
await ensureDatabaseConfig(projectRoot);
|
|
132
|
-
return {
|
|
133
|
-
manifestPath,
|
|
134
|
-
config: normalizeHoloProjectConfig()
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
async function ensureDatabaseConfig(projectRoot) {
|
|
138
|
-
const existingPath = await resolveFirstExistingPath(projectRoot, DATABASE_CONFIG_FILE_NAMES);
|
|
139
|
-
if (existingPath) {
|
|
140
|
-
return existingPath;
|
|
141
|
-
}
|
|
142
|
-
const targetPath = join(projectRoot, "config/database.ts");
|
|
143
|
-
await mkdir(dirname(targetPath), { recursive: true });
|
|
144
|
-
await writeFile(targetPath, await serializeDatabaseConfig(projectRoot, targetPath), "utf8");
|
|
145
|
-
return targetPath;
|
|
146
|
-
}
|
|
147
|
-
function defaultProjectConfig() {
|
|
148
|
-
return normalizeHoloProjectConfig({
|
|
149
|
-
paths: DEFAULT_HOLO_PROJECT_PATHS,
|
|
150
|
-
models: [],
|
|
151
|
-
migrations: [],
|
|
152
|
-
seeders: []
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
export {
|
|
157
|
-
loadProjectConfig,
|
|
158
|
-
serializeProjectConfig,
|
|
159
|
-
serializeDatabaseConfig,
|
|
160
|
-
writeProjectConfig,
|
|
161
|
-
resolveGeneratedSchemaPath,
|
|
162
|
-
ensureGeneratedSchemaPlaceholder,
|
|
163
|
-
ensureProjectConfig,
|
|
164
|
-
defaultProjectConfig
|
|
165
|
-
};
|