everything-dev 1.28.11 → 1.28.12
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/cli/init.cjs +134 -88
- package/dist/cli/init.cjs.map +1 -1
- package/dist/cli/init.d.cts +12 -2
- package/dist/cli/init.d.cts.map +1 -1
- package/dist/cli/init.d.mts +12 -2
- package/dist/cli/init.d.mts.map +1 -1
- package/dist/cli/init.mjs +134 -89
- package/dist/cli/init.mjs.map +1 -1
- package/dist/cli/sync.cjs +24 -26
- package/dist/cli/sync.cjs.map +1 -1
- package/dist/cli/sync.mjs +26 -28
- package/dist/cli/sync.mjs.map +1 -1
- package/dist/cli/upgrade.cjs +16 -21
- package/dist/cli/upgrade.cjs.map +1 -1
- package/dist/cli/upgrade.mjs +17 -22
- package/dist/cli/upgrade.mjs.map +1 -1
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.mjs.map +1 -1
- package/dist/config.cjs +20 -5
- package/dist/config.cjs.map +1 -1
- package/dist/config.d.cts +13 -3
- package/dist/config.d.cts.map +1 -1
- package/dist/config.d.mts +13 -3
- package/dist/config.d.mts.map +1 -1
- package/dist/config.mjs +19 -5
- package/dist/config.mjs.map +1 -1
- package/dist/contract.cjs +6 -5
- package/dist/contract.cjs.map +1 -1
- package/dist/contract.d.cts +17 -13
- package/dist/contract.d.cts.map +1 -1
- package/dist/contract.d.mts +16 -12
- package/dist/contract.d.mts.map +1 -1
- package/dist/contract.meta.cjs +2 -3
- package/dist/contract.meta.cjs.map +1 -1
- package/dist/contract.meta.d.cts +5 -6
- package/dist/contract.meta.d.mts +5 -6
- package/dist/contract.meta.mjs +2 -3
- package/dist/contract.meta.mjs.map +1 -1
- package/dist/contract.mjs +7 -7
- package/dist/contract.mjs.map +1 -1
- package/dist/index.cjs +3 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +3 -3
- package/dist/plugin.cjs +17 -12
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.d.cts +9 -8
- package/dist/plugin.d.cts.map +1 -1
- package/dist/plugin.d.mts +9 -8
- package/dist/plugin.d.mts.map +1 -1
- package/dist/plugin.mjs +18 -13
- package/dist/plugin.mjs.map +1 -1
- package/dist/types.d.cts +2 -2
- package/dist/types.d.mts +2 -2
- package/package.json +1 -1
package/dist/cli/init.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.cts","names":[],"sources":["../../src/cli/init.ts"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"init.d.cts","names":[],"sources":["../../src/cli/init.ts"],"mappings":";;;;cA8Ba,kBAAA;AAAA,UA0BH,YAAA;EACR,SAAA;EACA,YAAA,EAAc,SAAA;EACd,OAAA,QAAe,OAAA;AAAA;AAAA,UAGA,kBAAA;EACf,OAAA,EAAS,MAAA;EACT,UAAA;EACA,YAAA;AAAA;AAAA,iBA+BoB,yBAAA,CAA0B,IAAA;EAC9C,cAAA;EACA,cAAA;EACA,SAAA;AAAA,IACE,OAAA,CAAQ,kBAAA;AAAA,iBAqFU,gBAAA,CAAiB,IAAA;EACrC,cAAA;EACA,cAAA;EACA,MAAA;AAAA,IACE,OAAA,CAAQ,YAAA;AAAA,iBAmCI,iBAAA,CAAkB,SAAA,EAAW,eAAA,IAAmB,OAAA;AAAA,iBAgBhD,2BAAA,CAA4B,QAAA;AAAA,iBAMtB,iBAAA,CACpB,cAAA,UACA,cAAA,WACC,OAAA,CAAQ,SAAA;AAAA,iBAKW,gCAAA,CACpB,cAAA,UACA,cAAA,UACA,OAAA,GAAO,GAAA,WACN,OAAA;EAAU,UAAA;EAAoB,MAAA,EAAQ,SAAA;AAAA;AAAA,iBA+BnB,kBAAA,CAAmB,SAAA,WAAoB,OAAA;AAAA,iBA0BvC,eAAA,CACpB,OAAA,WACC,OAAA;EAAU,GAAA;EAAa,OAAA,QAAe,OAAA;AAAA;AAAA,iBA6EnB,iBAAA,CACpB,SAAA,UACA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AsB,OAAA;AAAA,iBA8BjD,WAAA,CACpB,OAAA,UACA,IAAA,YACA,GAAA,WACA,OAAA;EAAY,KAAA;AAAA,IACX,OAAA"}
|
package/dist/cli/init.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { OverrideSection } from "../contract.mjs";
|
|
2
1
|
import { BosConfig, BosConfigInput } from "../types.mjs";
|
|
2
|
+
import { OverrideSection } from "../contract.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/cli/init.d.ts
|
|
5
5
|
declare const INIT_ROOT_PATTERNS: readonly ["bos.config.json", "package.json", ".env.example", ".gitignore", "biome.json", "bunfig.toml", "Dockerfile", "railway.json", ".agent/**", "AGENTS.md", ".opencode/skills/everything-dev/**", ".changeset/config.json", ".changeset/README.md", "README.md", "CONTRIBUTING.md", ".github/templates/**"];
|
|
@@ -8,6 +8,16 @@ interface SourceResult {
|
|
|
8
8
|
parentConfig: BosConfig;
|
|
9
9
|
cleanup: () => Promise<void>;
|
|
10
10
|
}
|
|
11
|
+
interface CatalogChainSource {
|
|
12
|
+
catalog: Record<string, string>;
|
|
13
|
+
repository?: string;
|
|
14
|
+
extendsChain: string[];
|
|
15
|
+
}
|
|
16
|
+
declare function resolveCatalogChainSource(opts: {
|
|
17
|
+
extendsAccount: string;
|
|
18
|
+
extendsGateway: string;
|
|
19
|
+
sourceDir?: string;
|
|
20
|
+
}): Promise<CatalogChainSource>;
|
|
11
21
|
declare function resolveSourceDir(opts: {
|
|
12
22
|
extendsAccount: string;
|
|
13
23
|
extendsGateway: string;
|
|
@@ -87,5 +97,5 @@ declare function execCommand(command: string, args: string[], cwd?: string, opti
|
|
|
87
97
|
stdio?: "pipe" | "inherit";
|
|
88
98
|
}): Promise<void>;
|
|
89
99
|
//#endregion
|
|
90
|
-
export { INIT_ROOT_PATTERNS, buildChildRootScripts, buildInitPatterns, copyFilteredFiles, detectGitRemoteUrl, downloadTarball, execCommand, fetchParentConfig, generateDatabaseMigrations, personalizeConfig, removeInitLockfile, resolveRepositoryViaExtendsChain, resolveSourceDir, runBunInstall, runBunInstallForUpgrade, runDockerComposeUp, runTypesGen, scaffoldMinimalProject, sourcePathToDestinationPath, stripOrphanedWorkspacesFromLockfile, writeInitSnapshot };
|
|
100
|
+
export { CatalogChainSource, INIT_ROOT_PATTERNS, buildChildRootScripts, buildInitPatterns, copyFilteredFiles, detectGitRemoteUrl, downloadTarball, execCommand, fetchParentConfig, generateDatabaseMigrations, personalizeConfig, removeInitLockfile, resolveCatalogChainSource, resolveRepositoryViaExtendsChain, resolveSourceDir, runBunInstall, runBunInstallForUpgrade, runDockerComposeUp, runTypesGen, scaffoldMinimalProject, sourcePathToDestinationPath, stripOrphanedWorkspacesFromLockfile, writeInitSnapshot };
|
|
91
101
|
//# sourceMappingURL=init.d.mts.map
|
package/dist/cli/init.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.mts","names":[],"sources":["../../src/cli/init.ts"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"init.d.mts","names":[],"sources":["../../src/cli/init.ts"],"mappings":";;;;cA8Ba,kBAAA;AAAA,UA0BH,YAAA;EACR,SAAA;EACA,YAAA,EAAc,SAAA;EACd,OAAA,QAAe,OAAA;AAAA;AAAA,UAGA,kBAAA;EACf,OAAA,EAAS,MAAA;EACT,UAAA;EACA,YAAA;AAAA;AAAA,iBA+BoB,yBAAA,CAA0B,IAAA;EAC9C,cAAA;EACA,cAAA;EACA,SAAA;AAAA,IACE,OAAA,CAAQ,kBAAA;AAAA,iBAqFU,gBAAA,CAAiB,IAAA;EACrC,cAAA;EACA,cAAA;EACA,MAAA;AAAA,IACE,OAAA,CAAQ,YAAA;AAAA,iBAmCI,iBAAA,CAAkB,SAAA,EAAW,eAAA,IAAmB,OAAA;AAAA,iBAgBhD,2BAAA,CAA4B,QAAA;AAAA,iBAMtB,iBAAA,CACpB,cAAA,UACA,cAAA,WACC,OAAA,CAAQ,SAAA;AAAA,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,cAAA;EACA,OAAA;EACA,MAAA;EACA,OAAA;EACA,SAAA,EAAW,eAAA;EACX,UAAA;EACA,KAAA;EACA,WAAA;AAAA,IAED,OAAA;AAAA,iBAgHmB,iBAAA,CACpB,WAAA,UACA,cAAA,UACA,cAAA,UACA,SAAA,UACA,QAAA,YACA,QAAA;EACE,SAAA,EAAW,eAAA;EACX,OAAA;AAAA,IAED,OAAA;AAAA,iBAuCmB,0BAAA,CAA2B,WAAA,WAAsB,OAAA;AAAA,iBA8BjD,WAAA,CACpB,OAAA,UACA,IAAA,YACA,GAAA,WACA,OAAA;EAAY,KAAA;AAAA,IACX,OAAA"}
|
package/dist/cli/init.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { fetchBosConfigFromFastKv } from "../fastkv.mjs";
|
|
2
|
+
import { resolveExtendsRef } from "../merge.mjs";
|
|
2
3
|
import { loadManifestNormalizationSpec, normalizePackageManifestsInTree } from "../internal/manifest-normalizer.mjs";
|
|
3
4
|
import { saveBosConfig } from "../utils/save-config.mjs";
|
|
4
5
|
import { writeSnapshot } from "./snapshot.mjs";
|
|
@@ -31,13 +32,87 @@ const INIT_ROOT_PATTERNS = [
|
|
|
31
32
|
"CONTRIBUTING.md",
|
|
32
33
|
".github/templates/**"
|
|
33
34
|
];
|
|
34
|
-
const FRAMEWORK_PACKAGES = ["every-plugin", "everything-dev"];
|
|
35
35
|
const OVERRIDE_WORKSPACE_MAP = {
|
|
36
36
|
ui: ["ui"],
|
|
37
37
|
api: ["api"],
|
|
38
38
|
host: ["host"],
|
|
39
39
|
plugins: []
|
|
40
40
|
};
|
|
41
|
+
function getExtendsRef(config) {
|
|
42
|
+
if (typeof config.extends === "string") return config.extends;
|
|
43
|
+
if (config.extends && typeof config.extends === "object") return resolveExtendsRef(config.extends, "production");
|
|
44
|
+
}
|
|
45
|
+
function parseBosRef(ref) {
|
|
46
|
+
const match = ref.match(/^bos:\/\/([^/]+)\/(.+)$/);
|
|
47
|
+
if (!match?.[1] || !match[2]) return null;
|
|
48
|
+
return {
|
|
49
|
+
account: match[1],
|
|
50
|
+
gateway: match[2]
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function readWorkspaceCatalog(sourceDir) {
|
|
54
|
+
const pkgPath = join(sourceDir, "package.json");
|
|
55
|
+
if (!existsSync(pkgPath)) return {};
|
|
56
|
+
return { ...readJsonFile(pkgPath).workspaces?.catalog ?? {} };
|
|
57
|
+
}
|
|
58
|
+
async function resolveCatalogChainSource(opts) {
|
|
59
|
+
const catalogs = [];
|
|
60
|
+
const cleanups = [];
|
|
61
|
+
const extendsChain = [];
|
|
62
|
+
const visited = /* @__PURE__ */ new Set();
|
|
63
|
+
let repository;
|
|
64
|
+
let currentRef = `bos://${opts.extendsAccount}/${opts.extendsGateway}`;
|
|
65
|
+
let sourceDir = opts.sourceDir ? resolve(opts.sourceDir) : void 0;
|
|
66
|
+
let configPath = sourceDir ? join(sourceDir, "bos.config.json") : void 0;
|
|
67
|
+
try {
|
|
68
|
+
while (true) {
|
|
69
|
+
if (visited.has(currentRef)) throw new Error(`Circular extends detected while resolving catalog source: ${currentRef}`);
|
|
70
|
+
visited.add(currentRef);
|
|
71
|
+
extendsChain.push(currentRef);
|
|
72
|
+
let config;
|
|
73
|
+
let currentSourceDir = sourceDir;
|
|
74
|
+
let cleanup = async () => {};
|
|
75
|
+
if (configPath) {
|
|
76
|
+
config = readJsonFile(configPath);
|
|
77
|
+
currentSourceDir = dirname(configPath);
|
|
78
|
+
} else {
|
|
79
|
+
const parsed = parseBosRef(currentRef);
|
|
80
|
+
if (!parsed) break;
|
|
81
|
+
const sourceResult = await resolveSourceDir({
|
|
82
|
+
extendsAccount: parsed.account,
|
|
83
|
+
extendsGateway: parsed.gateway
|
|
84
|
+
});
|
|
85
|
+
config = sourceResult.parentConfig;
|
|
86
|
+
currentSourceDir = sourceResult.sourceDir || void 0;
|
|
87
|
+
cleanup = sourceResult.cleanup;
|
|
88
|
+
}
|
|
89
|
+
cleanups.push(cleanup);
|
|
90
|
+
catalogs.push(currentSourceDir ? readWorkspaceCatalog(currentSourceDir) : {});
|
|
91
|
+
if (typeof config.repository === "string") repository = config.repository;
|
|
92
|
+
const nextExtendsRef = getExtendsRef(config);
|
|
93
|
+
if (!nextExtendsRef) break;
|
|
94
|
+
if (nextExtendsRef.startsWith("bos://")) {
|
|
95
|
+
currentRef = nextExtendsRef;
|
|
96
|
+
sourceDir = void 0;
|
|
97
|
+
configPath = void 0;
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
if (!currentSourceDir) break;
|
|
101
|
+
const nextConfigPath = resolve(currentSourceDir, nextExtendsRef);
|
|
102
|
+
if (!existsSync(nextConfigPath)) break;
|
|
103
|
+
currentRef = nextConfigPath;
|
|
104
|
+
sourceDir = dirname(nextConfigPath);
|
|
105
|
+
configPath = nextConfigPath;
|
|
106
|
+
}
|
|
107
|
+
} finally {
|
|
108
|
+
for (const cleanup of cleanups.reverse()) await cleanup();
|
|
109
|
+
}
|
|
110
|
+
return {
|
|
111
|
+
catalog: Object.assign({}, ...catalogs.reverse()),
|
|
112
|
+
repository,
|
|
113
|
+
extendsChain
|
|
114
|
+
};
|
|
115
|
+
}
|
|
41
116
|
async function resolveSourceDir(opts) {
|
|
42
117
|
if (opts.source) {
|
|
43
118
|
const sourceDir = resolve(opts.source);
|
|
@@ -97,11 +172,11 @@ async function resolveRepositoryViaExtendsChain(extendsAccount, extendsGateway,
|
|
|
97
172
|
repository: config.repository,
|
|
98
173
|
config
|
|
99
174
|
};
|
|
100
|
-
const extendsRef = config
|
|
101
|
-
if (extendsRef
|
|
102
|
-
const
|
|
103
|
-
if (
|
|
104
|
-
const result = await resolveRepositoryViaExtendsChain(
|
|
175
|
+
const extendsRef = getExtendsRef(config);
|
|
176
|
+
if (extendsRef) {
|
|
177
|
+
const parsed = parseBosRef(extendsRef.startsWith("bos://") ? extendsRef : `bos://${extendsRef}`);
|
|
178
|
+
if (parsed) {
|
|
179
|
+
const result = await resolveRepositoryViaExtendsChain(parsed.account, parsed.gateway, visited);
|
|
105
180
|
if (result) return result;
|
|
106
181
|
}
|
|
107
182
|
}
|
|
@@ -137,28 +212,23 @@ function normalizeGitUrl(url) {
|
|
|
137
212
|
async function downloadTarball(repoUrl) {
|
|
138
213
|
const parsed = parseGitHubUrl(repoUrl);
|
|
139
214
|
if (!parsed) throw new Error(`Cannot parse repository URL: ${repoUrl}`);
|
|
140
|
-
const { owner, repo
|
|
141
|
-
|
|
142
|
-
const
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
redirect: "follow"
|
|
147
|
-
});
|
|
148
|
-
if (!response.ok) {
|
|
149
|
-
rmSync(tmpDir, {
|
|
150
|
-
recursive: true,
|
|
151
|
-
force: true
|
|
215
|
+
const { owner, repo } = parsed;
|
|
216
|
+
let response = null;
|
|
217
|
+
for (const branch of ["main", "master"]) {
|
|
218
|
+
const candidate = await fetch(`https://api.github.com/repos/${owner}/${repo}/tarball/${branch}`, {
|
|
219
|
+
headers: { "User-Agent": "everything-dev" },
|
|
220
|
+
redirect: "follow"
|
|
152
221
|
});
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
force: true
|
|
159
|
-
});
|
|
160
|
-
throw new Error("GitHub tarball download returned empty body");
|
|
222
|
+
if (candidate.ok) {
|
|
223
|
+
response = candidate;
|
|
224
|
+
break;
|
|
225
|
+
}
|
|
226
|
+
if (candidate.status !== 404) throw new Error(`GitHub tarball download failed: ${candidate.status} ${candidate.statusText}`);
|
|
161
227
|
}
|
|
228
|
+
if (!response) throw new Error(`GitHub tarball download failed for ${repoUrl}: tried main and master`);
|
|
229
|
+
if (!response.body) throw new Error("GitHub tarball download returned empty body");
|
|
230
|
+
const tmpDir = mkTmpDir("bos-init-tarball-");
|
|
231
|
+
const tarballPath = join(tmpDir, "source.tar.gz");
|
|
162
232
|
const fileStream = createWriteStream(tarballPath);
|
|
163
233
|
const reader = response.body;
|
|
164
234
|
await pipeline(reader, fileStream);
|
|
@@ -196,14 +266,12 @@ function parseGitHubUrl(url) {
|
|
|
196
266
|
const httpsMatch = url.match(/^https?:\/\/github\.com\/([^/]+)\/([^/]+?)(?:\.git)?(?:\/.*)?$/);
|
|
197
267
|
if (httpsMatch) return {
|
|
198
268
|
owner: httpsMatch[1],
|
|
199
|
-
repo: httpsMatch[2]
|
|
200
|
-
branch: "main"
|
|
269
|
+
repo: httpsMatch[2]
|
|
201
270
|
};
|
|
202
271
|
const sshMatch = url.match(/^git@github\.com:([^/]+)\/([^/]+?)(?:\.git)?$/);
|
|
203
272
|
if (sshMatch) return {
|
|
204
273
|
owner: sshMatch[1],
|
|
205
|
-
repo: sshMatch[2]
|
|
206
|
-
branch: "main"
|
|
274
|
+
repo: sshMatch[2]
|
|
207
275
|
};
|
|
208
276
|
return null;
|
|
209
277
|
}
|
|
@@ -269,25 +337,32 @@ function buildChildRootScripts(sections) {
|
|
|
269
337
|
release: "echo 'Packages versioned - app release handled by workflow'",
|
|
270
338
|
postinstall: "node_modules/.bin/bos types gen || true",
|
|
271
339
|
"types:gen": "node_modules/.bin/bos types gen",
|
|
272
|
-
bos: "node_modules/.bin/bos"
|
|
273
|
-
"db:push": "bun run --cwd api drizzle-kit push",
|
|
274
|
-
"db:studio": "bun run --cwd api drizzle-kit studio",
|
|
275
|
-
"db:generate": "bun run --cwd api drizzle-kit generate",
|
|
276
|
-
"db:migrate": "bun run --cwd api drizzle-kit migrate",
|
|
277
|
-
test: "bun run test:api && bun run test:e2e",
|
|
278
|
-
"test:api": "cd api && bun run test tests/integration/ tests/unit/",
|
|
279
|
-
"test:integration": "cd api && bun run test tests/integration/",
|
|
280
|
-
"test:e2e": "bun run --cwd host test:e2e",
|
|
281
|
-
"dev:postgres": "docker compose up -d --wait && bun run dev",
|
|
282
|
-
"dev:postgres:down": "docker compose down",
|
|
283
|
-
"dev:postgres:reset": "docker compose down -v && docker compose up -d --wait"
|
|
340
|
+
bos: "node_modules/.bin/bos"
|
|
284
341
|
};
|
|
342
|
+
if (sections.api) {
|
|
343
|
+
scripts["db:push"] = "bun run --cwd api drizzle-kit push";
|
|
344
|
+
scripts["db:studio"] = "bun run --cwd api drizzle-kit studio";
|
|
345
|
+
scripts["db:generate"] = "bun run --cwd api drizzle-kit generate";
|
|
346
|
+
scripts["db:migrate"] = "bun run --cwd api drizzle-kit migrate";
|
|
347
|
+
scripts["test:api"] = "cd api && bun run test tests/integration/ tests/unit/";
|
|
348
|
+
scripts["test:integration"] = "cd api && bun run test tests/integration/";
|
|
349
|
+
}
|
|
350
|
+
if (sections.host) scripts["test:e2e"] = "bun run --cwd host test:e2e";
|
|
351
|
+
if (sections.api && sections.host) scripts.test = "bun run test:api && bun run test:e2e";
|
|
352
|
+
else if (sections.api) scripts.test = "bun run test:api";
|
|
353
|
+
else if (sections.host) scripts.test = "bun run test:e2e";
|
|
354
|
+
if (sections.api || sections.host) {
|
|
355
|
+
scripts["dev:postgres"] = "docker compose up -d --wait && bun run dev";
|
|
356
|
+
scripts["dev:postgres:down"] = "docker compose down";
|
|
357
|
+
scripts["dev:postgres:reset"] = "docker compose down -v && docker compose up -d --wait";
|
|
358
|
+
}
|
|
285
359
|
if (sections.ui) scripts["dev:ui"] = "node_modules/.bin/bos dev --ui local --api remote";
|
|
286
360
|
if (sections.api) scripts["dev:api"] = "node_modules/.bin/bos dev --ui remote --api local";
|
|
287
361
|
return scripts;
|
|
288
362
|
}
|
|
289
363
|
async function personalizeConfig(destination, opts) {
|
|
290
364
|
const has = (section) => opts.overrides.includes(section);
|
|
365
|
+
const preservedAuth = (opts.mode === "sync" && opts.existingConfig?.app && typeof opts.existingConfig.app === "object" ? opts.existingConfig.app : void 0)?.auth;
|
|
291
366
|
const explicitRootKeys = new Set(Object.entries(opts).filter(([key, value]) => value !== void 0 && ![
|
|
292
367
|
"extendsAccount",
|
|
293
368
|
"extendsGateway",
|
|
@@ -315,13 +390,19 @@ async function personalizeConfig(destination, opts) {
|
|
|
315
390
|
if (config.app && typeof config.app === "object") {
|
|
316
391
|
const app = config.app;
|
|
317
392
|
for (const entryKey of Object.keys(app)) {
|
|
318
|
-
if (!has(entryKey) && (entryKey === "host" || entryKey === "ui" || entryKey === "api"
|
|
393
|
+
if (!has(entryKey) && (entryKey === "host" || entryKey === "ui" || entryKey === "api")) {
|
|
394
|
+
delete app[entryKey];
|
|
395
|
+
continue;
|
|
396
|
+
}
|
|
397
|
+
if (entryKey === "auth") {
|
|
319
398
|
delete app[entryKey];
|
|
320
399
|
continue;
|
|
321
400
|
}
|
|
322
401
|
const entry = app[entryKey];
|
|
323
402
|
if (entry && typeof entry === "object") stripProductionFields(entry);
|
|
324
403
|
}
|
|
404
|
+
if (preservedAuth !== void 0) app.auth = preservedAuth;
|
|
405
|
+
if (Object.keys(app).length === 0) delete config.app;
|
|
325
406
|
}
|
|
326
407
|
if (has("plugins")) {
|
|
327
408
|
if (config.plugins && typeof config.plugins === "object") {
|
|
@@ -429,7 +510,11 @@ async function personalizeConfig(destination, opts) {
|
|
|
429
510
|
workspaces.catalog["everything-dev"] = spec.rootCatalog["everything-dev"];
|
|
430
511
|
workspaces.catalog["every-plugin"] = spec.rootCatalog["every-plugin"];
|
|
431
512
|
}
|
|
432
|
-
const frameworkCatalog =
|
|
513
|
+
const frameworkCatalog = (await resolveCatalogChainSource({
|
|
514
|
+
extendsAccount: opts.extendsAccount,
|
|
515
|
+
extendsGateway: opts.extendsGateway,
|
|
516
|
+
sourceDir: opts.workspaceOpts?.sourceDir
|
|
517
|
+
})).catalog;
|
|
433
518
|
for (const [name, version] of Object.entries(frameworkCatalog)) workspaces.catalog[name] = version;
|
|
434
519
|
if (!deps["everything-dev"]) deps["everything-dev"] = "catalog:";
|
|
435
520
|
if (!deps["every-plugin"]) deps["every-plugin"] = "catalog:";
|
|
@@ -600,45 +685,6 @@ function removeInitLockfile(lockfilePath) {
|
|
|
600
685
|
function readJsonFile(filePath) {
|
|
601
686
|
return JSON.parse(readFileSync(filePath, "utf-8"));
|
|
602
687
|
}
|
|
603
|
-
function tryResolvePackageJson(packageName) {
|
|
604
|
-
try {
|
|
605
|
-
return require.resolve(`${packageName}/package.json`);
|
|
606
|
-
} catch {
|
|
607
|
-
return null;
|
|
608
|
-
}
|
|
609
|
-
}
|
|
610
|
-
function resolveFrameworkCatalog() {
|
|
611
|
-
const catalog = {};
|
|
612
|
-
const everythingDevPackageJson = tryResolvePackageJson("everything-dev");
|
|
613
|
-
if (everythingDevPackageJson) {
|
|
614
|
-
try {
|
|
615
|
-
const monorepoPkgPath = join(dirname(everythingDevPackageJson), "..", "..", "package.json");
|
|
616
|
-
if (existsSync(monorepoPkgPath)) {
|
|
617
|
-
const sourceCatalog = readJsonFile(monorepoPkgPath).workspaces?.catalog;
|
|
618
|
-
if (sourceCatalog && typeof sourceCatalog === "object") {
|
|
619
|
-
for (const [name, version] of Object.entries(sourceCatalog)) if (typeof version === "string") catalog[name] = version;
|
|
620
|
-
}
|
|
621
|
-
}
|
|
622
|
-
} catch {}
|
|
623
|
-
try {
|
|
624
|
-
const selfPkg = readJsonFile(everythingDevPackageJson);
|
|
625
|
-
if (selfPkg.version && !catalog["everything-dev"]) catalog["everything-dev"] = `^${selfPkg.version}`;
|
|
626
|
-
const sourceCatalog = selfPkg.workspaces?.catalog;
|
|
627
|
-
if (sourceCatalog && typeof sourceCatalog === "object") {
|
|
628
|
-
for (const [name, version] of Object.entries(sourceCatalog)) if (typeof version === "string" && !catalog[name]) catalog[name] = version;
|
|
629
|
-
}
|
|
630
|
-
} catch {}
|
|
631
|
-
}
|
|
632
|
-
for (const packageName of FRAMEWORK_PACKAGES) {
|
|
633
|
-
const resolved = tryResolvePackageJson(packageName);
|
|
634
|
-
if (!resolved) continue;
|
|
635
|
-
try {
|
|
636
|
-
const pkg = readJsonFile(resolved);
|
|
637
|
-
if (pkg.version) catalog[packageName] = `^${pkg.version}`;
|
|
638
|
-
} catch {}
|
|
639
|
-
}
|
|
640
|
-
return catalog;
|
|
641
|
-
}
|
|
642
688
|
async function scaffoldMinimalProject(destination, parentConfig, opts) {
|
|
643
689
|
mkdirSync(destination, { recursive: true });
|
|
644
690
|
const has = (section) => opts.overrides.includes(section);
|
|
@@ -665,10 +711,6 @@ async function scaffoldMinimalProject(destination, parentConfig, opts) {
|
|
|
665
711
|
app.api = { ...parentApp.api };
|
|
666
712
|
stripProductionFields(app.api);
|
|
667
713
|
}
|
|
668
|
-
if (has("plugins") && parentApp.auth) {
|
|
669
|
-
app.auth = { ...parentApp.auth };
|
|
670
|
-
stripProductionFields(app.auth);
|
|
671
|
-
}
|
|
672
714
|
if (Object.keys(app).length > 0) config.app = app;
|
|
673
715
|
}
|
|
674
716
|
if (has("plugins") && opts.plugins && opts.plugins.length > 0 && parentConfig.plugins) {
|
|
@@ -688,7 +730,10 @@ async function scaffoldMinimalProject(destination, parentConfig, opts) {
|
|
|
688
730
|
const workspacePackages = [];
|
|
689
731
|
for (const section of opts.overrides) workspacePackages.push(...OVERRIDE_WORKSPACE_MAP[section]);
|
|
690
732
|
if (has("plugins")) workspacePackages.push("plugins/*");
|
|
691
|
-
const catalog =
|
|
733
|
+
const catalog = (await resolveCatalogChainSource({
|
|
734
|
+
extendsAccount: opts.extendsAccount,
|
|
735
|
+
extendsGateway: opts.extendsGateway
|
|
736
|
+
})).catalog;
|
|
692
737
|
const pkg = {
|
|
693
738
|
name: "monorepo",
|
|
694
739
|
private: true,
|
|
@@ -799,5 +844,5 @@ dist/
|
|
|
799
844
|
}
|
|
800
845
|
|
|
801
846
|
//#endregion
|
|
802
|
-
export { INIT_ROOT_PATTERNS, buildChildRootScripts, buildInitPatterns, copyFilteredFiles, detectGitRemoteUrl, downloadTarball, execCommand, fetchParentConfig, generateDatabaseMigrations, personalizeConfig, removeInitLockfile, resolveRepositoryViaExtendsChain, resolveSourceDir, runBunInstall, runBunInstallForUpgrade, runDockerComposeUp, runTypesGen, scaffoldMinimalProject, sourcePathToDestinationPath, stripOrphanedWorkspacesFromLockfile, writeInitSnapshot };
|
|
847
|
+
export { INIT_ROOT_PATTERNS, buildChildRootScripts, buildInitPatterns, copyFilteredFiles, detectGitRemoteUrl, downloadTarball, execCommand, fetchParentConfig, generateDatabaseMigrations, personalizeConfig, removeInitLockfile, resolveCatalogChainSource, resolveRepositoryViaExtendsChain, resolveSourceDir, runBunInstall, runBunInstallForUpgrade, runDockerComposeUp, runTypesGen, scaffoldMinimalProject, sourcePathToDestinationPath, stripOrphanedWorkspacesFromLockfile, writeInitSnapshot };
|
|
803
848
|
//# sourceMappingURL=init.mjs.map
|