everything-dev 1.26.1 → 1.27.0
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/api-contract.cjs.map +1 -1
- package/dist/api-contract.mjs.map +1 -1
- package/dist/cli/catalog.cjs.map +1 -1
- package/dist/cli/catalog.mjs.map +1 -1
- package/dist/cli/framework-version.cjs.map +1 -1
- package/dist/cli/framework-version.mjs.map +1 -1
- package/dist/cli/infra.cjs.map +1 -1
- package/dist/cli/infra.mjs.map +1 -1
- package/dist/cli/init.cjs +121 -113
- package/dist/cli/init.cjs.map +1 -1
- package/dist/cli/init.d.cts +6 -6
- package/dist/cli/init.d.cts.map +1 -1
- package/dist/cli/init.d.mts +6 -6
- package/dist/cli/init.d.mts.map +1 -1
- package/dist/cli/init.mjs +119 -113
- package/dist/cli/init.mjs.map +1 -1
- package/dist/cli/parse.cjs.map +1 -1
- package/dist/cli/parse.mjs.map +1 -1
- package/dist/cli/prompts.cjs +1 -1
- package/dist/cli/prompts.cjs.map +1 -1
- package/dist/cli/prompts.mjs +1 -1
- package/dist/cli/prompts.mjs.map +1 -1
- package/dist/cli/status.cjs.map +1 -1
- package/dist/cli/status.mjs.map +1 -1
- package/dist/cli/sync.cjs +42 -92
- package/dist/cli/sync.cjs.map +1 -1
- package/dist/cli/sync.mjs +45 -95
- package/dist/cli/sync.mjs.map +1 -1
- package/dist/cli/timing.cjs.map +1 -1
- package/dist/cli/timing.mjs.map +1 -1
- package/dist/cli/upgrade.cjs +41 -20
- package/dist/cli/upgrade.cjs.map +1 -1
- package/dist/cli/upgrade.mjs +43 -22
- package/dist/cli/upgrade.mjs.map +1 -1
- package/dist/cli.cjs +1 -1
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/cli.mjs.map +1 -1
- package/dist/components/dev-view.cjs.map +1 -1
- package/dist/components/dev-view.mjs.map +1 -1
- package/dist/components/streaming-view.cjs.map +1 -1
- package/dist/components/streaming-view.mjs.map +1 -1
- package/dist/config.cjs.map +1 -1
- package/dist/config.mjs.map +1 -1
- package/dist/contract.cjs +174 -173
- package/dist/contract.cjs.map +1 -1
- package/dist/contract.d.cts +10 -10
- package/dist/contract.d.cts.map +1 -1
- package/dist/contract.d.mts +10 -10
- package/dist/contract.d.mts.map +1 -1
- package/dist/contract.mjs +2 -1
- package/dist/contract.mjs.map +1 -1
- package/dist/dev-logs.cjs.map +1 -1
- package/dist/dev-logs.mjs.map +1 -1
- package/dist/fastkv.cjs.map +1 -1
- package/dist/fastkv.mjs.map +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/integrity.cjs.map +1 -1
- package/dist/integrity.mjs.map +1 -1
- package/dist/internal/manifest-normalizer.cjs.map +1 -1
- package/dist/internal/manifest-normalizer.mjs.map +1 -1
- package/dist/merge.cjs.map +1 -1
- package/dist/merge.mjs.map +1 -1
- package/dist/near-cli.cjs.map +1 -1
- package/dist/near-cli.mjs.map +1 -1
- package/dist/orchestrator.cjs.map +1 -1
- package/dist/orchestrator.mjs.map +1 -1
- package/dist/plugin.cjs +20 -33
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.d.cts +5 -5
- package/dist/plugin.d.mts +5 -5
- package/dist/plugin.mjs +18 -31
- package/dist/plugin.mjs.map +1 -1
- package/dist/sdk.cjs +2 -2
- package/dist/sdk.d.cts +1 -1
- package/dist/sdk.d.mts +1 -1
- package/dist/sdk.mjs +1 -1
- package/dist/shared.cjs.map +1 -1
- package/dist/shared.mjs.map +1 -1
- package/dist/types.cjs +184 -184
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +3 -3
- package/dist/types.d.mts +3 -3
- package/dist/types.mjs +1 -1
- package/dist/types.mjs.map +1 -1
- package/dist/ui/types.d.cts +1 -0
- package/dist/ui/types.d.cts.map +1 -1
- package/dist/ui/types.d.mts +1 -0
- package/dist/ui/types.d.mts.map +1 -1
- package/dist/utils/banner.cjs.map +1 -1
- package/dist/utils/banner.mjs.map +1 -1
- package/dist/utils/run.cjs.map +1 -1
- package/dist/utils/run.mjs.map +1 -1
- package/package.json +2 -2
- package/skills/init-upgrade/SKILL.md +22 -16
- package/skills/publish-sync/SKILL.md +7 -18
- package/src/cli/init.ts +137 -194
- package/src/cli/prompts.ts +1 -1
- package/src/cli/sync.ts +48 -137
- package/src/cli/upgrade.ts +66 -25
- package/src/contract.ts +2 -1
- package/src/plugin.ts +12 -34
- package/src/sdk.ts +1 -1
- package/src/types.ts +1 -1
- package/src/ui/types.ts +1 -0
- package/dist/utils/path-match.cjs +0 -18
- package/dist/utils/path-match.cjs.map +0 -1
- package/dist/utils/path-match.mjs +0 -17
- package/dist/utils/path-match.mjs.map +0 -1
package/src/cli/init.ts
CHANGED
|
@@ -22,15 +22,32 @@ import {
|
|
|
22
22
|
normalizePackageManifestsInTree,
|
|
23
23
|
} from "../internal/manifest-normalizer";
|
|
24
24
|
import type { BosConfig, BosConfigInput } from "../types";
|
|
25
|
-
import { isPathExcluded } from "../utils/path-match";
|
|
26
25
|
import { saveBosConfig } from "../utils/save-config";
|
|
27
26
|
import { writeSnapshot } from "./snapshot";
|
|
28
27
|
|
|
29
28
|
const require = createRequire(import.meta.url);
|
|
30
29
|
|
|
31
|
-
const
|
|
30
|
+
export const INIT_ROOT_PATTERNS = [
|
|
31
|
+
"bos.config.json",
|
|
32
|
+
"package.json",
|
|
33
|
+
".env.example",
|
|
34
|
+
".gitignore",
|
|
35
|
+
"biome.json",
|
|
36
|
+
"bunfig.toml",
|
|
37
|
+
"Dockerfile",
|
|
38
|
+
"docker-compose.yml",
|
|
39
|
+
"railway.json",
|
|
40
|
+
".agent/**",
|
|
41
|
+
"AGENTS.md",
|
|
42
|
+
".opencode/skills/everything-dev/**",
|
|
43
|
+
".changeset/config.json",
|
|
44
|
+
".changeset/README.md",
|
|
45
|
+
"README.md",
|
|
46
|
+
"CONTRIBUTING.md",
|
|
47
|
+
".github/templates/**",
|
|
48
|
+
] as const;
|
|
32
49
|
|
|
33
|
-
const
|
|
50
|
+
const FRAMEWORK_PACKAGES = ["every-plugin", "everything-dev"] as const;
|
|
34
51
|
|
|
35
52
|
const OVERRIDE_WORKSPACE_MAP: Record<OverrideSection, string[]> = {
|
|
36
53
|
ui: ["ui"],
|
|
@@ -84,25 +101,28 @@ export async function resolveSourceDir(opts: {
|
|
|
84
101
|
};
|
|
85
102
|
}
|
|
86
103
|
|
|
87
|
-
export
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
if (!patterns.includes(".templatekeep")) {
|
|
100
|
-
patterns.unshift(".templatekeep");
|
|
104
|
+
export function buildInitPatterns(overrides: OverrideSection[], plugins?: string[]): string[] {
|
|
105
|
+
const has = (section: OverrideSection) => overrides.includes(section);
|
|
106
|
+
const patterns: string[] = [...INIT_ROOT_PATTERNS];
|
|
107
|
+
|
|
108
|
+
if (has("ui")) patterns.push("ui/**");
|
|
109
|
+
if (has("api")) patterns.push("api/**");
|
|
110
|
+
if (has("host")) patterns.push("host/**");
|
|
111
|
+
if (has("plugins")) {
|
|
112
|
+
for (const plugin of plugins ?? []) {
|
|
113
|
+
patterns.push(`plugins/${plugin}/**`);
|
|
114
|
+
}
|
|
101
115
|
}
|
|
102
116
|
|
|
103
117
|
return patterns;
|
|
104
118
|
}
|
|
105
119
|
|
|
120
|
+
export function sourcePathToDestinationPath(filePath: string): string {
|
|
121
|
+
return filePath.startsWith(".github/templates/")
|
|
122
|
+
? filePath.replace(/^\.github\/templates\//, ".github/")
|
|
123
|
+
: filePath;
|
|
124
|
+
}
|
|
125
|
+
|
|
106
126
|
export async function fetchParentConfig(
|
|
107
127
|
extendsAccount: string,
|
|
108
128
|
extendsGateway: string,
|
|
@@ -235,102 +255,33 @@ function parseGitHubUrl(url: string): { owner: string; repo: string; branch: str
|
|
|
235
255
|
return null;
|
|
236
256
|
}
|
|
237
257
|
|
|
238
|
-
function filterPatternsByOverrides(
|
|
239
|
-
patterns: string[],
|
|
240
|
-
overrides: OverrideSection[],
|
|
241
|
-
_plugins?: string[],
|
|
242
|
-
): string[] {
|
|
243
|
-
const has = (section: OverrideSection) => overrides.includes(section);
|
|
244
|
-
let filtered = [...patterns];
|
|
245
|
-
|
|
246
|
-
if (!has("host")) {
|
|
247
|
-
filtered = filtered.filter((p) => !p.startsWith("host/") && p !== "host/**");
|
|
248
|
-
}
|
|
249
|
-
if (!has("ui")) {
|
|
250
|
-
filtered = filtered.filter((p) => !p.startsWith("ui/") && p !== "ui/**");
|
|
251
|
-
}
|
|
252
|
-
if (!has("api")) {
|
|
253
|
-
filtered = filtered.filter((p) => !p.startsWith("api/") && p !== "api/**");
|
|
254
|
-
}
|
|
255
|
-
if (!has("plugins")) {
|
|
256
|
-
filtered = filtered.filter((p) => !p.startsWith("plugins/") && p !== "plugins/**");
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
return filtered;
|
|
260
|
-
}
|
|
261
|
-
|
|
262
258
|
export async function copyFilteredFiles(
|
|
263
259
|
sourceDir: string,
|
|
264
260
|
destination: string,
|
|
265
261
|
patterns: string[],
|
|
266
|
-
|
|
262
|
+
_options: {
|
|
267
263
|
overrides: OverrideSection[];
|
|
268
264
|
plugins?: string[];
|
|
269
|
-
pluginRoutes?: Record<string, string[]>;
|
|
270
265
|
},
|
|
271
266
|
): Promise<number> {
|
|
272
267
|
if (patterns.length === 0) {
|
|
273
268
|
return 0;
|
|
274
269
|
}
|
|
275
270
|
|
|
276
|
-
const has = (section: OverrideSection) => options.overrides.includes(section);
|
|
277
|
-
|
|
278
|
-
const effectivePatterns = filterPatternsByOverrides(patterns, options.overrides, options.plugins);
|
|
279
|
-
|
|
280
|
-
if (has("host") && !effectivePatterns.some((p) => p.startsWith("host/") || p === "host/**")) {
|
|
281
|
-
effectivePatterns.push("host/**");
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
const excludedRoutePatterns: string[] = [];
|
|
285
|
-
if (options.pluginRoutes) {
|
|
286
|
-
for (const [pluginKey, routePatterns] of Object.entries(options.pluginRoutes)) {
|
|
287
|
-
if (!(options.plugins?.includes(pluginKey) ?? true)) {
|
|
288
|
-
excludedRoutePatterns.push(...routePatterns);
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
|
|
293
271
|
const allFiles = new Set<string>();
|
|
294
|
-
for (const pattern of
|
|
272
|
+
for (const pattern of patterns) {
|
|
295
273
|
const matches = await glob(pattern, {
|
|
296
274
|
cwd: sourceDir,
|
|
297
275
|
nodir: true,
|
|
298
276
|
dot: true,
|
|
299
277
|
absolute: false,
|
|
278
|
+
ignore: ["**/node_modules/**", "**/.git/**", "**/dist/**", "**/.bos/**"],
|
|
300
279
|
});
|
|
301
280
|
for (const match of matches) {
|
|
302
|
-
const pluginMatch = match.match(/^plugins\/([^/]+)/);
|
|
303
|
-
if (pluginMatch) {
|
|
304
|
-
const pluginName = pluginMatch[1];
|
|
305
|
-
if (!(options.plugins?.includes(pluginName) ?? true)) continue;
|
|
306
|
-
}
|
|
307
|
-
if (isPathExcluded(match, excludedRoutePatterns)) continue;
|
|
308
281
|
allFiles.add(match);
|
|
309
282
|
}
|
|
310
283
|
}
|
|
311
284
|
|
|
312
|
-
const routeFiles = new Set<string>();
|
|
313
|
-
if (options.pluginRoutes) {
|
|
314
|
-
for (const [pluginKey, routePatterns] of Object.entries(options.pluginRoutes)) {
|
|
315
|
-
if (!(options.plugins?.includes(pluginKey) ?? true)) continue;
|
|
316
|
-
for (const rp of routePatterns) {
|
|
317
|
-
const matches = await glob(rp, {
|
|
318
|
-
cwd: sourceDir,
|
|
319
|
-
nodir: true,
|
|
320
|
-
dot: true,
|
|
321
|
-
absolute: false,
|
|
322
|
-
});
|
|
323
|
-
for (const match of matches) {
|
|
324
|
-
if (!isPathExcluded(match, excludedRoutePatterns)) {
|
|
325
|
-
routeFiles.add(match);
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
for (const f of routeFiles) allFiles.add(f);
|
|
333
|
-
|
|
334
285
|
mkdirSync(destination, { recursive: true });
|
|
335
286
|
|
|
336
287
|
let count = 0;
|
|
@@ -339,9 +290,7 @@ export async function copyFilteredFiles(
|
|
|
339
290
|
const stat = lstatSync(src);
|
|
340
291
|
if (!stat.isFile()) continue;
|
|
341
292
|
|
|
342
|
-
const destPath = filePath
|
|
343
|
-
? filePath.replace(/^\.github\/templates\//, ".github/")
|
|
344
|
-
: filePath;
|
|
293
|
+
const destPath = sourcePathToDestinationPath(filePath);
|
|
345
294
|
const dest = join(destination, destPath);
|
|
346
295
|
mkdirSync(dirname(dest), { recursive: true });
|
|
347
296
|
const content = readFileSync(src);
|
|
@@ -493,34 +442,38 @@ export async function personalizeConfig(
|
|
|
493
442
|
|
|
494
443
|
if (pkg.scripts && typeof pkg.scripts === "object") {
|
|
495
444
|
const scripts = pkg.scripts as Record<string, string>;
|
|
496
|
-
const
|
|
497
|
-
|
|
498
|
-
|
|
445
|
+
const FROM = "bun packages/everything-dev/src/cli.ts";
|
|
446
|
+
const TO = "node_modules/.bin/bos";
|
|
447
|
+
const rewrite = (key: string) => {
|
|
448
|
+
if (scripts[key]?.includes(FROM)) {
|
|
449
|
+
scripts[key] = scripts[key].replaceAll(FROM, TO);
|
|
499
450
|
}
|
|
500
451
|
};
|
|
501
|
-
rewrite("dev"
|
|
502
|
-
rewrite("dev:ui"
|
|
503
|
-
rewrite("dev:api"
|
|
504
|
-
rewrite("dev:proxy"
|
|
505
|
-
rewrite("build"
|
|
506
|
-
rewrite("deploy"
|
|
507
|
-
rewrite("publish"
|
|
508
|
-
rewrite("start"
|
|
509
|
-
|
|
452
|
+
rewrite("dev");
|
|
453
|
+
rewrite("dev:ui");
|
|
454
|
+
rewrite("dev:api");
|
|
455
|
+
rewrite("dev:proxy");
|
|
456
|
+
rewrite("build");
|
|
457
|
+
rewrite("deploy");
|
|
458
|
+
rewrite("publish");
|
|
459
|
+
rewrite("start");
|
|
460
|
+
rewrite("bos");
|
|
510
461
|
scripts.postinstall = "node_modules/.bin/bos types gen || true";
|
|
511
462
|
scripts["types:gen"] = "node_modules/.bin/bos types gen";
|
|
512
463
|
if (scripts.typecheck) {
|
|
513
464
|
scripts.typecheck = scripts.typecheck
|
|
514
465
|
.replace("bun run types:gen && ", "")
|
|
515
466
|
.replace(/bun run --cwd packages\/everything-dev typecheck & ?/, "");
|
|
467
|
+
if (!has("ui")) {
|
|
468
|
+
scripts.typecheck = scripts.typecheck.replace(/bun run --cwd ui tsc --noEmit & ?/, "");
|
|
469
|
+
}
|
|
470
|
+
if (!has("api")) {
|
|
471
|
+
scripts.typecheck = scripts.typecheck.replace(/bun run --cwd api tsc --noEmit & ?/, "");
|
|
472
|
+
}
|
|
516
473
|
if (!has("host")) {
|
|
517
474
|
scripts.typecheck = scripts.typecheck.replace(/bun run --cwd host tsc --noEmit & ?/, "");
|
|
518
475
|
}
|
|
519
476
|
}
|
|
520
|
-
|
|
521
|
-
if (!scripts.bos) {
|
|
522
|
-
scripts.bos = "node_modules/.bin/bos";
|
|
523
|
-
}
|
|
524
477
|
}
|
|
525
478
|
|
|
526
479
|
if (pkg.devDependencies && typeof pkg.devDependencies === "object") {
|
|
@@ -696,13 +649,31 @@ export async function runTypesGen(
|
|
|
696
649
|
destination: string,
|
|
697
650
|
spinner?: { message: (msg: string) => void },
|
|
698
651
|
): Promise<void> {
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
652
|
+
const localBosBin = join(destination, "node_modules", ".bin", "bos");
|
|
653
|
+
if (existsSync(localBosBin)) {
|
|
654
|
+
await runWithProgress(
|
|
655
|
+
"node_modules/.bin/bos",
|
|
656
|
+
["types", "gen"],
|
|
657
|
+
destination,
|
|
658
|
+
spinner,
|
|
659
|
+
"Generating types",
|
|
660
|
+
);
|
|
661
|
+
return;
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
const localCli = join(destination, "packages", "everything-dev", "src", "cli.ts");
|
|
665
|
+
if (existsSync(localCli)) {
|
|
666
|
+
await runWithProgress(
|
|
667
|
+
"bun",
|
|
668
|
+
["run", "--cwd", "packages/everything-dev", "src/cli.ts", "types", "gen"],
|
|
669
|
+
destination,
|
|
670
|
+
spinner,
|
|
671
|
+
"Generating types",
|
|
672
|
+
);
|
|
673
|
+
return;
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
throw new Error("Unable to locate bos CLI for types generation");
|
|
706
677
|
}
|
|
707
678
|
|
|
708
679
|
export async function runDockerComposeUp(destination: string): Promise<void> {
|
|
@@ -779,60 +750,72 @@ const WORKSPACE_LOCAL_PATHS: Record<string, string> = {
|
|
|
779
750
|
"every-plugin": "packages/every-plugin",
|
|
780
751
|
};
|
|
781
752
|
|
|
753
|
+
function readJsonFile<T>(filePath: string): T {
|
|
754
|
+
return JSON.parse(readFileSync(filePath, "utf-8")) as T;
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
function tryResolvePackageJson(packageName: string): string | null {
|
|
758
|
+
try {
|
|
759
|
+
return require.resolve(`${packageName}/package.json`);
|
|
760
|
+
} catch {
|
|
761
|
+
return null;
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
|
|
782
765
|
function resolveFrameworkCatalog(): Record<string, string> {
|
|
783
766
|
const catalog: Record<string, string> = {};
|
|
767
|
+
const everythingDevPackageJson = tryResolvePackageJson("everything-dev");
|
|
784
768
|
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
769
|
+
if (everythingDevPackageJson) {
|
|
770
|
+
try {
|
|
771
|
+
const selfPkgDir = dirname(everythingDevPackageJson);
|
|
772
|
+
const monorepoPkgPath = join(selfPkgDir, "..", "..", "package.json");
|
|
773
|
+
if (existsSync(monorepoPkgPath)) {
|
|
774
|
+
const monorepoPkg = readJsonFile<{
|
|
775
|
+
workspaces?: { catalog?: Record<string, string> };
|
|
776
|
+
}>(monorepoPkgPath);
|
|
777
|
+
const sourceCatalog = monorepoPkg.workspaces?.catalog;
|
|
778
|
+
if (sourceCatalog && typeof sourceCatalog === "object") {
|
|
779
|
+
for (const [name, version] of Object.entries(sourceCatalog)) {
|
|
780
|
+
if (typeof version === "string") {
|
|
781
|
+
catalog[name] = version;
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
} catch {}
|
|
787
|
+
|
|
788
|
+
try {
|
|
789
|
+
const selfPkg = readJsonFile<{
|
|
790
|
+
version?: string;
|
|
791
791
|
workspaces?: { catalog?: Record<string, string> };
|
|
792
|
-
};
|
|
793
|
-
|
|
792
|
+
}>(everythingDevPackageJson);
|
|
793
|
+
if (selfPkg.version && !catalog["everything-dev"]) {
|
|
794
|
+
catalog["everything-dev"] = `^${selfPkg.version}`;
|
|
795
|
+
}
|
|
796
|
+
const sourceCatalog = selfPkg.workspaces?.catalog;
|
|
794
797
|
if (sourceCatalog && typeof sourceCatalog === "object") {
|
|
795
798
|
for (const [name, version] of Object.entries(sourceCatalog)) {
|
|
796
|
-
if (typeof version === "string") {
|
|
799
|
+
if (typeof version === "string" && !catalog[name]) {
|
|
797
800
|
catalog[name] = version;
|
|
798
801
|
}
|
|
799
802
|
}
|
|
800
803
|
}
|
|
801
|
-
}
|
|
802
|
-
} catch {}
|
|
803
|
-
|
|
804
|
-
try {
|
|
805
|
-
const selfPkgPath = require.resolve("everything-dev/package.json");
|
|
806
|
-
const selfPkg = JSON.parse(readFileSync(selfPkgPath, "utf-8")) as {
|
|
807
|
-
version?: string;
|
|
808
|
-
workspaces?: { catalog?: Record<string, string> };
|
|
809
|
-
};
|
|
810
|
-
if (selfPkg.version && !catalog["everything-dev"]) {
|
|
811
|
-
catalog["everything-dev"] = `^${selfPkg.version}`;
|
|
812
|
-
}
|
|
813
|
-
const sourceCatalog = selfPkg.workspaces?.catalog;
|
|
814
|
-
if (sourceCatalog && typeof sourceCatalog === "object") {
|
|
815
|
-
for (const [name, version] of Object.entries(sourceCatalog)) {
|
|
816
|
-
if (typeof version === "string" && !catalog[name]) {
|
|
817
|
-
catalog[name] = version;
|
|
818
|
-
}
|
|
819
|
-
}
|
|
820
|
-
}
|
|
821
|
-
} catch {}
|
|
822
|
-
|
|
823
|
-
if (Object.keys(catalog).length > 0) {
|
|
824
|
-
return catalog;
|
|
804
|
+
} catch {}
|
|
825
805
|
}
|
|
826
806
|
|
|
827
807
|
for (const packageName of FRAMEWORK_PACKAGES) {
|
|
808
|
+
const resolved = tryResolvePackageJson(packageName);
|
|
809
|
+
if (!resolved) continue;
|
|
810
|
+
|
|
828
811
|
try {
|
|
829
|
-
const
|
|
830
|
-
const pkg = JSON.parse(readFileSync(resolved, "utf-8")) as { version?: string };
|
|
812
|
+
const pkg = readJsonFile<{ version?: string }>(resolved);
|
|
831
813
|
if (pkg.version) {
|
|
832
814
|
catalog[packageName] = `^${pkg.version}`;
|
|
833
815
|
}
|
|
834
816
|
} catch {}
|
|
835
817
|
}
|
|
818
|
+
|
|
836
819
|
return catalog;
|
|
837
820
|
}
|
|
838
821
|
|
|
@@ -1012,72 +995,32 @@ export async function writeInitSnapshot(
|
|
|
1012
995
|
extendsGateway: string,
|
|
1013
996
|
sourceDir: string,
|
|
1014
997
|
patterns: string[],
|
|
1015
|
-
|
|
998
|
+
_options: {
|
|
1016
999
|
overrides: OverrideSection[];
|
|
1017
1000
|
plugins?: string[];
|
|
1018
|
-
pluginRoutes?: Record<string, string[]>;
|
|
1019
1001
|
},
|
|
1020
1002
|
): Promise<void> {
|
|
1021
|
-
const effectivePatterns = filterPatternsByOverrides(patterns, options.overrides, options.plugins);
|
|
1022
|
-
|
|
1023
|
-
const has = (section: OverrideSection) => options.overrides.includes(section);
|
|
1024
|
-
if (has("host") && !effectivePatterns.some((p) => p.startsWith("host/") || p === "host/**")) {
|
|
1025
|
-
effectivePatterns.push("host/**");
|
|
1026
|
-
}
|
|
1027
|
-
|
|
1028
|
-
const excludedRoutePatterns: string[] = [];
|
|
1029
|
-
if (options.pluginRoutes) {
|
|
1030
|
-
for (const [pluginKey, routePatterns] of Object.entries(options.pluginRoutes)) {
|
|
1031
|
-
if (!(options.plugins?.includes(pluginKey) ?? true)) {
|
|
1032
|
-
excludedRoutePatterns.push(...routePatterns);
|
|
1033
|
-
}
|
|
1034
|
-
}
|
|
1035
|
-
}
|
|
1036
|
-
|
|
1037
1003
|
const allFiles = new Set<string>();
|
|
1038
|
-
for (const pattern of
|
|
1004
|
+
for (const pattern of patterns) {
|
|
1039
1005
|
const matches = await glob(pattern, {
|
|
1040
1006
|
cwd: sourceDir,
|
|
1041
1007
|
nodir: true,
|
|
1042
1008
|
dot: true,
|
|
1043
1009
|
absolute: false,
|
|
1010
|
+
ignore: ["**/node_modules/**", "**/.git/**", "**/dist/**", "**/.bos/**"],
|
|
1044
1011
|
});
|
|
1045
1012
|
for (const match of matches) {
|
|
1046
|
-
const pluginMatch = match.match(/^plugins\/([^/]+)/);
|
|
1047
|
-
if (pluginMatch && !(options.plugins?.includes(pluginMatch[1]) ?? true)) continue;
|
|
1048
|
-
if (isPathExcluded(match, excludedRoutePatterns)) continue;
|
|
1049
1013
|
allFiles.add(match);
|
|
1050
1014
|
}
|
|
1051
1015
|
}
|
|
1052
1016
|
|
|
1053
|
-
if (options.pluginRoutes) {
|
|
1054
|
-
for (const [pluginKey, routePatterns] of Object.entries(options.pluginRoutes)) {
|
|
1055
|
-
if (!(options.plugins?.includes(pluginKey) ?? true)) continue;
|
|
1056
|
-
for (const rp of routePatterns) {
|
|
1057
|
-
const matches = await glob(rp, {
|
|
1058
|
-
cwd: sourceDir,
|
|
1059
|
-
nodir: true,
|
|
1060
|
-
dot: true,
|
|
1061
|
-
absolute: false,
|
|
1062
|
-
});
|
|
1063
|
-
for (const match of matches) {
|
|
1064
|
-
if (!isPathExcluded(match, excludedRoutePatterns)) {
|
|
1065
|
-
allFiles.add(match);
|
|
1066
|
-
}
|
|
1067
|
-
}
|
|
1068
|
-
}
|
|
1069
|
-
}
|
|
1070
|
-
}
|
|
1071
|
-
|
|
1072
1017
|
const fileHashes: Record<string, string> = {};
|
|
1073
1018
|
for (const filePath of allFiles) {
|
|
1074
1019
|
const src = join(sourceDir, filePath);
|
|
1075
1020
|
const stat = lstatSync(src);
|
|
1076
1021
|
if (!stat.isFile()) continue;
|
|
1077
1022
|
const content = readFileSync(src);
|
|
1078
|
-
const destPath = filePath
|
|
1079
|
-
? filePath.replace(/^\.github\/templates\//, ".github/")
|
|
1080
|
-
: filePath;
|
|
1023
|
+
const destPath = sourcePathToDestinationPath(filePath);
|
|
1081
1024
|
fileHashes[destPath] = computeHash(content);
|
|
1082
1025
|
}
|
|
1083
1026
|
|
package/src/cli/prompts.ts
CHANGED
|
@@ -89,7 +89,7 @@ export async function promptInitOptions(input: {
|
|
|
89
89
|
const overrides =
|
|
90
90
|
input.overrides ??
|
|
91
91
|
((await p.multiselect({
|
|
92
|
-
message: "
|
|
92
|
+
message: "What do you want to customize?",
|
|
93
93
|
options: OVERRIDE_OPTIONS,
|
|
94
94
|
initialValues: ["ui", "api"] as OverrideSection[],
|
|
95
95
|
required: false,
|