everything-dev 1.4.1 → 1.6.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 +78 -8
- package/dist/cli/init.cjs.map +1 -1
- package/dist/cli/init.d.cts +6 -0
- package/dist/cli/init.d.cts.map +1 -1
- package/dist/cli/init.d.mts +6 -0
- package/dist/cli/init.d.mts.map +1 -1
- package/dist/cli/init.mjs +78 -8
- package/dist/cli/init.mjs.map +1 -1
- package/dist/cli/prompts.cjs +64 -6
- package/dist/cli/prompts.cjs.map +1 -1
- package/dist/cli/prompts.mjs +64 -6
- package/dist/cli/prompts.mjs.map +1 -1
- package/dist/cli/sync.cjs +85 -18
- package/dist/cli/sync.cjs.map +1 -1
- package/dist/cli/sync.mjs +85 -18
- package/dist/cli/sync.mjs.map +1 -1
- package/dist/cli.cjs +41 -4
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.mjs +41 -4
- package/dist/cli.mjs.map +1 -1
- package/dist/contract.cjs +3 -0
- package/dist/contract.cjs.map +1 -1
- package/dist/contract.d.cts +14 -6
- package/dist/contract.d.cts.map +1 -1
- package/dist/contract.d.mts +14 -6
- package/dist/contract.d.mts.map +1 -1
- package/dist/contract.mjs +3 -0
- package/dist/contract.mjs.map +1 -1
- package/dist/plugin.cjs +48 -17
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.d.cts +9 -4
- package/dist/plugin.d.mts +9 -4
- package/dist/plugin.mjs +48 -17
- package/dist/plugin.mjs.map +1 -1
- package/dist/types.cjs +2 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +4 -2
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +4 -2
- package/dist/types.d.mts.map +1 -1
- package/dist/types.mjs +2 -1
- package/dist/types.mjs.map +1 -1
- package/package.json +2 -2
- package/src/cli/init.ts +122 -7
- package/src/cli/prompts.ts +84 -10
- package/src/cli/sync.ts +142 -17
- package/src/cli.ts +55 -4
- package/src/contract.ts +3 -0
- package/src/plugin.ts +51 -18
- package/src/types.ts +1 -0
package/src/contract.ts
CHANGED
|
@@ -134,12 +134,14 @@ export const KeyPublishResultSchema = z.object({
|
|
|
134
134
|
});
|
|
135
135
|
|
|
136
136
|
export const InitOptionsSchema = z.object({
|
|
137
|
+
extends: z.string().optional(),
|
|
137
138
|
extendsAccount: z.string().optional(),
|
|
138
139
|
extendsGateway: z.string().optional(),
|
|
139
140
|
directory: z.string().optional(),
|
|
140
141
|
account: z.string().optional(),
|
|
141
142
|
domain: z.string().optional(),
|
|
142
143
|
source: z.string().optional(),
|
|
144
|
+
plugins: z.array(z.string()).optional(),
|
|
143
145
|
withHost: z.boolean().default(false),
|
|
144
146
|
noInteractive: z.boolean().default(false),
|
|
145
147
|
noInstall: z.boolean().default(false),
|
|
@@ -153,6 +155,7 @@ export const InitResultSchema = z.object({
|
|
|
153
155
|
account: z.string().optional(),
|
|
154
156
|
domain: z.string().optional(),
|
|
155
157
|
extends: z.string(),
|
|
158
|
+
plugins: z.array(z.string()).optional(),
|
|
156
159
|
filesCopied: z.number(),
|
|
157
160
|
error: z.string().optional(),
|
|
158
161
|
});
|
package/src/plugin.ts
CHANGED
|
@@ -1076,30 +1076,25 @@ export default createPlugin({
|
|
|
1076
1076
|
let account = input.account;
|
|
1077
1077
|
let domain = input.domain;
|
|
1078
1078
|
let withHost = input.withHost;
|
|
1079
|
+
let plugins = input.plugins;
|
|
1079
1080
|
|
|
1080
|
-
if (
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
extendsAccount: extendsAccount ?? "",
|
|
1086
|
-
extendsGateway: extendsGateway ?? "",
|
|
1087
|
-
account: input.account,
|
|
1088
|
-
domain: input.domain,
|
|
1089
|
-
extends:
|
|
1090
|
-
extendsAccount && extendsGateway ? `bos://${extendsAccount}/${extendsGateway}` : "",
|
|
1091
|
-
filesCopied: 0,
|
|
1092
|
-
error:
|
|
1093
|
-
"domain is required (use --no-interactive to skip prompts and provide it as a flag)",
|
|
1094
|
-
};
|
|
1081
|
+
if (input.extends) {
|
|
1082
|
+
const match = input.extends.match(/^(?:bos:\/\/)?([^/]+)\/(.+)$/);
|
|
1083
|
+
if (match) {
|
|
1084
|
+
if (!extendsAccount) extendsAccount = match[1];
|
|
1085
|
+
if (!extendsGateway) extendsGateway = match[2];
|
|
1095
1086
|
}
|
|
1087
|
+
}
|
|
1096
1088
|
|
|
1089
|
+
if (!input.noInteractive && (!domain || !plugins)) {
|
|
1097
1090
|
const prompted = await promptInitOptions({
|
|
1098
1091
|
extendsAccount,
|
|
1099
1092
|
extendsGateway,
|
|
1093
|
+
extends: input.extends,
|
|
1100
1094
|
directory,
|
|
1101
1095
|
account,
|
|
1102
1096
|
domain,
|
|
1097
|
+
plugins,
|
|
1103
1098
|
withHost,
|
|
1104
1099
|
});
|
|
1105
1100
|
extendsAccount = prompted.extendsAccount;
|
|
@@ -1108,11 +1103,30 @@ export default createPlugin({
|
|
|
1108
1103
|
account = prompted.account;
|
|
1109
1104
|
domain = prompted.domain;
|
|
1110
1105
|
withHost = prompted.withHost;
|
|
1106
|
+
plugins = prompted.plugins;
|
|
1107
|
+
}
|
|
1108
|
+
|
|
1109
|
+
if (!domain) {
|
|
1110
|
+
return {
|
|
1111
|
+
status: "error" as const,
|
|
1112
|
+
directory: "",
|
|
1113
|
+
extendsAccount: extendsAccount ?? "",
|
|
1114
|
+
extendsGateway: extendsGateway ?? "",
|
|
1115
|
+
account: input.account,
|
|
1116
|
+
domain: input.domain,
|
|
1117
|
+
extends:
|
|
1118
|
+
extendsAccount && extendsGateway ? `bos://${extendsAccount}/${extendsGateway}` : "",
|
|
1119
|
+
plugins: plugins ?? [],
|
|
1120
|
+
filesCopied: 0,
|
|
1121
|
+
error:
|
|
1122
|
+
"domain is required (use --no-interactive to skip prompts and provide it as a flag)",
|
|
1123
|
+
};
|
|
1111
1124
|
}
|
|
1112
1125
|
|
|
1113
1126
|
extendsAccount = extendsAccount || "dev.everything.near";
|
|
1114
1127
|
extendsGateway = extendsGateway || "everything.dev";
|
|
1115
|
-
directory = directory ||
|
|
1128
|
+
directory = directory || domain || extendsGateway;
|
|
1129
|
+
plugins = plugins?.length ? plugins : ["_template"];
|
|
1116
1130
|
|
|
1117
1131
|
try {
|
|
1118
1132
|
await fetchParentConfig(extendsAccount, extendsGateway);
|
|
@@ -1125,12 +1139,13 @@ export default createPlugin({
|
|
|
1125
1139
|
account,
|
|
1126
1140
|
domain,
|
|
1127
1141
|
extends: `bos://${extendsAccount}/${extendsGateway}`,
|
|
1142
|
+
plugins: plugins ?? [],
|
|
1128
1143
|
filesCopied: 0,
|
|
1129
1144
|
error: `No config found at bos://${extendsAccount}/${extendsGateway} — are you sure this is the right parent?`,
|
|
1130
1145
|
};
|
|
1131
1146
|
}
|
|
1132
1147
|
|
|
1133
|
-
const { sourceDir, cleanup } = await resolveSourceDir({
|
|
1148
|
+
const { sourceDir, parentConfig, cleanup } = await resolveSourceDir({
|
|
1134
1149
|
extendsAccount,
|
|
1135
1150
|
extendsGateway,
|
|
1136
1151
|
source: input.source,
|
|
@@ -1147,13 +1162,25 @@ export default createPlugin({
|
|
|
1147
1162
|
account,
|
|
1148
1163
|
domain,
|
|
1149
1164
|
extends: `bos://${extendsAccount}/${extendsGateway}`,
|
|
1165
|
+
plugins: plugins ?? [],
|
|
1150
1166
|
filesCopied: 0,
|
|
1151
1167
|
error: "No .templatekeep found in template source",
|
|
1152
1168
|
};
|
|
1153
1169
|
}
|
|
1154
1170
|
|
|
1171
|
+
const pluginRoutes: Record<string, string[]> = {};
|
|
1172
|
+
if (parentConfig.plugins) {
|
|
1173
|
+
for (const [key, ref] of Object.entries(parentConfig.plugins)) {
|
|
1174
|
+
if (ref.routes && ref.routes.length > 0) {
|
|
1175
|
+
pluginRoutes[key] = ref.routes;
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1155
1180
|
const filesCopied = await copyFilteredFiles(sourceDir, directory, patterns, {
|
|
1156
1181
|
withHost,
|
|
1182
|
+
plugins,
|
|
1183
|
+
pluginRoutes,
|
|
1157
1184
|
});
|
|
1158
1185
|
|
|
1159
1186
|
await personalizeConfig(directory, {
|
|
@@ -1161,11 +1188,15 @@ export default createPlugin({
|
|
|
1161
1188
|
extendsGateway,
|
|
1162
1189
|
account: account || extendsAccount,
|
|
1163
1190
|
domain: domain || extendsGateway,
|
|
1191
|
+
plugins,
|
|
1192
|
+
pluginRoutes,
|
|
1164
1193
|
workspaceOpts: { sourceDir },
|
|
1165
1194
|
});
|
|
1166
1195
|
|
|
1167
1196
|
await writeInitSnapshot(directory, extendsAccount, extendsGateway, sourceDir, patterns, {
|
|
1168
1197
|
withHost,
|
|
1198
|
+
plugins,
|
|
1199
|
+
pluginRoutes,
|
|
1169
1200
|
});
|
|
1170
1201
|
|
|
1171
1202
|
if (!input.noInstall) {
|
|
@@ -1174,12 +1205,13 @@ export default createPlugin({
|
|
|
1174
1205
|
|
|
1175
1206
|
return {
|
|
1176
1207
|
status: "initialized" as const,
|
|
1177
|
-
directory
|
|
1208
|
+
directory,
|
|
1178
1209
|
extendsAccount,
|
|
1179
1210
|
extendsGateway,
|
|
1180
1211
|
account,
|
|
1181
1212
|
domain,
|
|
1182
1213
|
extends: `bos://${extendsAccount}/${extendsGateway}`,
|
|
1214
|
+
plugins,
|
|
1183
1215
|
filesCopied,
|
|
1184
1216
|
};
|
|
1185
1217
|
} finally {
|
|
@@ -1197,6 +1229,7 @@ export default createPlugin({
|
|
|
1197
1229
|
input.extendsAccount && input.extendsGateway
|
|
1198
1230
|
? `bos://${input.extendsAccount}/${input.extendsGateway}`
|
|
1199
1231
|
: "",
|
|
1232
|
+
plugins: input.plugins ?? [],
|
|
1200
1233
|
filesCopied: 0,
|
|
1201
1234
|
error: error instanceof Error ? error.message : "Unknown error",
|
|
1202
1235
|
};
|
package/src/types.ts
CHANGED
|
@@ -43,6 +43,7 @@ export const BosPluginRefSchema = z.object({
|
|
|
43
43
|
proxy: z.string().optional(),
|
|
44
44
|
variables: z.record(z.string(), z.string()).optional(),
|
|
45
45
|
secrets: z.array(z.string()).optional(),
|
|
46
|
+
routes: z.array(z.string()).optional(),
|
|
46
47
|
});
|
|
47
48
|
export type BosPluginRef = z.infer<typeof BosPluginRefSchema>;
|
|
48
49
|
|