everything-dev 0.0.19 → 0.0.20
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 +7 -2
- package/src/lib/sync.ts +8 -5
- package/src/plugin.ts +5 -3
package/package.json
CHANGED
package/src/cli.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
+
import { spinner } from "@clack/prompts";
|
|
2
3
|
import { program } from "commander";
|
|
3
4
|
import { createPluginRuntime } from "every-plugin";
|
|
4
5
|
import { getConfigDir, getConfigPath, getPackages, getTitle, loadConfig, type BosConfig } from "./config";
|
|
@@ -753,7 +754,9 @@ Zephyr Configuration:
|
|
|
753
754
|
const source = options.account || options.gateway
|
|
754
755
|
? `${options.account || "every.near"}/${options.gateway || "everything.dev"}`
|
|
755
756
|
: "every.near/everything.dev";
|
|
756
|
-
|
|
757
|
+
|
|
758
|
+
const s = spinner();
|
|
759
|
+
s.start(`Syncing from ${source}...`);
|
|
757
760
|
|
|
758
761
|
const result = await client.sync({
|
|
759
762
|
account: options.account,
|
|
@@ -764,10 +767,12 @@ Zephyr Configuration:
|
|
|
764
767
|
});
|
|
765
768
|
|
|
766
769
|
if (result.status === "error") {
|
|
767
|
-
|
|
770
|
+
s.stop(colors.error(`${icons.err} Sync failed: ${result.error || "Unknown error"}`));
|
|
768
771
|
process.exit(1);
|
|
769
772
|
}
|
|
770
773
|
|
|
774
|
+
s.stop(colors.green(`${icons.ok} Synced from ${source}`));
|
|
775
|
+
|
|
771
776
|
console.log();
|
|
772
777
|
console.log(colors.cyan(frames.top(52)));
|
|
773
778
|
console.log(` ${icons.ok} ${gradients.cyber("SYNCED")}`);
|
package/src/lib/sync.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { mkdtemp, rm, cp, mkdir } from "fs/promises";
|
|
2
|
-
import { tmpdir } from "os";
|
|
3
|
-
import { join, dirname } from "path";
|
|
4
1
|
import { execa } from "execa";
|
|
2
|
+
import { cp, mkdir, mkdtemp, rm } from "fs/promises";
|
|
3
|
+
import { tmpdir } from "os";
|
|
4
|
+
import { dirname, join } from "path";
|
|
5
5
|
import type { BosConfig } from "../config";
|
|
6
6
|
|
|
7
7
|
export interface FileSyncResult {
|
|
@@ -24,6 +24,10 @@ export async function syncFiles(options: FileSyncOptions): Promise<FileSyncResul
|
|
|
24
24
|
const results: FileSyncResult[] = [];
|
|
25
25
|
|
|
26
26
|
for (const pkg of packages) {
|
|
27
|
+
const pkgDir = `${configDir}/${pkg}`;
|
|
28
|
+
const pkgDirExists = await Bun.file(`${pkgDir}/package.json`).exists();
|
|
29
|
+
if (!pkgDirExists) continue;
|
|
30
|
+
|
|
27
31
|
const appConfig = bosConfig.app[pkg] as {
|
|
28
32
|
template?: string;
|
|
29
33
|
files?: string[];
|
|
@@ -44,7 +48,6 @@ export async function syncFiles(options: FileSyncOptions): Promise<FileSyncResul
|
|
|
44
48
|
const filesSynced: string[] = [];
|
|
45
49
|
const depsAdded: string[] = [];
|
|
46
50
|
const depsUpdated: string[] = [];
|
|
47
|
-
const pkgDir = `${configDir}/${pkg}`;
|
|
48
51
|
|
|
49
52
|
for (const file of appConfig.files) {
|
|
50
53
|
const srcPath = join(tempDir, file);
|
|
@@ -53,7 +56,7 @@ export async function syncFiles(options: FileSyncOptions): Promise<FileSyncResul
|
|
|
53
56
|
try {
|
|
54
57
|
const destDir = dirname(destPath);
|
|
55
58
|
await mkdir(destDir, { recursive: true });
|
|
56
|
-
await cp(srcPath, destPath, { force, recursive: true });
|
|
59
|
+
await cp(srcPath, destPath, { force: true, recursive: true });
|
|
57
60
|
filesSynced.push(file);
|
|
58
61
|
} catch {
|
|
59
62
|
}
|
package/src/plugin.ts
CHANGED
|
@@ -1362,10 +1362,12 @@ export default createPlugin({
|
|
|
1362
1362
|
const packagesUpdated: string[] = [];
|
|
1363
1363
|
|
|
1364
1364
|
for (const pkg of packages) {
|
|
1365
|
-
const
|
|
1366
|
-
const
|
|
1365
|
+
const pkgDir = `${configDir}/${pkg}`;
|
|
1366
|
+
const pkgDirExists = await Bun.file(`${pkgDir}/package.json`).exists();
|
|
1367
|
+
if (!pkgDirExists) continue;
|
|
1367
1368
|
|
|
1368
|
-
|
|
1369
|
+
const pkgPath = `${pkgDir}/package.json`;
|
|
1370
|
+
const pkgFile = Bun.file(pkgPath);
|
|
1369
1371
|
|
|
1370
1372
|
const pkgJson = await pkgFile.json() as {
|
|
1371
1373
|
dependencies?: Record<string, string>;
|