create-meridian-app 0.1.6 → 0.1.8

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.
@@ -34,6 +34,10 @@ function renderPackageJson(vars) {
34
34
  "@meridianjs/sprint": "latest",
35
35
  "@meridianjs/activity": "latest",
36
36
  "@meridianjs/notification": "latest",
37
+ "@meridianjs/invitation": "latest",
38
+ "@meridianjs/workspace-member": "latest",
39
+ "@meridianjs/team-member": "latest",
40
+ "@meridianjs/project-member": "latest",
37
41
  "@meridianjs/meridian": "latest",
38
42
  "dotenv": "^16.0.0",
39
43
  ...vars.dashboard ? { "@meridianjs/admin-dashboard": "latest" } : {}
@@ -98,6 +102,10 @@ export default defineConfig({
98
102
  { resolve: "@meridianjs/sprint" },
99
103
  { resolve: "@meridianjs/activity" },
100
104
  { resolve: "@meridianjs/notification" },
105
+ { resolve: "@meridianjs/invitation" },
106
+ { resolve: "@meridianjs/workspace-member" },
107
+ { resolve: "@meridianjs/team-member" },
108
+ { resolve: "@meridianjs/project-member" },
101
109
  ],
102
110
  plugins: [
103
111
  { resolve: "@meridianjs/meridian" },
package/dist/cli.js CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  toKebabCase,
12
12
  toPascalCase,
13
13
  writeFile
14
- } from "./chunk-FGAPLSDF.js";
14
+ } from "./chunk-HGBU56NW.js";
15
15
 
16
16
  // src/cli.ts
17
17
  import { Command } from "commander";
@@ -410,6 +410,153 @@ async function generatePlugin(name) {
410
410
  console.log(chalk8.dim(` 2. Start the dev server: \`npm run dev\``));
411
411
  }
412
412
 
413
+ // src/commands/user-create.ts
414
+ import path8 from "path";
415
+ import chalk9 from "chalk";
416
+ import ora2 from "ora";
417
+ import prompts from "prompts";
418
+ import { execa as execa4 } from "execa";
419
+ async function runUserCreate(opts) {
420
+ const rootDir = findProjectRoot();
421
+ if (!rootDir) {
422
+ console.error(
423
+ chalk9.red(
424
+ " \u2716 Could not find meridian.config.ts. Are you inside a Meridian project?"
425
+ )
426
+ );
427
+ process.exit(1);
428
+ }
429
+ const response = await prompts(
430
+ [
431
+ {
432
+ type: opts.email ? null : "text",
433
+ name: "email",
434
+ message: "Email address",
435
+ validate: (v) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(v) ? true : "Enter a valid email"
436
+ },
437
+ {
438
+ type: "password",
439
+ name: "password",
440
+ message: "Password (min 8 characters)",
441
+ validate: (v) => v.length >= 8 ? true : "Password must be at least 8 characters"
442
+ },
443
+ {
444
+ type: "text",
445
+ name: "first_name",
446
+ message: "First name (optional)"
447
+ },
448
+ {
449
+ type: "text",
450
+ name: "last_name",
451
+ message: "Last name (optional)"
452
+ },
453
+ {
454
+ type: opts.role ? null : "select",
455
+ name: "role",
456
+ message: "Role",
457
+ choices: [
458
+ {
459
+ title: "Super Admin",
460
+ value: "super-admin",
461
+ description: "Full control over all settings and users"
462
+ },
463
+ {
464
+ title: "Admin",
465
+ value: "admin",
466
+ description: "Manage projects, members, and content"
467
+ },
468
+ {
469
+ title: "Moderator",
470
+ value: "moderator",
471
+ description: "Manage content and issues"
472
+ },
473
+ {
474
+ title: "Member",
475
+ value: "member",
476
+ description: "Standard access"
477
+ }
478
+ ]
479
+ }
480
+ ],
481
+ {
482
+ onCancel: () => {
483
+ console.log(chalk9.yellow("\n Cancelled."));
484
+ process.exit(0);
485
+ }
486
+ }
487
+ );
488
+ const email = opts.email ?? response.email;
489
+ const role = opts.role ?? response.role;
490
+ const password = response.password;
491
+ const first_name = response.first_name ?? "";
492
+ const last_name = response.last_name ?? "";
493
+ if (!email || !password || !role) {
494
+ process.exit(0);
495
+ }
496
+ const spinner = ora2("Creating user...").start();
497
+ const script = `
498
+ import { bootstrap } from "@meridianjs/framework"
499
+
500
+ const app = await bootstrap({ rootDir: ${JSON.stringify(rootDir)} })
501
+ const container = app.container
502
+
503
+ const authService = container.resolve("authModuleService")
504
+
505
+ let output
506
+ try {
507
+ const result = await authService.register({
508
+ email: ${JSON.stringify(email)},
509
+ password: ${JSON.stringify(password)},
510
+ first_name: ${JSON.stringify(first_name || null)},
511
+ last_name: ${JSON.stringify(last_name || null)},
512
+ role: ${JSON.stringify(role)},
513
+ })
514
+ output = { success: true, user: result.user }
515
+ } catch (err) {
516
+ output = { success: false, error: err.message ?? "Failed to create user" }
517
+ }
518
+
519
+ console.log(JSON.stringify(output))
520
+ await app.stop()
521
+ process.exit(output.success ? 0 : 1)
522
+ `;
523
+ const scriptPath = path8.join(rootDir, ".meridian-user-create-tmp.mjs");
524
+ const { writeFile: writeFile2, unlink } = await import("fs/promises");
525
+ await writeFile2(scriptPath, script, "utf-8");
526
+ try {
527
+ const result = await execa4("node", ["--import", "tsx/esm", scriptPath], {
528
+ cwd: rootDir,
529
+ stdio: "pipe",
530
+ env: { ...process.env, NODE_ENV: "development" }
531
+ });
532
+ const lines = result.stdout.trim().split("\n");
533
+ const output = JSON.parse(lines[lines.length - 1]);
534
+ if (output.success) {
535
+ spinner.succeed(
536
+ `User created: ${chalk9.green(output.user.email)} (${chalk9.cyan(role)})`
537
+ );
538
+ } else {
539
+ spinner.fail(output.error ?? "Failed to create user");
540
+ process.exit(1);
541
+ }
542
+ } catch (err) {
543
+ spinner.fail("Failed to create user");
544
+ if (err.stdout) {
545
+ try {
546
+ const lines = err.stdout.trim().split("\n");
547
+ const output = JSON.parse(lines[lines.length - 1]);
548
+ console.error(chalk9.red(` ${output.error ?? err.stdout}`));
549
+ } catch {
550
+ console.error(chalk9.red(` ${err.stdout}`));
551
+ }
552
+ }
553
+ if (err.stderr) console.error(chalk9.red(err.stderr));
554
+ process.exit(1);
555
+ } finally {
556
+ await unlink(scriptPath).catch(() => null);
557
+ }
558
+ }
559
+
413
560
  // src/cli.ts
414
561
  var program = new Command();
415
562
  program.name("meridian").description("Meridian project management framework CLI").version("0.1.0");
@@ -449,6 +596,17 @@ program.command("serve-dashboard").description("Serve the admin dashboard as a s
449
596
  process.exit(1);
450
597
  });
451
598
  });
599
+ program.command("user:create").description("Create a new user with a specified role").option("-e, --email <email>", "Email address").option(
600
+ "-r, --role <role>",
601
+ "Role: super-admin | admin | moderator | member"
602
+ ).action((options) => {
603
+ runUserCreate({ email: options.email, role: options.role }).catch(
604
+ (err) => {
605
+ console.error(err);
606
+ process.exit(1);
607
+ }
608
+ );
609
+ });
452
610
  var generateCmd = program.command("generate").alias("g").description("Generate boilerplate files");
453
611
  generateCmd.command("module <name>").description("Scaffold a new module in src/modules/").action((name) => {
454
612
  generateModule(name).catch((err) => {
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  runNew
4
- } from "./chunk-FGAPLSDF.js";
4
+ } from "./chunk-HGBU56NW.js";
5
5
 
6
6
  // src/index.ts
7
7
  var projectName = process.argv[2];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-meridian-app",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "description": "Create a new Meridian project or manage an existing one",
5
5
  "main": "./dist/index.js",
6
6
  "type": "module",