create-mikstack 0.1.5 → 0.1.7

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/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  import * as p from "@clack/prompts";
3
+ import { execSync } from "node:child_process";
3
4
  import path from "node:path";
4
5
  import { parseArgs } from "node:util";
5
- import { execSync } from "node:child_process";
6
6
  import fs from "node:fs";
7
7
 
8
8
  //#region src/config.ts
@@ -41,39 +41,6 @@ function pmLockfile(pm) {
41
41
  return "bun.lock";
42
42
  }
43
43
 
44
- //#endregion
45
- //#region src/post-scaffold.ts
46
- function postScaffold(targetDir, packageManager, s) {
47
- const cwd = path.resolve(process.cwd(), targetDir);
48
- const run = (cmd) => execSync(cmd, {
49
- cwd,
50
- stdio: "pipe"
51
- });
52
- s.message("Installing dependencies...");
53
- try {
54
- run(`${packageManager} install`);
55
- s.stop("Dependencies installed.");
56
- } catch {
57
- s.stop("Failed to install dependencies. You can run install manually.");
58
- }
59
- s.start("Formatting project...");
60
- try {
61
- run(`${packageManager} run format`);
62
- s.stop("Project formatted.");
63
- } catch {
64
- s.stop("Formatting skipped.");
65
- }
66
- s.start("Initializing git repository...");
67
- try {
68
- run("git init");
69
- run("git add .");
70
- run("git commit -m \"the future is now\"");
71
- s.stop("Git repository initialized.");
72
- } catch {
73
- s.stop("Failed to initialize git. You can run git init manually.");
74
- }
75
- }
76
-
77
44
  //#endregion
78
45
  //#region src/prompts.ts
79
46
  function isCancel(value) {
@@ -384,21 +351,51 @@ async function cli() {
384
351
  p.intro("create-mikstack");
385
352
  p.log.info(`Scaffolding ${config.projectName} with recommended defaults (non-interactive)...`);
386
353
  } else config = await runPrompts(projectName, packageManager);
387
- const s = p.spinner();
388
- s.start("Running sv create...");
389
- try {
390
- scaffold(config, (msg) => s.message(msg));
391
- } catch (err) {
392
- s.stop("Scaffolding failed.");
393
- p.log.error(err instanceof Error ? err.message : String(err));
394
- process.exit(1);
395
- }
396
- postScaffold(config.targetDir, config.packageManager, s);
397
- const run = pmRun(config.packageManager);
354
+ const cwd = path.resolve(process.cwd(), config.targetDir);
355
+ const run = (cmd) => execSync(cmd, {
356
+ cwd,
357
+ stdio: "pipe"
358
+ });
359
+ await p.tasks([
360
+ {
361
+ title: "Scaffolding project",
362
+ task: async (message) => {
363
+ message("Running sv create...");
364
+ scaffold(config, message);
365
+ return "Project scaffolded";
366
+ }
367
+ },
368
+ {
369
+ title: "Installing dependencies",
370
+ task: async () => {
371
+ run(`${packageManager} install`);
372
+ return "Dependencies installed";
373
+ }
374
+ },
375
+ {
376
+ title: "Formatting project",
377
+ task: async () => {
378
+ try {
379
+ run(`${packageManager} run format`);
380
+ } catch {}
381
+ return "Project formatted";
382
+ }
383
+ },
384
+ {
385
+ title: "Initializing git repository",
386
+ task: async () => {
387
+ run("git init");
388
+ run("git add .");
389
+ run("git commit -m \"the future is now\"");
390
+ return "Git repository initialized";
391
+ }
392
+ }
393
+ ]);
394
+ const pmrun = pmRun(config.packageManager);
398
395
  p.note([
399
396
  `cd ${config.targetDir}`,
400
- `${run} db:push`,
401
- `${run} dev`
397
+ `${pmrun} db:push`,
398
+ `${pmrun} dev`
402
399
  ].join("\n"), "Next steps");
403
400
  }
404
401
  function printHelp() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-mikstack",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -21,7 +21,7 @@
21
21
  "dependencies": {
22
22
  "@mikstack/email": "^0.1.0",
23
23
  "@mikstack/form": "^0.1.0",
24
- "@mikstack/notifications": "^0.1.0",
24
+ "@mikstack/notifications": "^0.1.1",
25
25
  "@rocicorp/zero": "^0.25.12",
26
26
  "better-auth": "^1.4.18",
27
27
  "drizzle-orm": "^0.45.1",
@@ -23,7 +23,6 @@ function createAuth() {
23
23
  sendMagicLink: async ({ email, url }) => {
24
24
  await notif.send({
25
25
  type: "magic-link",
26
- userId: email, // before user exists, use email as userId
27
26
  recipientEmail: email,
28
27
  data: { url },
29
28
  });
@@ -56,9 +56,7 @@ export const notificationDelivery = pgTable("notification_delivery", {
56
56
  id: text("id")
57
57
  .primaryKey()
58
58
  .$defaultFn(() => crypto.randomUUID()),
59
- userId: text("user_id")
60
- .notNull()
61
- .references(() => user.id),
59
+ userId: text("user_id").references(() => user.id),
62
60
  type: text("type").notNull(),
63
61
  channel: text("channel").notNull(),
64
62
  status: text("status", { enum: ["pending", "sent", "delivered", "failed"] })
@@ -1,7 +1,3 @@
1
- [run]
2
- # Use Bun runtime instead of following shebangs (needed for zero-cache native addons)
3
- bun = true
4
-
5
1
  [install]
6
2
  # Reject packages published less than 3 days ago
7
3
  minPublishAge = "3d"