everything-dev 0.0.18 → 0.0.19
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/package.json +1 -1
- package/src/cli.ts +15 -1
- package/src/plugin.ts +44 -7
package/package.json
CHANGED
package/src/cli.ts
CHANGED
|
@@ -747,7 +747,8 @@ Zephyr Configuration:
|
|
|
747
747
|
.option("--gateway <gateway>", "Gateway domain to sync from (default: everything.dev)")
|
|
748
748
|
.option("--network <network>", "Network: mainnet | testnet", "mainnet")
|
|
749
749
|
.option("--force", "Force sync even if versions match")
|
|
750
|
-
.
|
|
750
|
+
.option("--files", "Also sync template files (tsconfig, etc.)")
|
|
751
|
+
.action(async (options: { account?: string; gateway?: string; network?: string; force?: boolean; files?: boolean }) => {
|
|
751
752
|
console.log();
|
|
752
753
|
const source = options.account || options.gateway
|
|
753
754
|
? `${options.account || "every.near"}/${options.gateway || "everything.dev"}`
|
|
@@ -759,6 +760,7 @@ Zephyr Configuration:
|
|
|
759
760
|
gateway: options.gateway,
|
|
760
761
|
network: (options.network as "mainnet" | "testnet") || "mainnet",
|
|
761
762
|
force: options.force || false,
|
|
763
|
+
files: options.files || false,
|
|
762
764
|
});
|
|
763
765
|
|
|
764
766
|
if (result.status === "error") {
|
|
@@ -782,6 +784,18 @@ Zephyr Configuration:
|
|
|
782
784
|
if (result.packagesUpdated.length > 0) {
|
|
783
785
|
console.log(colors.green(` ${icons.ok} Updated packages: ${result.packagesUpdated.join(", ")}`));
|
|
784
786
|
}
|
|
787
|
+
|
|
788
|
+
if (result.filesSynced && result.filesSynced.length > 0) {
|
|
789
|
+
const totalFiles = result.filesSynced.reduce((sum, pkg) => sum + pkg.files.length, 0);
|
|
790
|
+
console.log(colors.green(` ${icons.ok} Synced ${totalFiles} files`));
|
|
791
|
+
for (const pkg of result.filesSynced) {
|
|
792
|
+
console.log(colors.dim(` ${pkg.package}: ${pkg.files.join(", ")}`));
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
if (!result.catalogUpdated && result.packagesUpdated.length === 0 && (!result.filesSynced || result.filesSynced.length === 0)) {
|
|
797
|
+
console.log(colors.dim(` ${icons.ok} Already up to date`));
|
|
798
|
+
}
|
|
785
799
|
|
|
786
800
|
console.log();
|
|
787
801
|
console.log(colors.dim(" Run 'bun install' to update lockfile"));
|
package/src/plugin.ts
CHANGED
|
@@ -1247,7 +1247,7 @@ export default createPlugin({
|
|
|
1247
1247
|
const graph = new Graph();
|
|
1248
1248
|
const configPath = `${account}/bos/gateways/${gateway}/bos.config.json`;
|
|
1249
1249
|
|
|
1250
|
-
let remoteConfig:
|
|
1250
|
+
let remoteConfig: BosConfigType | null = null;
|
|
1251
1251
|
|
|
1252
1252
|
const data = await graph.get({ keys: [configPath] });
|
|
1253
1253
|
if (data) {
|
|
@@ -1262,7 +1262,7 @@ export default createPlugin({
|
|
|
1262
1262
|
}
|
|
1263
1263
|
}
|
|
1264
1264
|
if (typeof current === "string") {
|
|
1265
|
-
remoteConfig = JSON.parse(current);
|
|
1265
|
+
remoteConfig = JSON.parse(current) as BosConfigType;
|
|
1266
1266
|
}
|
|
1267
1267
|
}
|
|
1268
1268
|
|
|
@@ -1291,13 +1291,50 @@ export default createPlugin({
|
|
|
1291
1291
|
};
|
|
1292
1292
|
}
|
|
1293
1293
|
|
|
1294
|
+
const mergeAppConfig = (localApp: Record<string, unknown>, remoteApp: Record<string, unknown>): Record<string, unknown> => {
|
|
1295
|
+
const merged: Record<string, unknown> = {};
|
|
1296
|
+
|
|
1297
|
+
for (const key of Object.keys(remoteApp)) {
|
|
1298
|
+
const local = localApp[key] as Record<string, unknown> | undefined;
|
|
1299
|
+
const remote = remoteApp[key] as Record<string, unknown>;
|
|
1300
|
+
|
|
1301
|
+
if (!local) {
|
|
1302
|
+
merged[key] = remote;
|
|
1303
|
+
continue;
|
|
1304
|
+
}
|
|
1305
|
+
|
|
1306
|
+
merged[key] = {
|
|
1307
|
+
...remote,
|
|
1308
|
+
development: local.development,
|
|
1309
|
+
secrets: [...new Set([
|
|
1310
|
+
...((remote.secrets as string[]) || []),
|
|
1311
|
+
...((local.secrets as string[]) || []),
|
|
1312
|
+
])],
|
|
1313
|
+
variables: {
|
|
1314
|
+
...((remote.variables as Record<string, unknown>) || {}),
|
|
1315
|
+
...((local.variables as Record<string, unknown>) || {}),
|
|
1316
|
+
},
|
|
1317
|
+
};
|
|
1318
|
+
}
|
|
1319
|
+
|
|
1320
|
+
return merged;
|
|
1321
|
+
};
|
|
1294
1322
|
|
|
1323
|
+
const updatedBosConfig: BosConfigType = {
|
|
1324
|
+
account: bosConfig.account,
|
|
1325
|
+
testnet: bosConfig.testnet,
|
|
1326
|
+
template: remoteConfig.template,
|
|
1327
|
+
shared: remoteConfig.shared,
|
|
1328
|
+
gateway: remoteConfig.gateway,
|
|
1329
|
+
app: mergeAppConfig(
|
|
1330
|
+
bosConfig.app as Record<string, unknown>,
|
|
1331
|
+
remoteConfig.app as Record<string, unknown>
|
|
1332
|
+
) as BosConfigType["app"],
|
|
1333
|
+
};
|
|
1295
1334
|
|
|
1296
1335
|
const bosConfigPath = `${configDir}/bos.config.json`;
|
|
1297
|
-
const updatedBosConfig = {
|
|
1298
|
-
...bosConfig,
|
|
1299
|
-
};
|
|
1300
1336
|
await Bun.write(bosConfigPath, JSON.stringify(updatedBosConfig, null, 2));
|
|
1337
|
+
setConfig(updatedBosConfig, configDir);
|
|
1301
1338
|
|
|
1302
1339
|
const sharedUiDeps: Record<string, string> = {};
|
|
1303
1340
|
const sharedUi = updatedBosConfig.shared?.ui as Record<string, { requiredVersion?: string }> | undefined;
|
|
@@ -1361,8 +1398,8 @@ export default createPlugin({
|
|
|
1361
1398
|
if (input.files) {
|
|
1362
1399
|
const results = await syncFiles({
|
|
1363
1400
|
configDir,
|
|
1364
|
-
packages: Object.keys(
|
|
1365
|
-
bosConfig,
|
|
1401
|
+
packages: Object.keys(updatedBosConfig.app),
|
|
1402
|
+
bosConfig: updatedBosConfig,
|
|
1366
1403
|
catalog: rootPkg.workspaces?.catalog ?? {},
|
|
1367
1404
|
force: input.force,
|
|
1368
1405
|
});
|