everything-dev 1.20.0 → 1.22.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/cli/init.cjs +163 -80
- package/dist/cli/init.cjs.map +1 -1
- package/dist/cli/init.d.cts +12 -6
- package/dist/cli/init.d.cts.map +1 -1
- package/dist/cli/init.d.mts +12 -6
- package/dist/cli/init.d.mts.map +1 -1
- package/dist/cli/init.mjs +163 -81
- package/dist/cli/init.mjs.map +1 -1
- package/dist/cli/parse.cjs +9 -0
- package/dist/cli/parse.cjs.map +1 -1
- package/dist/cli/parse.mjs +9 -0
- package/dist/cli/parse.mjs.map +1 -1
- package/dist/cli/prompts.cjs +44 -13
- package/dist/cli/prompts.cjs.map +1 -1
- package/dist/cli/prompts.mjs +44 -13
- package/dist/cli/prompts.mjs.map +1 -1
- package/dist/cli/sync.cjs +6 -0
- package/dist/cli/sync.cjs.map +1 -1
- package/dist/cli/sync.mjs +6 -0
- package/dist/cli/sync.mjs.map +1 -1
- package/dist/cli.cjs +3 -1
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.mjs +3 -1
- package/dist/cli.mjs.map +1 -1
- package/dist/contract.cjs +9 -1
- package/dist/contract.cjs.map +1 -1
- package/dist/contract.d.cts +33 -4
- package/dist/contract.d.cts.map +1 -1
- package/dist/contract.d.mts +33 -4
- package/dist/contract.d.mts.map +1 -1
- package/dist/contract.meta.cjs +2 -2
- package/dist/contract.meta.cjs.map +1 -1
- package/dist/contract.meta.d.cts +3 -3
- package/dist/contract.meta.d.mts +3 -3
- package/dist/contract.meta.mjs +2 -2
- package/dist/contract.meta.mjs.map +1 -1
- package/dist/contract.mjs +9 -2
- package/dist/contract.mjs.map +1 -1
- package/dist/fastkv.cjs +4 -1
- package/dist/fastkv.cjs.map +1 -1
- package/dist/fastkv.mjs +4 -1
- package/dist/fastkv.mjs.map +1 -1
- package/dist/index.cjs +1 -0
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +2 -2
- package/dist/plugin.cjs +43 -20
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.d.cts +13 -2
- package/dist/plugin.d.cts.map +1 -1
- package/dist/plugin.d.mts +13 -2
- package/dist/plugin.d.mts.map +1 -1
- package/dist/plugin.mjs +44 -21
- package/dist/plugin.mjs.map +1 -1
- package/package.json +1 -1
- package/src/cli/init.ts +252 -95
- package/src/cli/parse.ts +17 -0
- package/src/cli/prompts.ts +45 -28
- package/src/cli/sync.ts +1 -0
- package/src/cli.ts +8 -1
- package/src/contract.meta.ts +6 -2
- package/src/contract.ts +5 -1
- package/src/fastkv.ts +6 -1
- package/src/plugin.ts +58 -18
package/src/cli/prompts.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import process from "node:process";
|
|
2
2
|
import * as p from "@clack/prompts";
|
|
3
|
+
import type { OverrideSection } from "../contract";
|
|
3
4
|
|
|
4
5
|
function parseExtendsRef(ref: string): { account: string; gateway: string } | null {
|
|
5
6
|
const normalized = ref.startsWith("bos://") ? ref : `bos://${ref}`;
|
|
@@ -17,13 +18,20 @@ function deriveAccountFromExtends(domain: string, extendsAccount: string): strin
|
|
|
17
18
|
return `${firstSegment}.${suffix}`;
|
|
18
19
|
}
|
|
19
20
|
|
|
21
|
+
const OVERRIDE_OPTIONS: { value: OverrideSection; label: string; hint: string }[] = [
|
|
22
|
+
{ value: "ui", label: "ui", hint: "Override UI with local source" },
|
|
23
|
+
{ value: "api", label: "api", hint: "Override API with local source" },
|
|
24
|
+
{ value: "host", label: "host", hint: "Override host with local source" },
|
|
25
|
+
{ value: "plugins", label: "plugins", hint: "Override selected plugins with local source" },
|
|
26
|
+
];
|
|
27
|
+
|
|
20
28
|
export async function promptInitOptions(input: {
|
|
21
29
|
extends?: string;
|
|
22
30
|
directory?: string;
|
|
23
31
|
account?: string;
|
|
24
32
|
domain?: string;
|
|
25
33
|
plugins?: string[];
|
|
26
|
-
|
|
34
|
+
overrides?: OverrideSection[];
|
|
27
35
|
parentPluginKeys?: string[];
|
|
28
36
|
}): Promise<{
|
|
29
37
|
extendsAccount: string;
|
|
@@ -32,7 +40,7 @@ export async function promptInitOptions(input: {
|
|
|
32
40
|
account?: string;
|
|
33
41
|
domain?: string;
|
|
34
42
|
plugins: string[];
|
|
35
|
-
|
|
43
|
+
overrides: OverrideSection[];
|
|
36
44
|
}> {
|
|
37
45
|
p.intro("Let's build an app...");
|
|
38
46
|
|
|
@@ -78,34 +86,43 @@ export async function promptInitOptions(input: {
|
|
|
78
86
|
|
|
79
87
|
const directory = input.directory || domain || extendsGateway;
|
|
80
88
|
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
89
|
+
const overrides =
|
|
90
|
+
input.overrides ??
|
|
91
|
+
((await p.multiselect({
|
|
92
|
+
message: "Which sections to override locally?",
|
|
93
|
+
options: OVERRIDE_OPTIONS,
|
|
94
|
+
initialValues: ["ui", "api"] as OverrideSection[],
|
|
95
|
+
required: false,
|
|
96
|
+
})) as OverrideSection[]);
|
|
97
|
+
|
|
98
|
+
if (p.isCancel(overrides)) process.exit(0);
|
|
99
|
+
|
|
100
|
+
let plugins: string[] = [];
|
|
101
|
+
if (overrides.includes("plugins")) {
|
|
102
|
+
const parentPlugins = input.parentPluginKeys ?? [];
|
|
103
|
+
const pluginOptions =
|
|
104
|
+
parentPlugins.length > 0 ? parentPlugins.map((key) => ({ value: key, label: key })) : [];
|
|
105
|
+
|
|
106
|
+
plugins =
|
|
107
|
+
input.plugins ??
|
|
108
|
+
(pluginOptions.length > 0
|
|
109
|
+
? ((await p.multiselect({
|
|
110
|
+
message: "Select plugins to include:",
|
|
111
|
+
options: pluginOptions,
|
|
112
|
+
required: false,
|
|
113
|
+
})) as string[])
|
|
114
|
+
: []);
|
|
115
|
+
|
|
116
|
+
if (p.isCancel(plugins)) process.exit(0);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
const go = await p.confirm({
|
|
120
|
+
message: "GO!",
|
|
121
|
+
initialValue: true,
|
|
122
|
+
});
|
|
104
123
|
|
|
105
124
|
if (p.isCancel(go) || !go) process.exit(0);
|
|
106
125
|
|
|
107
|
-
const withHost = input.withHost ?? false;
|
|
108
|
-
|
|
109
126
|
return {
|
|
110
127
|
extendsAccount,
|
|
111
128
|
extendsGateway,
|
|
@@ -113,6 +130,6 @@ export async function promptInitOptions(input: {
|
|
|
113
130
|
account: account || undefined,
|
|
114
131
|
domain: domain || undefined,
|
|
115
132
|
plugins,
|
|
116
|
-
|
|
133
|
+
overrides,
|
|
117
134
|
};
|
|
118
135
|
}
|
package/src/cli/sync.ts
CHANGED
package/src/cli.ts
CHANGED
|
@@ -70,9 +70,14 @@ async function warnIfOutdated(client: any, command: string): Promise<void> {
|
|
|
70
70
|
const status = await client.status();
|
|
71
71
|
if (status.status === "error" || !status.packages) return;
|
|
72
72
|
|
|
73
|
+
const frameworkPackages = ["everything-dev", "every-plugin"];
|
|
74
|
+
|
|
73
75
|
const outdated = status.packages.filter(
|
|
74
76
|
(p: { name: string; installed?: string; latest?: string }) =>
|
|
75
|
-
p.installed &&
|
|
77
|
+
p.installed &&
|
|
78
|
+
p.latest &&
|
|
79
|
+
normalizeVersion(p.installed) !== normalizeVersion(p.latest) &&
|
|
80
|
+
frameworkPackages.includes(p.name),
|
|
76
81
|
);
|
|
77
82
|
|
|
78
83
|
if (outdated.length === 0) return;
|
|
@@ -162,6 +167,8 @@ async function main() {
|
|
|
162
167
|
console.log(` ${colors.dim("Directory:")} ${result.directory}`);
|
|
163
168
|
if (result.account) console.log(` ${colors.dim("Account:")} ${result.account}`);
|
|
164
169
|
if (result.domain) console.log(` ${colors.dim("Domain:")} ${result.domain}`);
|
|
170
|
+
if (result.overrides && result.overrides.length > 0)
|
|
171
|
+
console.log(` ${colors.dim("Overrides:")} ${result.overrides.join(", ")}`);
|
|
165
172
|
if (result.plugins && result.plugins.length > 0)
|
|
166
173
|
console.log(` ${colors.dim("Plugins:")} ${result.plugins.join(", ")}`);
|
|
167
174
|
console.log(` ${colors.dim("Files copied:")} ${result.filesCopied}`);
|
package/src/contract.meta.ts
CHANGED
|
@@ -92,8 +92,12 @@ export const cliCommandMeta = {
|
|
|
92
92
|
account: { description: "New project NEAR account (auto-derived from extends)" },
|
|
93
93
|
directory: { description: "Target directory (auto-derived from domain)" },
|
|
94
94
|
source: { description: "Local source dir (skips GitHub download)" },
|
|
95
|
-
plugins: {
|
|
96
|
-
|
|
95
|
+
plugins: {
|
|
96
|
+
description: "Comma-separated plugin keys to include (requires --overrides=plugins)",
|
|
97
|
+
},
|
|
98
|
+
overrides: {
|
|
99
|
+
description: "Comma-separated sections to override locally: ui,api,host,plugins",
|
|
100
|
+
},
|
|
97
101
|
noInteractive: { description: "Skip prompts, use flags only" },
|
|
98
102
|
noInstall: { description: "Skip bun install" },
|
|
99
103
|
},
|
package/src/contract.ts
CHANGED
|
@@ -142,6 +142,8 @@ export const KeyPublishResultSchema = z.object({
|
|
|
142
142
|
error: z.string().optional(),
|
|
143
143
|
});
|
|
144
144
|
|
|
145
|
+
export const OverrideSectionSchema = z.enum(["ui", "api", "host", "plugins"]);
|
|
146
|
+
|
|
145
147
|
export const InitOptionsSchema = z.object({
|
|
146
148
|
extends: z.string().optional(),
|
|
147
149
|
directory: z.string().optional(),
|
|
@@ -149,7 +151,7 @@ export const InitOptionsSchema = z.object({
|
|
|
149
151
|
domain: z.string().optional(),
|
|
150
152
|
source: z.string().optional(),
|
|
151
153
|
plugins: z.array(z.string()).optional(),
|
|
152
|
-
|
|
154
|
+
overrides: z.array(OverrideSectionSchema).optional(),
|
|
153
155
|
noInteractive: z.boolean().default(false),
|
|
154
156
|
noInstall: z.boolean().default(false),
|
|
155
157
|
});
|
|
@@ -167,6 +169,7 @@ export const InitResultSchema = z.object({
|
|
|
167
169
|
domain: z.string().optional(),
|
|
168
170
|
extends: z.string(),
|
|
169
171
|
plugins: z.array(z.string()).optional(),
|
|
172
|
+
overrides: z.array(OverrideSectionSchema).optional(),
|
|
170
173
|
filesCopied: z.number(),
|
|
171
174
|
timings: z.array(PhaseTimingSchema).optional(),
|
|
172
175
|
error: z.string().optional(),
|
|
@@ -311,6 +314,7 @@ export type KeyPublishOptions = z.infer<typeof KeyPublishOptionsSchema>;
|
|
|
311
314
|
export type KeyPublishResult = z.infer<typeof KeyPublishResultSchema>;
|
|
312
315
|
export type InitOptions = z.infer<typeof InitOptionsSchema>;
|
|
313
316
|
export type InitResult = z.infer<typeof InitResultSchema>;
|
|
317
|
+
export type OverrideSection = z.infer<typeof OverrideSectionSchema>;
|
|
314
318
|
export type PhaseTiming = z.infer<typeof PhaseTimingSchema>;
|
|
315
319
|
export type SyncOptions = z.infer<typeof SyncOptionsSchema>;
|
|
316
320
|
export type SyncResult = z.infer<typeof SyncResultSchema>;
|
package/src/fastkv.ts
CHANGED
|
@@ -141,8 +141,13 @@ export interface PluginManifest {
|
|
|
141
141
|
|
|
142
142
|
export async function fetchRemotePluginManifest(cdnUrl: string): Promise<PluginManifest | null> {
|
|
143
143
|
try {
|
|
144
|
+
const controller = new AbortController();
|
|
145
|
+
const timeout = setTimeout(() => controller.abort(), FASTKV_TIMEOUT_MS);
|
|
144
146
|
const baseUrl = cdnUrl.replace(/\/$/, "");
|
|
145
|
-
const response = await fetch(`${baseUrl}/plugin.manifest.json
|
|
147
|
+
const response = await fetch(`${baseUrl}/plugin.manifest.json`, {
|
|
148
|
+
signal: controller.signal,
|
|
149
|
+
});
|
|
150
|
+
clearTimeout(timeout);
|
|
146
151
|
if (!response.ok) return null;
|
|
147
152
|
return (await response.json()) as PluginManifest;
|
|
148
153
|
} catch {
|
package/src/plugin.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { buildRuntimeConfig, detectLocalPackages, prepareDevelopmentRuntimeConfi
|
|
|
7
7
|
import { ensureEnvFile, writeGeneratedInfra } from "./cli/infra";
|
|
8
8
|
import {
|
|
9
9
|
copyFilteredFiles,
|
|
10
|
+
detectGitRemoteUrl,
|
|
10
11
|
fetchParentConfig,
|
|
11
12
|
generateDatabaseMigrations,
|
|
12
13
|
personalizeConfig,
|
|
@@ -35,6 +36,7 @@ import {
|
|
|
35
36
|
import {
|
|
36
37
|
type BosConfigResult,
|
|
37
38
|
bosContract,
|
|
39
|
+
type OverrideSection,
|
|
38
40
|
type PhaseTiming,
|
|
39
41
|
type PluginListResult,
|
|
40
42
|
} from "./contract";
|
|
@@ -1196,7 +1198,7 @@ export default createPlugin({
|
|
|
1196
1198
|
let directory = input.directory;
|
|
1197
1199
|
let account = input.account;
|
|
1198
1200
|
let domain = input.domain;
|
|
1199
|
-
let
|
|
1201
|
+
let overrides = input.overrides as OverrideSection[] | undefined;
|
|
1200
1202
|
let plugins = input.plugins;
|
|
1201
1203
|
|
|
1202
1204
|
if (input.extends) {
|
|
@@ -1238,7 +1240,7 @@ export default createPlugin({
|
|
|
1238
1240
|
account,
|
|
1239
1241
|
domain,
|
|
1240
1242
|
plugins,
|
|
1241
|
-
|
|
1243
|
+
overrides,
|
|
1242
1244
|
parentPluginKeys,
|
|
1243
1245
|
});
|
|
1244
1246
|
extendsAccount = prompted.extendsAccount;
|
|
@@ -1246,16 +1248,29 @@ export default createPlugin({
|
|
|
1246
1248
|
directory = prompted.directory;
|
|
1247
1249
|
account = prompted.account;
|
|
1248
1250
|
domain = prompted.domain;
|
|
1249
|
-
withHost = prompted.withHost;
|
|
1250
1251
|
plugins = prompted.plugins;
|
|
1252
|
+
overrides = prompted.overrides;
|
|
1251
1253
|
s.start("Setting up project");
|
|
1252
1254
|
}
|
|
1253
1255
|
|
|
1256
|
+
overrides = overrides?.length ? overrides : (["ui", "api"] as OverrideSection[]);
|
|
1257
|
+
if (overrides.includes("plugins") && !plugins?.length) {
|
|
1258
|
+
plugins = parentPluginKeys;
|
|
1259
|
+
}
|
|
1260
|
+
plugins = plugins ?? [];
|
|
1261
|
+
|
|
1254
1262
|
directory = directory || domain || extendsGateway;
|
|
1255
1263
|
const targetDir = resolve(directory);
|
|
1256
|
-
plugins = plugins ?? [];
|
|
1257
1264
|
const extendsRef = `bos://${extendsAccount}/${extendsGateway}`;
|
|
1258
1265
|
|
|
1266
|
+
if (overrides.includes("plugins") && !plugins.length) {
|
|
1267
|
+
// explicitly selected plugins override with none selected — back out of all inherited plugins
|
|
1268
|
+
}
|
|
1269
|
+
|
|
1270
|
+
const repository =
|
|
1271
|
+
(await detectGitRemoteUrl(process.cwd()).catch(() => undefined)) ??
|
|
1272
|
+
parentConfig?.repository;
|
|
1273
|
+
|
|
1259
1274
|
if (!parentConfig) {
|
|
1260
1275
|
try {
|
|
1261
1276
|
parentConfig = await timePhase(
|
|
@@ -1273,7 +1288,8 @@ export default createPlugin({
|
|
|
1273
1288
|
account,
|
|
1274
1289
|
domain,
|
|
1275
1290
|
extends: extendsRef,
|
|
1276
|
-
plugins
|
|
1291
|
+
plugins,
|
|
1292
|
+
overrides,
|
|
1277
1293
|
filesCopied: 0,
|
|
1278
1294
|
timings,
|
|
1279
1295
|
error: `No config found at ${extendsRef} — are you sure this is the right parent?`,
|
|
@@ -1315,7 +1331,25 @@ export default createPlugin({
|
|
|
1315
1331
|
account: account || extendsAccount,
|
|
1316
1332
|
domain,
|
|
1317
1333
|
plugins,
|
|
1318
|
-
|
|
1334
|
+
overrides,
|
|
1335
|
+
repository,
|
|
1336
|
+
}),
|
|
1337
|
+
s,
|
|
1338
|
+
);
|
|
1339
|
+
|
|
1340
|
+
await timePhase(
|
|
1341
|
+
timings,
|
|
1342
|
+
"personalize config",
|
|
1343
|
+
() =>
|
|
1344
|
+
personalizeConfig(targetDir, {
|
|
1345
|
+
extendsAccount,
|
|
1346
|
+
extendsGateway,
|
|
1347
|
+
account: account || extendsAccount,
|
|
1348
|
+
domain: domain || extendsGateway,
|
|
1349
|
+
plugins,
|
|
1350
|
+
overrides,
|
|
1351
|
+
mode: "init",
|
|
1352
|
+
repository,
|
|
1319
1353
|
}),
|
|
1320
1354
|
s,
|
|
1321
1355
|
);
|
|
@@ -1330,21 +1364,24 @@ export default createPlugin({
|
|
|
1330
1364
|
account,
|
|
1331
1365
|
domain,
|
|
1332
1366
|
extends: extendsRef,
|
|
1333
|
-
plugins
|
|
1367
|
+
plugins,
|
|
1368
|
+
overrides,
|
|
1334
1369
|
filesCopied: 0,
|
|
1335
1370
|
error: "No .templatekeep found in template source",
|
|
1336
1371
|
};
|
|
1337
1372
|
}
|
|
1338
1373
|
|
|
1339
1374
|
const pluginRoutes: Record<string, string[]> = {};
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1375
|
+
if (overrides.includes("plugins")) {
|
|
1376
|
+
const parentRuntimePlugins = await buildRuntimePluginsForConfig(
|
|
1377
|
+
parentConfig as BosConfig,
|
|
1378
|
+
sourceDir,
|
|
1379
|
+
"production",
|
|
1380
|
+
);
|
|
1381
|
+
for (const [key, plugin] of Object.entries(parentRuntimePlugins ?? {})) {
|
|
1382
|
+
if (plugin.routes && plugin.routes.length > 0) {
|
|
1383
|
+
pluginRoutes[key] = plugin.routes;
|
|
1384
|
+
}
|
|
1348
1385
|
}
|
|
1349
1386
|
}
|
|
1350
1387
|
|
|
@@ -1353,7 +1390,7 @@ export default createPlugin({
|
|
|
1353
1390
|
"copy files",
|
|
1354
1391
|
() =>
|
|
1355
1392
|
copyFilteredFiles(sourceDir, targetDir, patterns, {
|
|
1356
|
-
|
|
1393
|
+
overrides,
|
|
1357
1394
|
plugins,
|
|
1358
1395
|
pluginRoutes,
|
|
1359
1396
|
}),
|
|
@@ -1370,9 +1407,10 @@ export default createPlugin({
|
|
|
1370
1407
|
account: account || extendsAccount,
|
|
1371
1408
|
domain: domain || extendsGateway,
|
|
1372
1409
|
plugins,
|
|
1410
|
+
overrides,
|
|
1373
1411
|
pluginRoutes,
|
|
1374
1412
|
workspaceOpts: { sourceDir },
|
|
1375
|
-
|
|
1413
|
+
repository,
|
|
1376
1414
|
}),
|
|
1377
1415
|
s,
|
|
1378
1416
|
);
|
|
@@ -1382,7 +1420,7 @@ export default createPlugin({
|
|
|
1382
1420
|
"write snapshot",
|
|
1383
1421
|
() =>
|
|
1384
1422
|
writeInitSnapshot(targetDir, extendsAccount, extendsGateway, sourceDir, patterns, {
|
|
1385
|
-
|
|
1423
|
+
overrides,
|
|
1386
1424
|
plugins,
|
|
1387
1425
|
pluginRoutes,
|
|
1388
1426
|
}),
|
|
@@ -1466,6 +1504,7 @@ export default createPlugin({
|
|
|
1466
1504
|
domain,
|
|
1467
1505
|
extends: extendsRef,
|
|
1468
1506
|
plugins,
|
|
1507
|
+
overrides,
|
|
1469
1508
|
filesCopied,
|
|
1470
1509
|
timings,
|
|
1471
1510
|
};
|
|
@@ -1486,6 +1525,7 @@ export default createPlugin({
|
|
|
1486
1525
|
domain: input.domain,
|
|
1487
1526
|
extends: extendsRef,
|
|
1488
1527
|
plugins: input.plugins ?? [],
|
|
1528
|
+
overrides: input.overrides,
|
|
1489
1529
|
filesCopied: 0,
|
|
1490
1530
|
timings: [],
|
|
1491
1531
|
error: error instanceof Error ? error.message : "Unknown error",
|