@absolutejs/absolute 0.13.5 → 0.13.6

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.
Files changed (2) hide show
  1. package/dist/cli/index.js +25 -8
  2. package/package.json +1 -1
package/dist/cli/index.js CHANGED
@@ -2,6 +2,7 @@
2
2
  // @bun
3
3
 
4
4
  // src/cli/index.ts
5
+ var {$ } = globalThis.Bun;
5
6
  import { existsSync } from "fs";
6
7
  import { resolve } from "path";
7
8
  var COMPOSE_PATH = "db/docker-compose.db.yml";
@@ -17,20 +18,36 @@ var readDbScripts = async () => {
17
18
  return null;
18
19
  return { upCommand, downCommand };
19
20
  };
21
+ var timed = async (label, fn) => {
22
+ process.stdout.write(label);
23
+ const start = performance.now();
24
+ await fn();
25
+ const duration = ((performance.now() - start) / 1000).toFixed(2);
26
+ process.stdout.write(` \x1B[90m${duration}s\x1B[0m
27
+ `);
28
+ };
20
29
  var startDatabase = async (scripts) => {
21
- console.log("Starting database container...");
22
- const { exitCode } = await Bun.$`${{ raw: scripts.upCommand }}`.nothrow();
23
- if (exitCode !== 0)
24
- process.exit(exitCode);
30
+ await timed("Starting database container...", async () => {
31
+ const { exitCode } = await $`${{ raw: scripts.upCommand }}`.quiet().nothrow();
32
+ if (exitCode !== 0)
33
+ process.exit(exitCode);
34
+ });
25
35
  };
26
36
  var stopDatabase = async (scripts) => {
27
- console.log(`
28
- Stopping database container...`);
29
- await Bun.$`${{ raw: scripts.downCommand }}`.quiet().nothrow();
37
+ process.stdout.write(`
38
+ `);
39
+ await timed("Stopping database container...", async () => {
40
+ await $`${{ raw: scripts.downCommand }}`.quiet().nothrow();
41
+ });
30
42
  };
31
43
  var dev = async (serverEntry) => {
32
44
  const usesDocker = existsSync(resolve(COMPOSE_PATH));
33
- const scripts = usesDocker ? await readDbScripts() : null;
45
+ let scripts = null;
46
+ if (usesDocker) {
47
+ await timed("Reading db scripts...", async () => {
48
+ scripts = await readDbScripts();
49
+ });
50
+ }
34
51
  if (scripts)
35
52
  await startDatabase(scripts);
36
53
  const server = Bun.spawn(["bun", "--watch", serverEntry], {
package/package.json CHANGED
@@ -55,5 +55,5 @@
55
55
  "typecheck": "bun run tsc --noEmit"
56
56
  },
57
57
  "types": "./dist/index.d.ts",
58
- "version": "0.13.5"
58
+ "version": "0.13.6"
59
59
  }