everything-dev 1.26.0 → 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 +127 -114
- package/dist/cli/init.cjs.map +1 -1
- package/dist/cli/init.d.cts +7 -6
- package/dist/cli/init.d.cts.map +1 -1
- package/dist/cli/init.d.mts +7 -6
- package/dist/cli/init.d.mts.map +1 -1
- package/dist/cli/init.mjs +124 -114
- 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 +3 -3
- package/dist/cli/prompts.cjs.map +1 -1
- package/dist/cli/prompts.mjs +2 -2
- 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 +43 -22
- package/dist/cli/upgrade.cjs.map +1 -1
- package/dist/cli/upgrade.mjs +44 -23
- 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 +3 -3
- package/dist/contract.d.cts.map +1 -1
- package/dist/contract.d.mts +3 -3
- package/dist/contract.d.mts.map +1 -1
- package/dist/contract.meta.cjs +1 -1
- package/dist/contract.meta.cjs.map +1 -1
- package/dist/contract.meta.d.cts +1 -1
- package/dist/contract.meta.d.mts +1 -1
- package/dist/contract.meta.mjs +1 -1
- package/dist/contract.meta.mjs.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 +72 -50
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.d.cts +2 -2
- package/dist/plugin.d.cts.map +1 -1
- package/dist/plugin.d.mts +2 -2
- package/dist/plugin.d.mts.map +1 -1
- package/dist/plugin.mjs +53 -32
- 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 +149 -195
- package/src/cli/prompts.ts +1 -1
- package/src/cli/sync.ts +48 -137
- package/src/cli/upgrade.ts +66 -25
- package/src/contract.meta.ts +1 -1
- package/src/contract.ts +2 -1
- package/src/plugin.ts +69 -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") {
|
|
@@ -683,20 +636,44 @@ export async function runBunInstallForUpgrade(
|
|
|
683
636
|
destination: string,
|
|
684
637
|
spinner?: { message: (msg: string) => void },
|
|
685
638
|
): Promise<void> {
|
|
686
|
-
await runWithProgress(
|
|
639
|
+
await runWithProgress(
|
|
640
|
+
"bun",
|
|
641
|
+
["install", "--force"],
|
|
642
|
+
destination,
|
|
643
|
+
spinner,
|
|
644
|
+
"Installing dependencies",
|
|
645
|
+
);
|
|
687
646
|
}
|
|
688
647
|
|
|
689
648
|
export async function runTypesGen(
|
|
690
649
|
destination: string,
|
|
691
650
|
spinner?: { message: (msg: string) => void },
|
|
692
651
|
): Promise<void> {
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
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");
|
|
700
677
|
}
|
|
701
678
|
|
|
702
679
|
export async function runDockerComposeUp(destination: string): Promise<void> {
|
|
@@ -763,65 +740,82 @@ export function stripOrphanedWorkspacesFromLockfile(
|
|
|
763
740
|
}
|
|
764
741
|
}
|
|
765
742
|
|
|
743
|
+
export function removeInitLockfile(lockfilePath: string): void {
|
|
744
|
+
if (!existsSync(lockfilePath)) return;
|
|
745
|
+
rmSync(lockfilePath, { force: true });
|
|
746
|
+
}
|
|
747
|
+
|
|
766
748
|
const WORKSPACE_LOCAL_PATHS: Record<string, string> = {
|
|
767
749
|
"everything-dev": "packages/everything-dev",
|
|
768
750
|
"every-plugin": "packages/every-plugin",
|
|
769
751
|
};
|
|
770
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
|
+
|
|
771
765
|
function resolveFrameworkCatalog(): Record<string, string> {
|
|
772
766
|
const catalog: Record<string, string> = {};
|
|
767
|
+
const everythingDevPackageJson = tryResolvePackageJson("everything-dev");
|
|
773
768
|
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
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;
|
|
780
791
|
workspaces?: { catalog?: Record<string, string> };
|
|
781
|
-
};
|
|
782
|
-
|
|
792
|
+
}>(everythingDevPackageJson);
|
|
793
|
+
if (selfPkg.version && !catalog["everything-dev"]) {
|
|
794
|
+
catalog["everything-dev"] = `^${selfPkg.version}`;
|
|
795
|
+
}
|
|
796
|
+
const sourceCatalog = selfPkg.workspaces?.catalog;
|
|
783
797
|
if (sourceCatalog && typeof sourceCatalog === "object") {
|
|
784
798
|
for (const [name, version] of Object.entries(sourceCatalog)) {
|
|
785
|
-
if (typeof version === "string") {
|
|
799
|
+
if (typeof version === "string" && !catalog[name]) {
|
|
786
800
|
catalog[name] = version;
|
|
787
801
|
}
|
|
788
802
|
}
|
|
789
803
|
}
|
|
790
|
-
}
|
|
791
|
-
} catch {}
|
|
792
|
-
|
|
793
|
-
try {
|
|
794
|
-
const selfPkgPath = require.resolve("everything-dev/package.json");
|
|
795
|
-
const selfPkg = JSON.parse(readFileSync(selfPkgPath, "utf-8")) as {
|
|
796
|
-
version?: string;
|
|
797
|
-
workspaces?: { catalog?: Record<string, string> };
|
|
798
|
-
};
|
|
799
|
-
if (selfPkg.version && !catalog["everything-dev"]) {
|
|
800
|
-
catalog["everything-dev"] = `^${selfPkg.version}`;
|
|
801
|
-
}
|
|
802
|
-
const sourceCatalog = selfPkg.workspaces?.catalog;
|
|
803
|
-
if (sourceCatalog && typeof sourceCatalog === "object") {
|
|
804
|
-
for (const [name, version] of Object.entries(sourceCatalog)) {
|
|
805
|
-
if (typeof version === "string" && !catalog[name]) {
|
|
806
|
-
catalog[name] = version;
|
|
807
|
-
}
|
|
808
|
-
}
|
|
809
|
-
}
|
|
810
|
-
} catch {}
|
|
811
|
-
|
|
812
|
-
if (Object.keys(catalog).length > 0) {
|
|
813
|
-
return catalog;
|
|
804
|
+
} catch {}
|
|
814
805
|
}
|
|
815
806
|
|
|
816
807
|
for (const packageName of FRAMEWORK_PACKAGES) {
|
|
808
|
+
const resolved = tryResolvePackageJson(packageName);
|
|
809
|
+
if (!resolved) continue;
|
|
810
|
+
|
|
817
811
|
try {
|
|
818
|
-
const
|
|
819
|
-
const pkg = JSON.parse(readFileSync(resolved, "utf-8")) as { version?: string };
|
|
812
|
+
const pkg = readJsonFile<{ version?: string }>(resolved);
|
|
820
813
|
if (pkg.version) {
|
|
821
814
|
catalog[packageName] = `^${pkg.version}`;
|
|
822
815
|
}
|
|
823
816
|
} catch {}
|
|
824
817
|
}
|
|
818
|
+
|
|
825
819
|
return catalog;
|
|
826
820
|
}
|
|
827
821
|
|
|
@@ -1001,72 +995,32 @@ export async function writeInitSnapshot(
|
|
|
1001
995
|
extendsGateway: string,
|
|
1002
996
|
sourceDir: string,
|
|
1003
997
|
patterns: string[],
|
|
1004
|
-
|
|
998
|
+
_options: {
|
|
1005
999
|
overrides: OverrideSection[];
|
|
1006
1000
|
plugins?: string[];
|
|
1007
|
-
pluginRoutes?: Record<string, string[]>;
|
|
1008
1001
|
},
|
|
1009
1002
|
): Promise<void> {
|
|
1010
|
-
const effectivePatterns = filterPatternsByOverrides(patterns, options.overrides, options.plugins);
|
|
1011
|
-
|
|
1012
|
-
const has = (section: OverrideSection) => options.overrides.includes(section);
|
|
1013
|
-
if (has("host") && !effectivePatterns.some((p) => p.startsWith("host/") || p === "host/**")) {
|
|
1014
|
-
effectivePatterns.push("host/**");
|
|
1015
|
-
}
|
|
1016
|
-
|
|
1017
|
-
const excludedRoutePatterns: string[] = [];
|
|
1018
|
-
if (options.pluginRoutes) {
|
|
1019
|
-
for (const [pluginKey, routePatterns] of Object.entries(options.pluginRoutes)) {
|
|
1020
|
-
if (!(options.plugins?.includes(pluginKey) ?? true)) {
|
|
1021
|
-
excludedRoutePatterns.push(...routePatterns);
|
|
1022
|
-
}
|
|
1023
|
-
}
|
|
1024
|
-
}
|
|
1025
|
-
|
|
1026
1003
|
const allFiles = new Set<string>();
|
|
1027
|
-
for (const pattern of
|
|
1004
|
+
for (const pattern of patterns) {
|
|
1028
1005
|
const matches = await glob(pattern, {
|
|
1029
1006
|
cwd: sourceDir,
|
|
1030
1007
|
nodir: true,
|
|
1031
1008
|
dot: true,
|
|
1032
1009
|
absolute: false,
|
|
1010
|
+
ignore: ["**/node_modules/**", "**/.git/**", "**/dist/**", "**/.bos/**"],
|
|
1033
1011
|
});
|
|
1034
1012
|
for (const match of matches) {
|
|
1035
|
-
const pluginMatch = match.match(/^plugins\/([^/]+)/);
|
|
1036
|
-
if (pluginMatch && !(options.plugins?.includes(pluginMatch[1]) ?? true)) continue;
|
|
1037
|
-
if (isPathExcluded(match, excludedRoutePatterns)) continue;
|
|
1038
1013
|
allFiles.add(match);
|
|
1039
1014
|
}
|
|
1040
1015
|
}
|
|
1041
1016
|
|
|
1042
|
-
if (options.pluginRoutes) {
|
|
1043
|
-
for (const [pluginKey, routePatterns] of Object.entries(options.pluginRoutes)) {
|
|
1044
|
-
if (!(options.plugins?.includes(pluginKey) ?? true)) continue;
|
|
1045
|
-
for (const rp of routePatterns) {
|
|
1046
|
-
const matches = await glob(rp, {
|
|
1047
|
-
cwd: sourceDir,
|
|
1048
|
-
nodir: true,
|
|
1049
|
-
dot: true,
|
|
1050
|
-
absolute: false,
|
|
1051
|
-
});
|
|
1052
|
-
for (const match of matches) {
|
|
1053
|
-
if (!isPathExcluded(match, excludedRoutePatterns)) {
|
|
1054
|
-
allFiles.add(match);
|
|
1055
|
-
}
|
|
1056
|
-
}
|
|
1057
|
-
}
|
|
1058
|
-
}
|
|
1059
|
-
}
|
|
1060
|
-
|
|
1061
1017
|
const fileHashes: Record<string, string> = {};
|
|
1062
1018
|
for (const filePath of allFiles) {
|
|
1063
1019
|
const src = join(sourceDir, filePath);
|
|
1064
1020
|
const stat = lstatSync(src);
|
|
1065
1021
|
if (!stat.isFile()) continue;
|
|
1066
1022
|
const content = readFileSync(src);
|
|
1067
|
-
const destPath = filePath
|
|
1068
|
-
? filePath.replace(/^\.github\/templates\//, ".github/")
|
|
1069
|
-
: filePath;
|
|
1023
|
+
const destPath = sourcePathToDestinationPath(filePath);
|
|
1070
1024
|
fileHashes[destPath] = computeHash(content);
|
|
1071
1025
|
}
|
|
1072
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,
|