@makerkit/cli 1.3.13 → 1.3.14

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/README.md CHANGED
@@ -18,7 +18,7 @@ This ensures that you always run the latest version of the CLI.
18
18
 
19
19
  ### Some commands require a Makerkit repository
20
20
 
21
- Commands that interact with the repository (plugins, i18n, blog) must be
21
+ Commands that interact with the repository (plugins, i18n) must be
22
22
  launched from the root of the repository, as they will read and write files
23
23
  from the codebase.
24
24
 
@@ -114,7 +114,9 @@ This command will prompt you to select a plugin to update. Once selected, the pl
114
114
 
115
115
  ## i18n
116
116
 
117
- The CLI can help you manage your i18n files. You can translate from a locale
117
+ The CLI can help you manage your i18n files.
118
+
119
+ You can translate from a locale
118
120
  to another (requires an OpenAI key), and verify that your translations are
119
121
  in sync between each other.
120
122
 
@@ -138,27 +140,4 @@ To verify that your i18n files are in sync, you can use the `i18n verify` comman
138
140
  > npx @makerkit/cli@latest i18n verify <base-locale>
139
141
  ```
140
142
 
141
- If you omit the `base-locale` argument, the command will use `en` as the base.
142
-
143
- ## Blog
144
-
145
- The CLI can help you generate your blog posts.
146
-
147
- NB: this command requires you to setup an OpenAI key.
148
-
149
- ### Generating a new blog post
150
-
151
- To generate a new blog post, you can use the `blog generate` command:
152
-
153
- ```
154
- > npx @makerkit/cli@latest blog generate
155
- ```
156
-
157
- You will be prompted to enter the following information:
158
- 1. **Title**: The title of the blog post
159
- 2. **Category**: The category of the blog post. At this time, this file
160
- needs to exist in
161
- your Makerkit repository. You can create it later.
162
- 3. **Word Count**: The target word count of the blog post.
163
- 4. **Prompt**: Any additional information you want to add to the prompt
164
- (optional).
143
+ If you omit the `base-locale` argument, the command will use `en` as the base.
package/dist/index.d.ts CHANGED
File without changes
package/dist/index.js CHANGED
@@ -1,8 +1,24 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- // src/commands/blog/generate/generate-blog.command.ts
3
+ // src/commands/i18n/i18n-service.ts
4
4
  import { join as join2 } from "path";
5
5
 
6
+ // src/utils/openai-client.ts
7
+ import OpenAI from "openai";
8
+ function getOpenAIClient() {
9
+ const apiKey = process.env.OPENAI_API_KEY;
10
+ if (!apiKey) {
11
+ throw new Error(
12
+ "OPENAI_API_KEY env variable is not set. Please set it in your .env.local file of your Makerkit workspace."
13
+ );
14
+ }
15
+ return new OpenAI({ apiKey });
16
+ }
17
+ var openai_client_default = getOpenAIClient;
18
+
19
+ // src/utils/workspace.ts
20
+ import { join } from "path";
21
+
6
22
  // src/plugins-model.ts
7
23
  import invariant from "tiny-invariant";
8
24
  var PluginsModel = {
@@ -103,6 +119,20 @@ var PluginsModel = {
103
119
  branch: `umami`,
104
120
  description: `Add Umami Analytics to your site.`,
105
121
  folder: `packages/plugins/analytics/umami`
122
+ },
123
+ Signoz: {
124
+ name: `Signoz`,
125
+ id: `signoz`,
126
+ branch: `signoz`,
127
+ description: `Add Signoz Monitoring to your app.`,
128
+ folder: `packages/plugins/signoz`
129
+ },
130
+ Paddle: {
131
+ name: `Paddle`,
132
+ id: `paddle`,
133
+ branch: `paddle`,
134
+ description: `Add Paddle Billing to your app.`,
135
+ folder: `packages/plugins/paddle`
106
136
  }
107
137
  };
108
138
  function getPluginById(id) {
@@ -217,21 +247,7 @@ function validateKit(kitId) {
217
247
  return kit;
218
248
  }
219
249
 
220
- // src/utils/openai-client.ts
221
- import OpenAI from "openai";
222
- function getOpenAIClient() {
223
- const apiKey = process.env.OPENAI_API_KEY;
224
- if (!apiKey) {
225
- throw new Error(
226
- "OPENAI_API_KEY env variable is not set. Please set it in your .env.local file of your Makerkit workspace."
227
- );
228
- }
229
- return new OpenAI({ apiKey });
230
- }
231
- var openai_client_default = getOpenAIClient;
232
-
233
250
  // src/utils/workspace.ts
234
- import { join } from "path";
235
251
  import chalk from "chalk";
236
252
  import fs from "fs-extra";
237
253
  var Workspace = class _Workspace {
@@ -293,154 +309,9 @@ async function getPackageJson() {
293
309
  return fs.readJSON(join(process.cwd(), "package.json")).catch(() => void 0);
294
310
  }
295
311
 
296
- // src/commands/blog/generate/generate-blog.command.ts
312
+ // src/commands/i18n/i18n-service.ts
297
313
  import chalk2 from "chalk";
298
314
  import fs2 from "fs-extra";
299
- import ora from "ora";
300
- import prompts from "prompts";
301
- import { z } from "zod";
302
- var schema = z.object({
303
- title: z.string().min(1).max(70),
304
- category: z.string().min(1).max(70),
305
- wordCount: z.number().min(250).max(2500),
306
- prompt: z.string().optional().transform((value) => value || "")
307
- });
308
- function generateBlogCommand(parentCommand) {
309
- return parentCommand.command("generate").description("Generate your blog posts with AI").action(async () => {
310
- const { title, prompt, category, wordCount } = schema.parse(
311
- await getPrompts()
312
- );
313
- const content = await generateBlogPost({ title, prompt, wordCount });
314
- const mdx = await getMdxPostTemplate({ title, category, content });
315
- return writeMdxPostTemplate(mdx, title);
316
- });
317
- }
318
- function getPrompts() {
319
- return prompts([
320
- {
321
- type: "text",
322
- name: "title",
323
- message: `Enter your ${chalk2.cyan("title")}.`
324
- },
325
- {
326
- type: "text",
327
- name: "category",
328
- message: `Enter your ${chalk2.cyan(
329
- "category"
330
- )}. If it doesn't exist yet, you will need to add it manually to your blog.`
331
- },
332
- {
333
- type: "number",
334
- name: "wordCount",
335
- message: `Enter your target ${chalk2.cyan(
336
- "word count"
337
- )} (from 250 words, up to 2500).`
338
- },
339
- {
340
- type: "text",
341
- name: "prompt",
342
- message: `Would you like to add your own instructions to the AI? (optional)`
343
- }
344
- ]);
345
- }
346
- async function generateBlogPost(params) {
347
- const client = openai_client_default();
348
- const prompt = getPostPrompt(params);
349
- const spinner = ora(`Generating blog post...`).start();
350
- try {
351
- const response = await client.chat.completions.create({
352
- model: `gpt-3.5-turbo`,
353
- messages: [
354
- {
355
- role: "user",
356
- content: prompt
357
- }
358
- ],
359
- max_tokens: params.wordCount,
360
- temperature: 0.7
361
- });
362
- const content = response.choices[0].message.content ?? "";
363
- spinner.succeed(`Blog post generated successfully`);
364
- console.log(`Used ${response.usage?.total_tokens} tokens`);
365
- return content;
366
- } catch (e) {
367
- console.error(e);
368
- spinner.fail(`Failed to generate blog post`);
369
- process.exit(1);
370
- }
371
- }
372
- async function getMdxPostTemplate(params) {
373
- const kit = await Workspace.getKitMeta();
374
- const isFirebaseKit = kit.id === KitsModel.NextJsFirebase.id;
375
- const categoryProp = isFirebaseKit ? "collection" : "category";
376
- const descriptionProp = isFirebaseKit ? "excerpt" : "description";
377
- const imageProp = isFirebaseKit ? "coverImage" : "image";
378
- return `
379
- ---
380
- title: "${params.title}"
381
- ${categoryProp}: "${params.category}"
382
- date: "${(/* @__PURE__ */ new Date()).toISOString()}"
383
- ${descriptionProp}: ""
384
- live: false
385
- ${imageProp}: ""
386
- ---
387
-
388
- ${params.content}
389
- `.trim();
390
- }
391
- async function writeMdxPostTemplate(template, title) {
392
- const kit = await Workspace.getKitMeta();
393
- const spinner = ora(`Storing blog post...`).start();
394
- try {
395
- let blogPath = kit.blogPath;
396
- if (!blogPath) {
397
- blogPath = await prompts({
398
- type: "text",
399
- name: "blogPath",
400
- message: `This kit does not support blog posts yet. You can still generate a blog post, but you'll need to manually add it to your blog. Please enter your blog path (e.g. src/content/posts). The path needs to exist.`
401
- }).then((response) => response.blogPath);
402
- }
403
- const slug = slugify(title);
404
- const path = join2(process.cwd(), blogPath, `${slug}.mdx`);
405
- await fs2.writeFile(path, template);
406
- spinner.succeed(`Blog post stored successfully`);
407
- } catch (e) {
408
- console.error(e);
409
- spinner.fail(`Failed to store blog post`);
410
- }
411
- }
412
- function getPostPrompt(params) {
413
- return `
414
- Generate a professional blog post with title "${params.title}".
415
- Rules:
416
-
417
- - The post must be below ${params.wordCount} words
418
- - Output text using valid Markdown
419
- - Write professional text while balancing simplicity and complexity in your language and sentence structures.
420
- - Be an extremely smart, interesting, funny, witty, and confident writer. Readers admire you!
421
- - Use several paragraphs and an accurate level 2 and 3 headings before each paragraph to maximize readability.
422
- - Do include level 4 headings (h4) to break complex paragraphs
423
- - Ensure that headings do not include decimals or numbers with periods. Ensure they're formatted using Markdown.
424
- - Repeat the main keywords and phrases often for SEO
425
-
426
- ${params.prompt ?? ""}
427
- `.trim();
428
- }
429
- function slugify(text) {
430
- return (text ?? "").toString().normalize("NFKD").toLowerCase().trim().replace(/\_/g, "-").replace(/\s+/g, "-").replace(/\-\-+/g, "--").replace(/\_$/g, "");
431
- }
432
-
433
- // src/commands/blog/blog.command.ts
434
- import { Command } from "commander";
435
- var blogCommand = new Command().name("blog").description("Manage and generate your blog posts").hook("preAction", () => {
436
- return Workspace.logWorkspaceInfo();
437
- });
438
- generateBlogCommand(blogCommand);
439
-
440
- // src/commands/i18n/i18n-service.ts
441
- import { join as join3 } from "path";
442
- import chalk3 from "chalk";
443
- import fs3 from "fs-extra";
444
315
  var I18nService = class {
445
316
  /**
446
317
  * @name verify
@@ -448,28 +319,28 @@ var I18nService = class {
448
319
  */
449
320
  static async verify(base = "en") {
450
321
  const kit = await Workspace.getKitMeta();
451
- const allLocales = fs3.readdirSync(kit.localePath).filter((locale) => {
322
+ const allLocales = fs2.readdirSync(kit.localePath).filter((locale) => {
452
323
  return locale !== base;
453
324
  });
454
325
  const baseLocaleFolderPath = `${kit.localePath}/${base}`;
455
- const localeFiles = fs3.readdirSync(baseLocaleFolderPath).filter((file) => {
326
+ const localeFiles = fs2.readdirSync(baseLocaleFolderPath).filter((file) => {
456
327
  return file.endsWith(".json");
457
328
  });
458
329
  for (const localeFile of localeFiles) {
459
330
  for (const locale of allLocales) {
460
331
  const baseLocaleFilePath = `${baseLocaleFolderPath}/${localeFile}`;
461
332
  const targetLocaleFilePath = `${kit.localePath}/${locale}/${localeFile}`;
462
- const baseLocaleFile = fs3.readJSONSync(baseLocaleFilePath);
463
- const file = fs3.readJSONSync(targetLocaleFilePath);
333
+ const baseLocaleFile = fs2.readJSONSync(baseLocaleFilePath);
334
+ const file = fs2.readJSONSync(targetLocaleFilePath);
464
335
  const missingKeys = collectMissingKeys([baseLocaleFile, file]);
465
336
  if (!missingKeys.length) {
466
337
  console.log(
467
- chalk3.green(`Locale ${locale}/${localeFile} is in sync!`)
338
+ chalk2.green(`Locale ${locale}/${localeFile} is in sync!`)
468
339
  );
469
340
  continue;
470
341
  }
471
342
  console.log(
472
- chalk3.yellow(
343
+ chalk2.yellow(
473
344
  `Locale ${locale}/${localeFile} is missing the following keys: ${missingKeys.join(
474
345
  ", "
475
346
  )}`
@@ -489,28 +360,28 @@ var I18nService = class {
489
360
  const client = openai_client_default();
490
361
  const targetJsonPath = `${kit.localePath}/${target}`;
491
362
  const sourceLocalePath = `${kit.localePath}/${source}`;
492
- const sourceLocale = await fs3.exists(sourceLocalePath);
363
+ const sourceLocale = await fs2.exists(sourceLocalePath);
493
364
  if (!sourceLocale) {
494
365
  throw new Error(`Source locale at ${sourceLocalePath} not found`);
495
366
  }
496
- const files = fs3.readdirSync(sourceLocalePath).filter((file) => {
367
+ const files = fs2.readdirSync(sourceLocalePath).filter((file) => {
497
368
  return file.endsWith(".json");
498
369
  });
499
370
  console.log(`Found the following files: ${files.join(", ")}`);
500
371
  for (const file of files) {
501
372
  const data = {};
502
- const localeFile = fs3.readJSONSync(join3(sourceLocalePath, file));
373
+ const localeFile = fs2.readJSONSync(join2(sourceLocalePath, file));
503
374
  console.log(
504
- chalk3.cyan(`Translating "${file}". This can take a while...`)
375
+ chalk2.cyan(`Translating "${file}". This can take a while...`)
505
376
  );
506
377
  for (const key in localeFile) {
507
378
  data[key] = await translateKey(source, target, localeFile[key], client);
508
379
  }
509
- console.log(chalk3.green(`File "${file}" successfully translated!`));
510
- console.log(chalk3.cyan(`Writing file "${file}" to ${targetJsonPath}`));
511
- await fs3.exists(targetJsonPath) || await fs3.mkdir(targetJsonPath);
512
- await fs3.writeJSON(join3(targetJsonPath, file), data, {});
513
- console.log(chalk3.green(`File "${file}" successfully written!`));
380
+ console.log(chalk2.green(`File "${file}" successfully translated!`));
381
+ console.log(chalk2.cyan(`Writing file "${file}" to ${targetJsonPath}`));
382
+ await fs2.exists(targetJsonPath) || await fs2.mkdir(targetJsonPath);
383
+ await fs2.writeJSON(join2(targetJsonPath, file), data, {});
384
+ console.log(chalk2.green(`File "${file}" successfully written!`));
514
385
  }
515
386
  }
516
387
  };
@@ -562,8 +433,8 @@ function collectMissingKeys(objects) {
562
433
  }
563
434
 
564
435
  // src/commands/i18n/translate/translate.command.ts
565
- import chalk4 from "chalk";
566
- import prompts2 from "prompts";
436
+ import chalk3 from "chalk";
437
+ import prompts from "prompts";
567
438
  function createTranslateI18nCommand(parentCommand) {
568
439
  return parentCommand.command("translate").argument("[source-locale]", "Source Locale").argument("[target-locale]", "Target Locale").description("Translate i18n files from source locale to target locale").action(async (sourceLocale, targetLocale) => {
569
440
  const locales = await promptLocales(sourceLocale, targetLocale);
@@ -572,19 +443,19 @@ function createTranslateI18nCommand(parentCommand) {
572
443
  }
573
444
  async function promptLocales(maybeSource, maybeTarget) {
574
445
  const hint = "e.g. en, fr, es, etc.";
575
- const sourceLocale = maybeSource || (await prompts2([
446
+ const sourceLocale = maybeSource || (await prompts([
576
447
  {
577
448
  type: "text",
578
449
  name: "locale",
579
- message: `Enter your ${chalk4.cyan("Source Locale")}. ${hint}`,
450
+ message: `Enter your ${chalk3.cyan("Source Locale")}. ${hint}`,
580
451
  hint
581
452
  }
582
453
  ])).locale;
583
- const targetLocale = maybeTarget || (await prompts2([
454
+ const targetLocale = maybeTarget || (await prompts([
584
455
  {
585
456
  type: "text",
586
457
  name: "locale",
587
- message: `Enter your ${chalk4.cyan("Target Locale")}. ${hint}`,
458
+ message: `Enter your ${chalk3.cyan("Target Locale")}. ${hint}`,
588
459
  hint
589
460
  }
590
461
  ])).locale;
@@ -604,29 +475,29 @@ function createVerifyI18nCommand(parentCommand) {
604
475
  }
605
476
 
606
477
  // src/commands/i18n/i18n.command.ts
607
- import { Command as Command2 } from "commander";
608
- var i18nCommand = new Command2().name("i18n").description("Manage and translate your i18n files").hook("preAction", () => {
478
+ import { Command } from "commander";
479
+ var i18nCommand = new Command().name("i18n").description("Manage and translate your i18n files").hook("preAction", () => {
609
480
  return Workspace.logWorkspaceInfo();
610
481
  });
611
482
  createTranslateI18nCommand(i18nCommand);
612
483
  createVerifyI18nCommand(i18nCommand);
613
484
 
614
485
  // src/commands/license/activate/activate-license.command.ts
615
- import chalk5 from "chalk";
616
- import ora2 from "ora";
617
- import prompts3 from "prompts";
618
- import { z as z2 } from "zod";
619
- var schema2 = z2.object({
620
- licenseKey: z2.string().min(1).max(32),
621
- githubUsername: z2.string().min(1).max(64)
486
+ import chalk4 from "chalk";
487
+ import ora from "ora";
488
+ import prompts2 from "prompts";
489
+ import { z } from "zod";
490
+ var schema = z.object({
491
+ licenseKey: z.string().min(1).max(32),
492
+ githubUsername: z.string().min(1).max(64)
622
493
  });
623
494
  function createActivateLicenseCommand(parentCommand) {
624
495
  return parentCommand.command("activate").description("Activate your license key for MakerKit").action(async () => {
625
- const params = await prompts3([
496
+ const params = await prompts2([
626
497
  {
627
498
  type: "text",
628
499
  name: "licenseKey",
629
- message: `Enter your ${chalk5.cyan("License Key")}.`,
500
+ message: `Enter your ${chalk4.cyan("License Key")}.`,
630
501
  validate: (value) => {
631
502
  if (value.length < 1) {
632
503
  return `Please enter a valid license key`;
@@ -637,7 +508,7 @@ function createActivateLicenseCommand(parentCommand) {
637
508
  {
638
509
  type: "text",
639
510
  name: "githubUsername",
640
- message: `Enter your ${chalk5.cyan("Github username")}.`,
511
+ message: `Enter your ${chalk4.cyan("Github username")}.`,
641
512
  validate: (value) => {
642
513
  if (value.length < 1) {
643
514
  return `Please enter a valid username`;
@@ -646,13 +517,13 @@ function createActivateLicenseCommand(parentCommand) {
646
517
  }
647
518
  }
648
519
  ]);
649
- const spinner = ora2(`Activating license...`).start();
520
+ const spinner = ora(`Activating license...`).start();
650
521
  const onError = () => {
651
522
  spinner.fail(`Failed to activate license`);
652
523
  process.exit(1);
653
524
  };
654
525
  try {
655
- const response = await activateLicense(schema2.parse(params));
526
+ const response = await activateLicense(schema.parse(params));
656
527
  if (!response.ok) {
657
528
  return onError();
658
529
  }
@@ -670,45 +541,45 @@ async function activateLicense(params) {
670
541
  }
671
542
 
672
543
  // src/commands/license/license.command.ts
673
- import { Command as Command3 } from "commander";
674
- var licenseCommand = new Command3().name("license").description("Manage Licenses");
544
+ import { Command as Command2 } from "commander";
545
+ var licenseCommand = new Command2().name("license").description("Manage Licenses");
675
546
  createActivateLicenseCommand(licenseCommand);
676
547
 
677
548
  // src/commands/new/new.command.ts
678
- import { join as join4 } from "path";
679
- import chalk6 from "chalk";
680
- import { Command as Command4 } from "commander";
549
+ import { join as join3 } from "path";
550
+ import chalk5 from "chalk";
551
+ import { Command as Command3 } from "commander";
681
552
  import { execa } from "execa";
682
- import ora3 from "ora";
683
- import prompts4 from "prompts";
684
- var newCommand = new Command4().name("new").description("Initialize a new Makerkit project").action(async () => {
553
+ import ora2 from "ora";
554
+ import prompts3 from "prompts";
555
+ var newCommand = new Command3().name("new").description("Initialize a new Makerkit project").action(async () => {
685
556
  const choices = Object.values(KitsModel).map((kit2) => {
686
557
  return {
687
558
  title: kit2.name,
688
559
  value: kit2.id
689
560
  };
690
561
  });
691
- const { kit, name: projectName } = await prompts4([
562
+ const { kit, name: projectName } = await prompts3([
692
563
  {
693
564
  type: "select",
694
565
  name: "kit",
695
- message: `Select the ${chalk6.cyan(`SaaS Kit`)} you want to clone`,
566
+ message: `Select the ${chalk5.cyan(`SaaS Kit`)} you want to clone`,
696
567
  choices
697
568
  },
698
569
  {
699
570
  type: "text",
700
571
  name: "name",
701
- message: `Enter your ${chalk6.cyan("Project Name")}.`
572
+ message: `Enter your ${chalk5.cyan("Project Name")}.`
702
573
  }
703
574
  ]);
704
575
  const { repository, name: kitName } = validateKit(kit);
705
- const { confirm } = await prompts4([
576
+ const { confirm } = await prompts3([
706
577
  {
707
578
  type: "confirm",
708
579
  name: "confirm",
709
- message: `Are you sure you want to clone ${chalk6.cyan(
580
+ message: `Are you sure you want to clone ${chalk5.cyan(
710
581
  kitName
711
- )} to ${chalk6.cyan(projectName)}?`
582
+ )} to ${chalk5.cyan(projectName)}?`
712
583
  }
713
584
  ]);
714
585
  if (!confirm) {
@@ -719,7 +590,7 @@ var newCommand = new Command4().name("new").description("Initialize a new Makerk
719
590
  await installDependencies(projectName);
720
591
  });
721
592
  async function pullFromGithub(repository, kit, projectName) {
722
- const spinner = ora3(`Cloning ${kit}...`).start();
593
+ const spinner = ora2(`Cloning ${kit}...`).start();
723
594
  try {
724
595
  await execa("git", ["clone", repository, projectName]);
725
596
  spinner.succeed(`Cloned ${kit} to ${projectName}...`);
@@ -730,8 +601,8 @@ async function pullFromGithub(repository, kit, projectName) {
730
601
  }
731
602
  }
732
603
  async function installDependencies(projectName) {
733
- const cwd = join4(process.cwd(), projectName);
734
- const spinner = ora3(`Installing dependencies. Please wait...`).start();
604
+ const cwd = join3(process.cwd(), projectName);
605
+ const spinner = ora2(`Installing dependencies. Please wait...`).start();
735
606
  try {
736
607
  await execa("npm", ["install"], { cwd });
737
608
  spinner.succeed(`Dependencies successfully installed!`);
@@ -746,10 +617,10 @@ async function installDependencies(projectName) {
746
617
  }
747
618
 
748
619
  // src/commands/plugins/plugins-service.ts
749
- import chalk7 from "chalk";
620
+ import chalk6 from "chalk";
750
621
  import { execaCommand } from "execa";
751
- import ora4 from "ora";
752
- import prompts5 from "prompts";
622
+ import ora3 from "ora";
623
+ import prompts4 from "prompts";
753
624
  var PluginsService = class {
754
625
  static async install(pluginId) {
755
626
  const action = "add" /* Add */;
@@ -774,7 +645,7 @@ async function initPluginCommand(pluginId, action) {
774
645
  const repository = buildPluginRepositoryName(kit.repository);
775
646
  const verb = action === "add" /* Add */ ? "Installing" : "Updating";
776
647
  console.log(
777
- `${verb} ${chalk7.cyan(plugin.name)} to kit ${chalk7.cyan(
648
+ `${verb} ${chalk6.cyan(plugin.name)} to kit ${chalk6.cyan(
778
649
  kit.name
779
650
  )} using repo: ${repository} ...`
780
651
  );
@@ -796,11 +667,11 @@ async function getPluginFromPrompts(action) {
796
667
  };
797
668
  });
798
669
  const verb = action === "add" /* Add */ ? "install" : "update";
799
- const { plugin } = await prompts5([
670
+ const { plugin } = await prompts4([
800
671
  {
801
672
  type: "select",
802
673
  name: "plugin",
803
- message: `Which ${chalk7.cyan("Plugin")} would you like to ${verb}?`,
674
+ message: `Which ${chalk6.cyan("Plugin")} would you like to ${verb}?`,
804
675
  choices
805
676
  }
806
677
  ]);
@@ -816,7 +687,7 @@ async function executePluginCommand({
816
687
  folder
817
688
  }) {
818
689
  const verb = action === "add" /* Add */ ? "Installing" : "Updating";
819
- const spinner = ora4(`${verb} plugin...`).start();
690
+ const spinner = ora3(`${verb} plugin...`).start();
820
691
  const commandString = `git subtree ${action} --prefix ${folder} ${repository} ${branch} --squash`;
821
692
  try {
822
693
  await execaCommand(commandString);
@@ -837,24 +708,24 @@ function createInstallPluginCommand(parentCommand) {
837
708
  }
838
709
 
839
710
  // src/commands/plugins/list/list-plugins.command.ts
840
- import chalk8 from "chalk";
711
+ import chalk7 from "chalk";
841
712
  function createListPluginsCommand(parentCommand) {
842
713
  return parentCommand.command("list").description("List available plugins.").action(() => {
843
714
  const kits = Object.values(KitsModel);
844
- console.log(chalk8.white("Makerkit available plugins..."));
715
+ console.log(chalk7.white("Makerkit available plugins..."));
845
716
  console.log(
846
- `[${chalk8.green("Plugin Name")} (${chalk8.gray("plugin-id")})]
717
+ `[${chalk7.green("Plugin Name")} (${chalk7.gray("plugin-id")})]
847
718
  `
848
719
  );
849
720
  for (const kit of kits) {
850
- console.log(`${chalk8.cyan(kit.name)}`);
721
+ console.log(`${chalk7.cyan(kit.name)}`);
851
722
  if (!kit.plugins.length) {
852
- console.log(chalk8.yellow(`- No plugins available`) + "\n");
723
+ console.log(chalk7.yellow(`- No plugins available`) + "\n");
853
724
  continue;
854
725
  }
855
726
  for (const plugin of kit.plugins) {
856
727
  const { name, id } = validatePlugin(plugin);
857
- console.log(`- ${chalk8.green(name)} (${chalk8.gray(id)})`);
728
+ console.log(`- ${chalk7.green(name)} (${chalk7.gray(id)})`);
858
729
  }
859
730
  console.log("");
860
731
  }
@@ -869,8 +740,8 @@ function createUpdatePluginCommand(parentCommand) {
869
740
  }
870
741
 
871
742
  // src/commands/plugins/plugins.command.ts
872
- import { Command as Command5 } from "commander";
873
- var pluginsCommand = new Command5().name("plugins").description("List and install plugins.").hook("preAction", () => {
743
+ import { Command as Command4 } from "commander";
744
+ var pluginsCommand = new Command4().name("plugins").description("List and install plugins.").hook("preAction", () => {
874
745
  return Workspace.logWorkspaceInfo();
875
746
  });
876
747
  createListPluginsCommand(pluginsCommand);
@@ -878,7 +749,7 @@ createInstallPluginCommand(pluginsCommand);
878
749
  createUpdatePluginCommand(pluginsCommand);
879
750
 
880
751
  // src/index.ts
881
- import { Command as Command6 } from "commander";
752
+ import { Command as Command5 } from "commander";
882
753
  import { config } from "dotenv";
883
754
  config({
884
755
  path: ".env.local"
@@ -886,10 +757,10 @@ config({
886
757
  process.on("SIGINT", () => process.exit(0));
887
758
  process.on("SIGTERM", () => process.exit(0));
888
759
  async function main() {
889
- const program = new Command6().name("makerkit").description(
760
+ const program = new Command5().name("makerkit").description(
890
761
  "Your SaaS Kit companion. Add plugins, manage migrations, and more."
891
762
  ).version("-v, --version", "display the version number");
892
- program.addCommand(newCommand).addCommand(pluginsCommand).addCommand(i18nCommand).addCommand(licenseCommand).addCommand(blogCommand);
763
+ program.addCommand(newCommand).addCommand(pluginsCommand).addCommand(i18nCommand).addCommand(licenseCommand);
893
764
  program.parse();
894
765
  }
895
766
  void main();
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/commands/blog/generate/generate-blog.command.ts","../src/plugins-model.ts","../src/kits-model.ts","../src/utils/openai-client.ts","../src/utils/workspace.ts","../src/commands/blog/blog.command.ts","../src/commands/i18n/i18n-service.ts","../src/commands/i18n/translate/translate.command.ts","../src/commands/i18n/verify/verify.command.ts","../src/commands/i18n/i18n.command.ts","../src/commands/license/activate/activate-license.command.ts","../src/commands/license/license.command.ts","../src/commands/new/new.command.ts","../src/commands/plugins/plugins-service.ts","../src/commands/plugins/install/install-plugin.command.ts","../src/commands/plugins/list/list-plugins.command.ts","../src/commands/plugins/update/update-plugin.command.ts","../src/commands/plugins/plugins.command.ts","../src/index.ts"],"sourcesContent":["import { join } from 'path';\nimport { KitsModel } from '@/src/kits-model';\nimport getOpenAIClient from '@/src/utils/openai-client';\nimport { Workspace } from '@/src/utils/workspace';\nimport chalk from 'chalk';\nimport { Command } from 'commander';\nimport fs from 'fs-extra';\nimport ora from 'ora';\nimport prompts from 'prompts';\nimport { z } from 'zod';\n\nconst schema = z.object({\n title: z.string().min(1).max(70),\n category: z.string().min(1).max(70),\n wordCount: z.number().min(250).max(2500),\n prompt: z\n .string()\n .optional()\n .transform((value) => value || ''),\n});\n\nexport function generateBlogCommand(parentCommand: Command) {\n return parentCommand\n .command('generate')\n .description('Generate your blog posts with AI')\n .action(async () => {\n const { title, prompt, category, wordCount } = schema.parse(\n await getPrompts()\n );\n\n const content = await generateBlogPost({ title, prompt, wordCount });\n const mdx = await getMdxPostTemplate({ title, category, content });\n\n return writeMdxPostTemplate(mdx, title);\n });\n}\n\nexport function getPrompts() {\n return prompts([\n {\n type: 'text',\n name: 'title',\n message: `Enter your ${chalk.cyan('title')}.`,\n },\n {\n type: 'text',\n name: 'category',\n message: `Enter your ${chalk.cyan(\n 'category'\n )}. If it doesn't exist yet, you will need to add it manually to your blog.`,\n },\n {\n type: 'number',\n name: 'wordCount',\n message: `Enter your target ${chalk.cyan(\n 'word count'\n )} (from 250 words, up to 2500).`,\n },\n {\n type: 'text',\n name: 'prompt',\n message: `Would you like to add your own instructions to the AI? (optional)`,\n },\n ]);\n}\n\nasync function generateBlogPost(params: {\n title: string;\n prompt: string;\n wordCount: number;\n}) {\n const client = getOpenAIClient();\n const prompt = getPostPrompt(params);\n const spinner = ora(`Generating blog post...`).start();\n\n try {\n const response = await client.chat.completions.create({\n model: `gpt-3.5-turbo`,\n messages: [\n {\n role: 'user' as const,\n content: prompt,\n },\n ],\n max_tokens: params.wordCount,\n temperature: 0.7,\n });\n\n const content = response.choices[0].message.content ?? '';\n\n spinner.succeed(`Blog post generated successfully`);\n console.log(`Used ${response.usage?.total_tokens} tokens`);\n\n return content;\n } catch (e) {\n console.error(e);\n spinner.fail(`Failed to generate blog post`);\n process.exit(1);\n }\n}\n\nasync function getMdxPostTemplate(params: {\n title: string;\n category: string;\n content: string;\n}) {\n const kit = await Workspace.getKitMeta();\n const isFirebaseKit = kit.id === KitsModel.NextJsFirebase.id;\n\n // we use different properties for firebase and supabase kits\n const categoryProp = isFirebaseKit ? 'collection' : 'category';\n const descriptionProp = isFirebaseKit ? 'excerpt' : 'description';\n const imageProp = isFirebaseKit ? 'coverImage' : 'image';\n\n return `\n---\ntitle: \"${params.title}\"\n${categoryProp}: \"${params.category}\"\ndate: \"${new Date().toISOString()}\"\n${descriptionProp}: \"\"\nlive: false\n${imageProp}: \"\"\n---\n\n${params.content}\n`.trim();\n}\n\nasync function writeMdxPostTemplate(template: string, title: string) {\n const kit = await Workspace.getKitMeta();\n const spinner = ora(`Storing blog post...`).start();\n\n try {\n let blogPath = kit.blogPath;\n\n // when the kit does not have a blog path, we ask the user to provide one\n // this is the case for the Remix kits\n if (!blogPath) {\n blogPath = await prompts({\n type: 'text',\n name: 'blogPath',\n message: `This kit does not support blog posts yet. You can still generate a blog post, but you'll need to manually add it to your blog. Please enter your blog path (e.g. src/content/posts). The path needs to exist.`,\n }).then((response) => response.blogPath as string);\n }\n\n const slug = slugify(title);\n const path = join(process.cwd(), blogPath, `${slug}.mdx`);\n\n await fs.writeFile(path, template);\n\n spinner.succeed(`Blog post stored successfully`);\n } catch (e) {\n console.error(e);\n\n spinner.fail(`Failed to store blog post`);\n }\n}\n\nfunction getPostPrompt(params: {\n title: string;\n prompt: string;\n wordCount: number;\n}) {\n return `\n Generate a professional blog post with title \"${params.title}\".\n Rules:\n \n- The post must be below ${params.wordCount} words\n- Output text using valid Markdown\n- Write professional text while balancing simplicity and complexity in your language and sentence structures.\n- Be an extremely smart, interesting, funny, witty, and confident writer. Readers admire you! \n- Use several paragraphs and an accurate level 2 and 3 headings before each paragraph to maximize readability.\n- Do include level 4 headings (h4) to break complex paragraphs\n- Ensure that headings do not include decimals or numbers with periods. Ensure they're formatted using Markdown.\n- Repeat the main keywords and phrases often for SEO\n \n ${params.prompt ?? ''}\n`.trim();\n}\n\nfunction slugify(text: string) {\n return (text ?? '')\n .toString()\n .normalize('NFKD')\n .toLowerCase()\n .trim()\n .replace(/\\_/g, '-')\n .replace(/\\s+/g, '-')\n .replace(/\\-\\-+/g, '--')\n .replace(/\\_$/g, '');\n}\n","import invariant from 'tiny-invariant';\n\nexport const PluginsModel = {\n CookieBanner: {\n name: `Cookie Banner`,\n id: `cookie-banner`,\n branch: `cookie-banner`,\n description: `Add a cookie banner to your site.`,\n folder: `plugins/cookie-banner`,\n },\n AiChatBot: {\n name: `AI Chatbot`,\n id: `chatbot-v1`,\n branch: `chatbot`,\n description: `Add an AI Chatbot to your site.`,\n folder: `plugins/chatbot`,\n },\n FeedbackPopup: {\n name: `Feedback Popup`,\n id: `feedback-popup-v1`,\n branch: `feedback-popup`,\n description: `Add a feedback popup to your site.`,\n folder: `plugins/feedback-popup`,\n },\n AiTextEditor: {\n name: `AI Text Editor`,\n id: `text-editor-v1`,\n branch: `text-editor`,\n description: `Add an AI Text Editor to your site.`,\n folder: `plugins/text-editor`,\n },\n AiTextEditorTurbo: {\n name: `AI Text Editor`,\n id: `text-editor`,\n branch: `text-editor`,\n description: `Add an AI Text Editor to your site.`,\n folder: `packages/plugins/text-editor`,\n },\n Waitlist: {\n name: `Waitlist`,\n id: `waitlist`,\n branch: `waitlist`,\n description: `Add a waitlist to your site.`,\n folder: `packages/plugins/waitlist`,\n },\n FeedbackPopupTurbo: {\n name: `Feedback Popup`,\n id: `feedback`,\n branch: `feedback`,\n description: `Add a feedback popup to your site.`,\n folder: `packages/plugins/feedback`,\n },\n AiChatBotTurbo: {\n name: `AI Chatbot`,\n id: `chatbot`,\n branch: `chatbot`,\n description: `Add an AI Chatbot to your site.`,\n folder: `packages/plugins/chatbot`,\n },\n Testimonial: {\n name: `Testimonial`,\n id: `testimonial`,\n branch: `testimonial`,\n description: `Add a testimonial to your site.`,\n folder: `packages/plugins/testimonial`,\n },\n Roadmap: {\n name: `Roadmap`,\n id: `roadmap`,\n branch: `roadmap`,\n description: `Add a Roadmap to your site.`,\n folder: `packages/plugins/roadmap`,\n },\n Kanban: {\n name: `Kanban`,\n id: `kanban`,\n branch: `kanban`,\n description: `Add a Kanban component to your site.`,\n folder: `packages/plugins/kanban`,\n },\n GoogleAnalytics: {\n name: `Google Analytics`,\n id: `google-analytics`,\n branch: `google-analytics`,\n description: `Add Google Analytics to your site.`,\n folder: `packages/plugins/analytics/google-analytics`,\n },\n Posthog: {\n name: `Posthog`,\n id: `posthog`,\n branch: `posthog`,\n description: `Add Posthog Analytics to your site.`,\n folder: `packages/plugins/analytics/posthog`,\n },\n Umami: {\n name: `Umami`,\n id: `umami`,\n branch: `umami`,\n description: `Add Umami Analytics to your site.`,\n folder: `packages/plugins/analytics/umami`,\n },\n};\n\nexport function getPluginById(id: string) {\n return Object.values(PluginsModel).find((plugin) => plugin.id === id);\n}\n\nexport function validatePlugin(pluginId: string) {\n const plugin = getPluginById(pluginId);\n\n invariant(plugin, `Plugin ${pluginId} not found`);\n\n return plugin;\n}\n","import { PluginsModel } from '@/src/plugins-model';\nimport invariant from 'tiny-invariant';\n\nexport const KitsModel = {\n NextJsFirebase: {\n name: `Next.js Firebase`,\n id: `next-firebase`,\n repository: `git@github.com:makerkit/next-firebase-saas-kit`,\n blogPath: `_posts`,\n localePath: `public/locales`,\n plugins: [\n PluginsModel.CookieBanner.id,\n PluginsModel.AiChatBot.id,\n PluginsModel.FeedbackPopup.id,\n ],\n },\n NextJsSupabase: {\n name: `Next.js Supabase`,\n id: `next-supabase`,\n localePath: `public/locales`,\n blogPath: `src/content/posts`,\n repository: `git@github.com:makerkit/next-supabase-saas-kit`,\n plugins: [\n PluginsModel.AiChatBot.id,\n PluginsModel.FeedbackPopup.id,\n PluginsModel.CookieBanner.id,\n PluginsModel.AiTextEditor.id,\n ],\n },\n NextJsSupabaseTurbo: {\n name: `Next.js Supabase Turbo`,\n id: `next-supabase-turbo`,\n localePath: `apps/web/public/locales`,\n blogPath: `apps/web/content/posts`,\n repository: `git@github.com:makerkit/next-supabase-saas-kit-turbo`,\n plugins: [\n PluginsModel.Waitlist.id,\n PluginsModel.Testimonial.id,\n PluginsModel.Roadmap.id,\n PluginsModel.Kanban.id,\n PluginsModel.AiChatBotTurbo.id,\n PluginsModel.FeedbackPopupTurbo.id,\n PluginsModel.AiTextEditorTurbo.id,\n PluginsModel.GoogleAnalytics.id,\n PluginsModel.Posthog.id,\n PluginsModel.Umami.id,\n ],\n },\n RemixSupabaseTurbo: {\n name: `Remix Supabase Turbo`,\n id: `remix-supabase-turbo`,\n localePath: `apps/web/public/locales`,\n blogPath: `apps/web/content/posts`,\n repository: `git@github.com:makerkit/remix-supabase-saas-kit-turbo`,\n plugins: [\n PluginsModel.Waitlist.id,\n PluginsModel.Testimonial.id,\n PluginsModel.AiChatBotTurbo.id,\n PluginsModel.FeedbackPopupTurbo.id,\n PluginsModel.AiTextEditorTurbo.id,\n PluginsModel.GoogleAnalytics.id,\n PluginsModel.Posthog.id,\n PluginsModel.Umami.id,\n ],\n },\n NextJsSupabaseLite: {\n name: `Next.js Supabase Lite`,\n id: `next-supabase-lite`,\n localePath: `public/locales`,\n blogPath: `src/content/posts`,\n repository: `git@github.com:makerkit/next-supabase-saas-kit-lite`,\n plugins: [],\n },\n RemixFirebase: {\n name: `Remix Firebase`,\n id: `remix-firebase`,\n localePath: `public/locales`,\n blogPath: '',\n repository: `git@github.com:makerkit/remix-firebase-saas-kit`,\n plugins: [],\n },\n RemixSupabase: {\n name: `Remix Supabase`,\n id: `remix-supabase`,\n localePath: `public/locales`,\n blogPath: `app/content/posts`,\n repository: `git@github.com:makerkit/remix-supabase-saas-kit`,\n plugins: [\n PluginsModel.AiChatBot.id,\n PluginsModel.FeedbackPopup.id,\n PluginsModel.CookieBanner.id,\n PluginsModel.AiTextEditor.id,\n ],\n },\n};\n\nexport function getKitById(id: string) {\n return Object.values(KitsModel).find((kit) => kit.id === id);\n}\n\nexport function validateKit(kitId: string) {\n const kit = getKitById(kitId);\n\n invariant(kit, `Kit ${kitId} not found`);\n\n return kit;\n}\n","import OpenAI from 'openai';\n\nfunction getOpenAIClient() {\n const apiKey = process.env.OPENAI_API_KEY;\n\n if (!apiKey) {\n throw new Error(\n 'OPENAI_API_KEY env variable is not set. Please set it in' +\n ' your .env.local file of your Makerkit workspace.'\n );\n }\n\n return new OpenAI({ apiKey });\n}\n\nexport default getOpenAIClient;\n","import { join } from 'path';\nimport { KitsModel } from '@/src/kits-model';\nimport chalk from 'chalk';\nimport fs from 'fs-extra';\n\nexport class Workspace {\n static async getKitMeta() {\n const packageJson = await getPackageJson();\n const kit = await detectKitVersion();\n\n return {\n ...kit,\n version: packageJson.version ?? 'unknown',\n };\n }\n\n static async logWorkspaceInfo() {\n const meta = await Workspace.getKitMeta();\n\n console.log(\n `Makerkit version: ${chalk.cyan(meta.name)} - ${chalk.cyan(\n meta.version ?? 'unknown'\n )}.\\n`\n );\n }\n}\n\nasync function detectKitVersion() {\n let packageJson = await getPackageJson();\n\n if (!packageJson) {\n throw new Error(\n 'No package.json found. Please run this command in a Makerkit workspace.'\n );\n }\n\n let deps = Object.keys(packageJson.dependencies ?? []);\n\n if (deps.length === 0) {\n deps = Object.keys(packageJson.devDependencies ?? []);\n }\n\n if (deps.includes('turbo')) {\n // locate apps/web\n packageJson = await fs.readJSON(\n join(process.cwd(), 'apps/web/package.json')\n );\n\n deps = Object.keys(packageJson.dependencies ?? []);\n\n if (deps.includes('next')) {\n return KitsModel.NextJsSupabaseTurbo;\n }\n\n if (deps.includes('@remix-run/react')) {\n return KitsModel.RemixSupabaseTurbo;\n }\n }\n\n if (deps.includes('next') && deps.includes('firebase')) {\n return KitsModel.NextJsFirebase;\n }\n\n if (deps.includes('next') && deps.includes('@supabase/supabase-js')) {\n return KitsModel.NextJsSupabase;\n }\n\n if (\n deps.includes('@remix-run/react') &&\n deps.includes('@supabase/supabase-js')\n ) {\n return KitsModel.RemixSupabase;\n }\n\n throw new Error(\n 'Could not detect Makerkit workspace. Please run this command in a Makerkit workspace.'\n );\n}\n\nasync function getPackageJson(): Promise<Record<string, unknown>> {\n return fs\n .readJSON(join(process.cwd(), 'package.json'))\n .catch(() => undefined);\n}\n","import { generateBlogCommand } from '@/src/commands/blog/generate/generate-blog.command';\nimport { Workspace } from '@/src/utils/workspace';\nimport { Command } from 'commander';\n\nexport const blogCommand = new Command()\n .name('blog')\n .description('Manage and generate your blog posts')\n .hook('preAction', () => {\n return Workspace.logWorkspaceInfo();\n });\n\n// set children commands\ngenerateBlogCommand(blogCommand);\n","import { join } from 'path';\nimport getOpenAIClient from '@/src/utils/openai-client';\nimport { Workspace } from '@/src/utils/workspace';\nimport chalk from 'chalk';\nimport fs from 'fs-extra';\nimport OpenAI from 'openai';\n\ntype NestedKey = Record<string, string | Record<string, string>>;\n\nexport class I18nService {\n /**\n * @name verify\n * @description Verifies if the locale files are in sync\n */\n static async verify(base = 'en') {\n const kit = await Workspace.getKitMeta();\n\n const allLocales = fs.readdirSync(kit.localePath).filter((locale) => {\n return locale !== base;\n });\n\n const baseLocaleFolderPath = `${kit.localePath}/${base}`;\n\n const localeFiles = fs.readdirSync(baseLocaleFolderPath).filter((file) => {\n return file.endsWith('.json');\n });\n\n for (const localeFile of localeFiles) {\n for (const locale of allLocales) {\n const baseLocaleFilePath = `${baseLocaleFolderPath}/${localeFile}`;\n const targetLocaleFilePath = `${kit.localePath}/${locale}/${localeFile}`;\n\n const baseLocaleFile = fs.readJSONSync(baseLocaleFilePath);\n const file = fs.readJSONSync(targetLocaleFilePath);\n\n const missingKeys = collectMissingKeys([baseLocaleFile, file]);\n\n if (!missingKeys.length) {\n console.log(\n chalk.green(`Locale ${locale}/${localeFile} is in sync!`)\n );\n\n continue;\n }\n\n console.log(\n chalk.yellow(\n `Locale ${locale}/${localeFile} is missing the following keys: ${missingKeys.join(\n ', '\n )}`\n )\n );\n }\n }\n }\n\n /**\n * @name translate\n * @description Translates the locale files from source to target\n * @param source\n * @param target\n */\n static async translate(source: string, target: string) {\n const kit = await Workspace.getKitMeta();\n const client = getOpenAIClient();\n\n const targetJsonPath = `${kit.localePath}/${target}`;\n const sourceLocalePath = `${kit.localePath}/${source}`;\n\n const sourceLocale = await fs.exists(sourceLocalePath);\n\n if (!sourceLocale) {\n throw new Error(`Source locale at ${sourceLocalePath} not found`);\n }\n\n const files = fs.readdirSync(sourceLocalePath).filter((file) => {\n return file.endsWith('.json');\n });\n\n console.log(`Found the following files: ${files.join(', ')}`);\n\n for (const file of files) {\n const data: Record<string, string | Record<string, string | NestedKey>> =\n {};\n\n const localeFile = fs.readJSONSync(join(sourceLocalePath, file));\n\n console.log(\n chalk.cyan(`Translating \"${file}\". This can take a while...`)\n );\n\n for (const key in localeFile) {\n data[key] = await translateKey(source, target, localeFile[key], client);\n }\n\n console.log(chalk.green(`File \"${file}\" successfully translated!`));\n console.log(chalk.cyan(`Writing file \"${file}\" to ${targetJsonPath}`));\n\n // check if targetJsonPath exists, if not, create it\n (await fs.exists(targetJsonPath)) || (await fs.mkdir(targetJsonPath));\n\n // write file to targetJsonPath\n await fs.writeJSON(join(targetJsonPath, file), data, {});\n\n console.log(chalk.green(`File \"${file}\" successfully written!`));\n }\n }\n}\n\nasync function translateKey(\n source: string,\n target: string,\n key: string | NestedKey,\n client: OpenAI\n) {\n if (typeof key === 'string') {\n return translateString(source, target, key, client);\n }\n\n const data: Record<string, string | NestedKey> = {};\n\n for (const k in key) {\n data[k] = (await translateKey(source, target, key[k], client)) as NestedKey;\n }\n\n return data;\n}\n\nasync function translateString(\n source: string,\n target: string,\n key: string,\n client: OpenAI\n) {\n // skip empty or short keys\n if (!key.trim() || key.length <= 1) {\n return '';\n }\n\n const response = await client.chat.completions.create({\n model: 'gpt-3.5-turbo',\n max_tokens: target.split(' ').length + 50,\n temperature: 0.3,\n messages: [\n {\n role: 'user',\n content: `Translate the text from locale ${source} to ${target}. Text: ${key}. Translation:`,\n },\n ],\n });\n\n return response.choices[0].message.content ?? '';\n}\n\ntype JSONObject = { [key: string]: any };\n\nfunction collectMissingKeys(objects: JSONObject[]): string[] {\n const allKeys: string[] = [];\n\n objects.forEach((obj) => {\n Object.keys(obj).forEach((key) => {\n if (!allKeys.includes(key)) {\n allKeys.push(key);\n }\n });\n });\n\n const missingKeys: string[] = [];\n\n objects.forEach((obj) => {\n allKeys.forEach((key) => {\n if (!Object.keys(obj).includes(key)) {\n missingKeys.push(key);\n }\n });\n });\n\n return missingKeys;\n}\n","import { I18nService } from '@/src/commands/i18n/i18n-service';\nimport chalk from 'chalk';\nimport { Command } from 'commander';\nimport prompts from 'prompts';\n\nexport function createTranslateI18nCommand(parentCommand: Command) {\n return parentCommand\n .command('translate')\n .argument('[source-locale]', 'Source Locale')\n .argument('[target-locale]', 'Target Locale')\n .description('Translate i18n files from source locale to target locale')\n .action(async (sourceLocale, targetLocale) => {\n const locales = await promptLocales(sourceLocale, targetLocale);\n\n await I18nService.translate(locales.sourceLocale, locales.targetLocale);\n });\n}\n\nasync function promptLocales(maybeSource?: string, maybeTarget?: string) {\n const hint = 'e.g. en, fr, es, etc.';\n\n const sourceLocale =\n maybeSource ||\n (\n await prompts([\n {\n type: 'text',\n name: 'locale',\n message: `Enter your ${chalk.cyan('Source Locale')}. ${hint}`,\n hint,\n },\n ])\n ).locale;\n\n const targetLocale =\n maybeTarget ||\n (\n await prompts([\n {\n type: 'text',\n name: 'locale',\n message: `Enter your ${chalk.cyan('Target Locale')}. ${hint}`,\n hint,\n },\n ])\n ).locale;\n\n return {\n sourceLocale,\n targetLocale,\n };\n}\n","import { I18nService } from '@/src/commands/i18n/i18n-service';\nimport { Command } from 'commander';\n\nexport function createVerifyI18nCommand(parentCommand: Command) {\n return parentCommand\n .command('verify')\n .argument('[base-locale]', 'Base Locale')\n .description(\n 'Verify i18n files have no missing keys compared to base locale'\n )\n .action(async (baseLocale = 'en') => {\n await I18nService.verify(baseLocale);\n });\n}\n","import { createTranslateI18nCommand } from '@/src/commands/i18n/translate/translate.command';\nimport { createVerifyI18nCommand } from '@/src/commands/i18n/verify/verify.command';\nimport { Workspace } from '@/src/utils/workspace';\nimport { Command } from 'commander';\n\nexport const i18nCommand = new Command()\n .name('i18n')\n .description('Manage and translate your i18n files')\n .hook('preAction', () => {\n return Workspace.logWorkspaceInfo();\n });\n\n// set children commands\ncreateTranslateI18nCommand(i18nCommand);\ncreateVerifyI18nCommand(i18nCommand);\n","import chalk from 'chalk';\nimport { Command } from 'commander';\nimport ora from 'ora';\nimport prompts from 'prompts';\nimport { z } from 'zod';\n\nconst schema = z.object({\n licenseKey: z.string().min(1).max(32),\n githubUsername: z.string().min(1).max(64),\n});\n\nexport function createActivateLicenseCommand(parentCommand: Command) {\n return parentCommand\n .command('activate')\n .description('Activate your license key for MakerKit')\n .action(async () => {\n const params = await prompts([\n {\n type: 'text',\n name: 'licenseKey',\n message: `Enter your ${chalk.cyan('License Key')}.`,\n validate: (value) => {\n if (value.length < 1) {\n return `Please enter a valid license key`;\n }\n\n return true;\n },\n },\n {\n type: 'text',\n name: 'githubUsername',\n message: `Enter your ${chalk.cyan('Github username')}.`,\n validate: (value) => {\n if (value.length < 1) {\n return `Please enter a valid username`;\n }\n\n return true;\n },\n },\n ]);\n\n const spinner = ora(`Activating license...`).start();\n\n const onError = () => {\n spinner.fail(`Failed to activate license`);\n process.exit(1);\n };\n\n try {\n const response = await activateLicense(schema.parse(params));\n\n if (!response.ok) {\n return onError();\n }\n\n spinner.succeed(`License activated successfully`);\n } catch (e) {\n onError();\n }\n });\n}\n\nasync function activateLicense(params: {\n licenseKey: string;\n githubUsername: string;\n}) {\n return fetch(`https://makerkit.dev/api/ls/license/activate`, {\n method: 'POST',\n body: JSON.stringify(params),\n });\n}\n","import { createActivateLicenseCommand } from '@/src/commands/license/activate/activate-license.command';\nimport { Command } from 'commander';\n\nexport const licenseCommand = new Command()\n .name('license')\n .description('Manage Licenses');\n\ncreateActivateLicenseCommand(licenseCommand);\n","import { join } from 'path';\nimport { KitsModel, validateKit } from '@/src/kits-model';\nimport chalk from 'chalk';\nimport { Command } from 'commander';\nimport { execa } from 'execa';\nimport ora from 'ora';\nimport prompts from 'prompts';\n\nexport const newCommand = new Command()\n .name('new')\n .description('Initialize a new Makerkit project')\n .action(async () => {\n const choices = Object.values(KitsModel).map((kit) => {\n return {\n title: kit.name,\n value: kit.id,\n };\n });\n\n const { kit, name: projectName } = await prompts([\n {\n type: 'select',\n name: 'kit',\n message: `Select the ${chalk.cyan(`SaaS Kit`)} you want to clone`,\n choices,\n },\n {\n type: 'text',\n name: 'name',\n message: `Enter your ${chalk.cyan('Project Name')}.`,\n },\n ]);\n\n const { repository, name: kitName } = validateKit(kit);\n\n const { confirm } = await prompts([\n {\n type: 'confirm',\n name: 'confirm',\n message: `Are you sure you want to clone ${chalk.cyan(\n kitName\n )} to ${chalk.cyan(projectName)}?`,\n },\n ]);\n\n if (!confirm) {\n console.log('Aborting...');\n process.exit(0);\n }\n\n // pull repository from github\n await pullFromGithub(repository, kitName, projectName);\n\n // install dependencies\n await installDependencies(projectName);\n });\n\nasync function pullFromGithub(\n repository: string,\n kit: string,\n projectName: string\n) {\n const spinner = ora(`Cloning ${kit}...`).start();\n\n try {\n await execa('git', ['clone', repository, projectName]);\n\n spinner.succeed(`Cloned ${kit} to ${projectName}...`);\n } catch (e) {\n console.error(e);\n spinner.fail(`Failed to clone ${kit}`);\n\n return Promise.reject(`Failed to clone ${kit}`);\n }\n}\n\nasync function installDependencies(projectName: string) {\n const cwd = join(process.cwd(), projectName);\n const spinner = ora(`Installing dependencies. Please wait...`).start();\n\n try {\n await execa('npm', ['install'], { cwd });\n\n spinner.succeed(`Dependencies successfully installed!`);\n\n console.log(\n `🎉 You can now get started. Open the project in your IDE and read the README.md file for more information.`\n );\n } catch (e) {\n console.error(e);\n spinner.fail(`Failed to install dependencies`);\n\n return Promise.reject(`Failed to install dependencies`);\n }\n}\n","import { validateKit } from '@/src/kits-model';\nimport { PluginsModel, validatePlugin } from '@/src/plugins-model';\nimport { Workspace } from '@/src/utils/workspace';\nimport chalk from 'chalk';\nimport { execaCommand } from 'execa';\nimport ora from 'ora';\nimport prompts from 'prompts';\n\nenum PluginAction {\n Add = 'add',\n Pull = 'pull',\n}\n\nexport class PluginsService {\n static async install(pluginId?: string) {\n const action = PluginAction.Add;\n const plugin = pluginId || (await getPluginFromPrompts(action));\n\n await initPluginCommand(plugin, action);\n }\n\n static async pull(pluginId?: string) {\n const action = PluginAction.Pull;\n const plugin = pluginId || (await getPluginFromPrompts(action));\n\n await initPluginCommand(plugin, action);\n }\n}\n\nasync function initPluginCommand(pluginId: string, action: PluginAction) {\n const { id: kitId } = await Workspace.getKitMeta();\n\n const plugin = validatePlugin(pluginId);\n const kit = validateKit(kitId);\n\n if (!(kit.plugins as string[]).includes(plugin.id)) {\n throw new Error(\n `Plugin ${plugin.name} is not compatible with kit ${kit.name}`\n );\n }\n\n const repository = buildPluginRepositoryName(kit.repository);\n const verb = action === PluginAction.Add ? 'Installing' : 'Updating';\n\n console.log(\n `${verb} ${chalk.cyan(plugin.name)} to kit ${chalk.cyan(\n kit.name\n )} using repo: ${repository} ...`\n );\n\n return executePluginCommand({\n action,\n repository,\n branch: plugin.branch,\n folder: plugin.folder,\n });\n}\n\nasync function getPluginFromPrompts(action: PluginAction) {\n const kit = await Workspace.getKitMeta();\n\n const choices = Object.values(PluginsModel)\n .filter((plugin) => {\n return kit.plugins.includes(plugin.id);\n })\n .map((plugin) => {\n return {\n title: plugin.name,\n value: plugin.id,\n };\n });\n\n const verb = action === PluginAction.Add ? 'install' : 'update';\n\n const { plugin } = await prompts([\n {\n type: 'select',\n name: 'plugin',\n message: `Which ${chalk.cyan('Plugin')} would you like to ${verb}?`,\n choices,\n },\n ]);\n\n return plugin;\n}\n\n// the plugin repository name is the kit repository name + `-plugins`\nfunction buildPluginRepositoryName(repository: string) {\n return repository + `-plugins.git`;\n}\n\nasync function executePluginCommand({\n action,\n repository,\n branch,\n folder,\n}: {\n action: PluginAction;\n repository: string;\n branch: string;\n folder: string;\n}) {\n const verb = action === PluginAction.Add ? 'Installing' : 'Updating';\n const spinner = ora(`${verb} plugin...`).start();\n const commandString = `git subtree ${action} --prefix ${folder} ${repository} ${branch} --squash`;\n\n try {\n await execaCommand(commandString);\n\n const verb = action === PluginAction.Add ? 'installed' : 'updated';\n spinner.succeed(`Plugin ${verb} at ${folder}`);\n } catch (e) {\n console.error(e);\n\n const verb = action === PluginAction.Add ? 'installation' : 'update';\n spinner.fail(`Plugin ${verb} failed`);\n }\n}\n","import { PluginsService } from '@/src/commands/plugins/plugins-service';\nimport { Command } from 'commander';\n\nexport function createInstallPluginCommand(parentCommand: Command) {\n return parentCommand\n .command('install')\n .argument('[plugin-id]', 'Plugin id')\n .description('Install plugin')\n .action(async (maybePluginId) => {\n await PluginsService.install(maybePluginId);\n });\n}\n","import { KitsModel } from '@/src/kits-model';\nimport { validatePlugin } from '@/src/plugins-model';\nimport chalk from 'chalk';\nimport { Command } from 'commander';\n\nexport function createListPluginsCommand(parentCommand: Command) {\n return parentCommand\n .command('list')\n .description('List available plugins.')\n .action(() => {\n const kits = Object.values(KitsModel);\n\n console.log(chalk.white('Makerkit available plugins...'));\n console.log(\n `[${chalk.green('Plugin Name')} (${chalk.gray('plugin-id')})]\\n`\n );\n\n for (const kit of kits) {\n console.log(`${chalk.cyan(kit.name)}`);\n\n if (!kit.plugins.length) {\n console.log(chalk.yellow(`- No plugins available`) + '\\n');\n\n continue;\n }\n\n for (const plugin of kit.plugins) {\n const { name, id } = validatePlugin(plugin);\n console.log(`- ${chalk.green(name)} (${chalk.gray(id)})`);\n }\n\n console.log('');\n }\n });\n}\n","import { PluginsService } from '@/src/commands/plugins/plugins-service';\nimport { Command } from 'commander';\n\nexport function createUpdatePluginCommand(parentCommand: Command) {\n return parentCommand\n .command('update')\n .argument('[plugin-id]', 'Plugin id')\n .description('Update plugin to the latest version')\n .action(async (maybePluginId) => {\n await PluginsService.pull(maybePluginId);\n });\n}\n","import { createInstallPluginCommand } from '@/src/commands/plugins/install/install-plugin.command';\nimport { createListPluginsCommand } from '@/src/commands/plugins/list/list-plugins.command';\nimport { createUpdatePluginCommand } from '@/src/commands/plugins/update/update-plugin.command';\nimport { Workspace } from '@/src/utils/workspace';\nimport { Command } from 'commander';\n\nexport const pluginsCommand = new Command()\n .name('plugins')\n .description('List and install plugins.')\n .hook('preAction', () => {\n return Workspace.logWorkspaceInfo();\n });\n\n// set children commands\ncreateListPluginsCommand(pluginsCommand);\ncreateInstallPluginCommand(pluginsCommand);\ncreateUpdatePluginCommand(pluginsCommand);\n","#!/usr/bin/env node\nimport { blogCommand } from '@/src/commands/blog/blog.command';\nimport { i18nCommand } from '@/src/commands/i18n/i18n.command';\nimport { licenseCommand } from '@/src/commands/license/license.command';\nimport { newCommand } from '@/src/commands/new/new.command';\nimport { pluginsCommand } from '@/src/commands/plugins/plugins.command';\nimport { Command } from 'commander';\nimport { config } from 'dotenv';\n\nconfig({\n path: '.env.local',\n});\n\nprocess.on('SIGINT', () => process.exit(0));\nprocess.on('SIGTERM', () => process.exit(0));\n\nasync function main() {\n const program = new Command()\n .name('makerkit')\n .description(\n 'Your SaaS Kit companion. Add plugins, manage migrations, and more.'\n )\n .version('-v, --version', 'display the version number');\n\n program\n .addCommand(newCommand)\n .addCommand(pluginsCommand)\n .addCommand(i18nCommand)\n .addCommand(licenseCommand)\n .addCommand(blogCommand);\n\n program.parse();\n}\n\nvoid main();\n"],"mappings":";;;AAAA,SAAS,QAAAA,aAAY;;;ACArB,OAAO,eAAe;AAEf,IAAM,eAAe;AAAA,EAC1B,cAAc;AAAA,IACZ,MAAM;AAAA,IACN,IAAI;AAAA,IACJ,QAA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;","names":["join","invariant","chalk","fs","join","join","chalk","fs","join","chalk","prompts","Command","chalk","ora","prompts","z","schema","Command","join","chalk","Command","ora","prompts","kit","join","chalk","ora","prompts","chalk","plugin","prompts","ora","verb","chalk","Command","Command"]}
1
+ {"version":3,"sources":["../src/commands/i18n/i18n-service.ts","../src/utils/openai-client.ts","../src/utils/workspace.ts","../src/plugins-model.ts","../src/kits-model.ts","../src/commands/i18n/translate/translate.command.ts","../src/commands/i18n/verify/verify.command.ts","../src/commands/i18n/i18n.command.ts","../src/commands/license/activate/activate-license.command.ts","../src/commands/license/license.command.ts","../src/commands/new/new.command.ts","../src/commands/plugins/plugins-service.ts","../src/commands/plugins/install/install-plugin.command.ts","../src/commands/plugins/list/list-plugins.command.ts","../src/commands/plugins/update/update-plugin.command.ts","../src/commands/plugins/plugins.command.ts","../src/index.ts"],"sourcesContent":["import { join } from 'path';\nimport getOpenAIClient from '@/src/utils/openai-client';\nimport { Workspace } from '@/src/utils/workspace';\nimport chalk from 'chalk';\nimport fs from 'fs-extra';\nimport OpenAI from 'openai';\n\ntype NestedKey = Record<string, string | Record<string, string>>;\n\nexport class I18nService {\n /**\n * @name verify\n * @description Verifies if the locale files are in sync\n */\n static async verify(base = 'en') {\n const kit = await Workspace.getKitMeta();\n\n const allLocales = fs.readdirSync(kit.localePath).filter((locale) => {\n return locale !== base;\n });\n\n const baseLocaleFolderPath = `${kit.localePath}/${base}`;\n\n const localeFiles = fs.readdirSync(baseLocaleFolderPath).filter((file) => {\n return file.endsWith('.json');\n });\n\n for (const localeFile of localeFiles) {\n for (const locale of allLocales) {\n const baseLocaleFilePath = `${baseLocaleFolderPath}/${localeFile}`;\n const targetLocaleFilePath = `${kit.localePath}/${locale}/${localeFile}`;\n\n const baseLocaleFile = fs.readJSONSync(baseLocaleFilePath);\n const file = fs.readJSONSync(targetLocaleFilePath);\n\n const missingKeys = collectMissingKeys([baseLocaleFile, file]);\n\n if (!missingKeys.length) {\n console.log(\n chalk.green(`Locale ${locale}/${localeFile} is in sync!`)\n );\n\n continue;\n }\n\n console.log(\n chalk.yellow(\n `Locale ${locale}/${localeFile} is missing the following keys: ${missingKeys.join(\n ', '\n )}`\n )\n );\n }\n }\n }\n\n /**\n * @name translate\n * @description Translates the locale files from source to target\n * @param source\n * @param target\n */\n static async translate(source: string, target: string) {\n const kit = await Workspace.getKitMeta();\n const client = getOpenAIClient();\n\n const targetJsonPath = `${kit.localePath}/${target}`;\n const sourceLocalePath = `${kit.localePath}/${source}`;\n\n const sourceLocale = await fs.exists(sourceLocalePath);\n\n if (!sourceLocale) {\n throw new Error(`Source locale at ${sourceLocalePath} not found`);\n }\n\n const files = fs.readdirSync(sourceLocalePath).filter((file) => {\n return file.endsWith('.json');\n });\n\n console.log(`Found the following files: ${files.join(', ')}`);\n\n for (const file of files) {\n const data: Record<string, string | Record<string, string | NestedKey>> =\n {};\n\n const localeFile = fs.readJSONSync(join(sourceLocalePath, file));\n\n console.log(\n chalk.cyan(`Translating \"${file}\". This can take a while...`)\n );\n\n for (const key in localeFile) {\n data[key] = await translateKey(source, target, localeFile[key], client);\n }\n\n console.log(chalk.green(`File \"${file}\" successfully translated!`));\n console.log(chalk.cyan(`Writing file \"${file}\" to ${targetJsonPath}`));\n\n // check if targetJsonPath exists, if not, create it\n (await fs.exists(targetJsonPath)) || (await fs.mkdir(targetJsonPath));\n\n // write file to targetJsonPath\n await fs.writeJSON(join(targetJsonPath, file), data, {});\n\n console.log(chalk.green(`File \"${file}\" successfully written!`));\n }\n }\n}\n\nasync function translateKey(\n source: string,\n target: string,\n key: string | NestedKey,\n client: OpenAI\n) {\n if (typeof key === 'string') {\n return translateString(source, target, key, client);\n }\n\n const data: Record<string, string | NestedKey> = {};\n\n for (const k in key) {\n data[k] = (await translateKey(source, target, key[k], client)) as NestedKey;\n }\n\n return data;\n}\n\nasync function translateString(\n source: string,\n target: string,\n key: string,\n client: OpenAI\n) {\n // skip empty or short keys\n if (!key.trim() || key.length <= 1) {\n return '';\n }\n\n const response = await client.chat.completions.create({\n model: 'gpt-3.5-turbo',\n max_tokens: target.split(' ').length + 50,\n temperature: 0.3,\n messages: [\n {\n role: 'user',\n content: `Translate the text from locale ${source} to ${target}. Text: ${key}. Translation:`,\n },\n ],\n });\n\n return response.choices[0].message.content ?? '';\n}\n\ntype JSONObject = { [key: string]: any };\n\nfunction collectMissingKeys(objects: JSONObject[]): string[] {\n const allKeys: string[] = [];\n\n objects.forEach((obj) => {\n Object.keys(obj).forEach((key) => {\n if (!allKeys.includes(key)) {\n allKeys.push(key);\n }\n });\n });\n\n const missingKeys: string[] = [];\n\n objects.forEach((obj) => {\n allKeys.forEach((key) => {\n if (!Object.keys(obj).includes(key)) {\n missingKeys.push(key);\n }\n });\n });\n\n return missingKeys;\n}\n","import OpenAI from 'openai';\n\nfunction getOpenAIClient() {\n const apiKey = process.env.OPENAI_API_KEY;\n\n if (!apiKey) {\n throw new Error(\n 'OPENAI_API_KEY env variable is not set. Please set it in' +\n ' your .env.local file of your Makerkit workspace.'\n );\n }\n\n return new OpenAI({ apiKey });\n}\n\nexport default getOpenAIClient;\n","import { join } from 'path';\nimport { KitsModel } from '@/src/kits-model';\nimport chalk from 'chalk';\nimport fs from 'fs-extra';\n\nexport class Workspace {\n static async getKitMeta() {\n const packageJson = await getPackageJson();\n const kit = await detectKitVersion();\n\n return {\n ...kit,\n version: packageJson.version ?? 'unknown',\n };\n }\n\n static async logWorkspaceInfo() {\n const meta = await Workspace.getKitMeta();\n\n console.log(\n `Makerkit version: ${chalk.cyan(meta.name)} - ${chalk.cyan(\n meta.version ?? 'unknown'\n )}.\\n`\n );\n }\n}\n\nasync function detectKitVersion() {\n let packageJson = await getPackageJson();\n\n if (!packageJson) {\n throw new Error(\n 'No package.json found. Please run this command in a Makerkit workspace.'\n );\n }\n\n let deps = Object.keys(packageJson.dependencies ?? []);\n\n if (deps.length === 0) {\n deps = Object.keys(packageJson.devDependencies ?? []);\n }\n\n if (deps.includes('turbo')) {\n // locate apps/web\n packageJson = await fs.readJSON(\n join(process.cwd(), 'apps/web/package.json')\n );\n\n deps = Object.keys(packageJson.dependencies ?? []);\n\n if (deps.includes('next')) {\n return KitsModel.NextJsSupabaseTurbo;\n }\n\n if (deps.includes('@remix-run/react')) {\n return KitsModel.RemixSupabaseTurbo;\n }\n }\n\n if (deps.includes('next') && deps.includes('firebase')) {\n return KitsModel.NextJsFirebase;\n }\n\n if (deps.includes('next') && deps.includes('@supabase/supabase-js')) {\n return KitsModel.NextJsSupabase;\n }\n\n if (\n deps.includes('@remix-run/react') &&\n deps.includes('@supabase/supabase-js')\n ) {\n return KitsModel.RemixSupabase;\n }\n\n throw new Error(\n 'Could not detect Makerkit workspace. Please run this command in a Makerkit workspace.'\n );\n}\n\nasync function getPackageJson(): Promise<Record<string, unknown>> {\n return fs\n .readJSON(join(process.cwd(), 'package.json'))\n .catch(() => undefined);\n}\n","import invariant from 'tiny-invariant';\n\nexport const PluginsModel = {\n CookieBanner: {\n name: `Cookie Banner`,\n id: `cookie-banner`,\n branch: `cookie-banner`,\n description: `Add a cookie banner to your site.`,\n folder: `plugins/cookie-banner`,\n },\n AiChatBot: {\n name: `AI Chatbot`,\n id: `chatbot-v1`,\n branch: `chatbot`,\n description: `Add an AI Chatbot to your site.`,\n folder: `plugins/chatbot`,\n },\n FeedbackPopup: {\n name: `Feedback Popup`,\n id: `feedback-popup-v1`,\n branch: `feedback-popup`,\n description: `Add a feedback popup to your site.`,\n folder: `plugins/feedback-popup`,\n },\n AiTextEditor: {\n name: `AI Text Editor`,\n id: `text-editor-v1`,\n branch: `text-editor`,\n description: `Add an AI Text Editor to your site.`,\n folder: `plugins/text-editor`,\n },\n AiTextEditorTurbo: {\n name: `AI Text Editor`,\n id: `text-editor`,\n branch: `text-editor`,\n description: `Add an AI Text Editor to your site.`,\n folder: `packages/plugins/text-editor`,\n },\n Waitlist: {\n name: `Waitlist`,\n id: `waitlist`,\n branch: `waitlist`,\n description: `Add a waitlist to your site.`,\n folder: `packages/plugins/waitlist`,\n },\n FeedbackPopupTurbo: {\n name: `Feedback Popup`,\n id: `feedback`,\n branch: `feedback`,\n description: `Add a feedback popup to your site.`,\n folder: `packages/plugins/feedback`,\n },\n AiChatBotTurbo: {\n name: `AI Chatbot`,\n id: `chatbot`,\n branch: `chatbot`,\n description: `Add an AI Chatbot to your site.`,\n folder: `packages/plugins/chatbot`,\n },\n Testimonial: {\n name: `Testimonial`,\n id: `testimonial`,\n branch: `testimonial`,\n description: `Add a testimonial to your site.`,\n folder: `packages/plugins/testimonial`,\n },\n Roadmap: {\n name: `Roadmap`,\n id: `roadmap`,\n branch: `roadmap`,\n description: `Add a Roadmap to your site.`,\n folder: `packages/plugins/roadmap`,\n },\n Kanban: {\n name: `Kanban`,\n id: `kanban`,\n branch: `kanban`,\n description: `Add a Kanban component to your site.`,\n folder: `packages/plugins/kanban`,\n },\n GoogleAnalytics: {\n name: `Google Analytics`,\n id: `google-analytics`,\n branch: `google-analytics`,\n description: `Add Google Analytics to your site.`,\n folder: `packages/plugins/analytics/google-analytics`,\n },\n Posthog: {\n name: `Posthog`,\n id: `posthog`,\n branch: `posthog`,\n description: `Add Posthog Analytics to your site.`,\n folder: `packages/plugins/analytics/posthog`,\n },\n Umami: {\n name: `Umami`,\n id: `umami`,\n branch: `umami`,\n description: `Add Umami Analytics to your site.`,\n folder: `packages/plugins/analytics/umami`,\n },\n Signoz: {\n name: `Signoz`,\n id: `signoz`,\n branch: `signoz`,\n description: `Add Signoz Monitoring to your app.`,\n folder: `packages/plugins/signoz`,\n },\n Paddle: {\n name: `Paddle`,\n id: `paddle`,\n branch: `paddle`,\n description: `Add Paddle Billing to your app.`,\n folder: `packages/plugins/paddle`,\n }\n};\n\nexport function getPluginById(id: string) {\n return Object.values(PluginsModel).find((plugin) => plugin.id === id);\n}\n\nexport function validatePlugin(pluginId: string) {\n const plugin = getPluginById(pluginId);\n\n invariant(plugin, `Plugin ${pluginId} not found`);\n\n return plugin;\n}\n","import { PluginsModel } from '@/src/plugins-model';\nimport invariant from 'tiny-invariant';\n\nexport const KitsModel = {\n NextJsFirebase: {\n name: `Next.js Firebase`,\n id: `next-firebase`,\n repository: `git@github.com:makerkit/next-firebase-saas-kit`,\n blogPath: `_posts`,\n localePath: `public/locales`,\n plugins: [\n PluginsModel.CookieBanner.id,\n PluginsModel.AiChatBot.id,\n PluginsModel.FeedbackPopup.id,\n ],\n },\n NextJsSupabase: {\n name: `Next.js Supabase`,\n id: `next-supabase`,\n localePath: `public/locales`,\n blogPath: `src/content/posts`,\n repository: `git@github.com:makerkit/next-supabase-saas-kit`,\n plugins: [\n PluginsModel.AiChatBot.id,\n PluginsModel.FeedbackPopup.id,\n PluginsModel.CookieBanner.id,\n PluginsModel.AiTextEditor.id,\n ],\n },\n NextJsSupabaseTurbo: {\n name: `Next.js Supabase Turbo`,\n id: `next-supabase-turbo`,\n localePath: `apps/web/public/locales`,\n blogPath: `apps/web/content/posts`,\n repository: `git@github.com:makerkit/next-supabase-saas-kit-turbo`,\n plugins: [\n PluginsModel.Waitlist.id,\n PluginsModel.Testimonial.id,\n PluginsModel.Roadmap.id,\n PluginsModel.Kanban.id,\n PluginsModel.AiChatBotTurbo.id,\n PluginsModel.FeedbackPopupTurbo.id,\n PluginsModel.AiTextEditorTurbo.id,\n PluginsModel.GoogleAnalytics.id,\n PluginsModel.Posthog.id,\n PluginsModel.Umami.id,\n ],\n },\n RemixSupabaseTurbo: {\n name: `Remix Supabase Turbo`,\n id: `remix-supabase-turbo`,\n localePath: `apps/web/public/locales`,\n blogPath: `apps/web/content/posts`,\n repository: `git@github.com:makerkit/remix-supabase-saas-kit-turbo`,\n plugins: [\n PluginsModel.Waitlist.id,\n PluginsModel.Testimonial.id,\n PluginsModel.AiChatBotTurbo.id,\n PluginsModel.FeedbackPopupTurbo.id,\n PluginsModel.AiTextEditorTurbo.id,\n PluginsModel.GoogleAnalytics.id,\n PluginsModel.Posthog.id,\n PluginsModel.Umami.id,\n ],\n },\n NextJsSupabaseLite: {\n name: `Next.js Supabase Lite`,\n id: `next-supabase-lite`,\n localePath: `public/locales`,\n blogPath: `src/content/posts`,\n repository: `git@github.com:makerkit/next-supabase-saas-kit-lite`,\n plugins: [],\n },\n RemixFirebase: {\n name: `Remix Firebase`,\n id: `remix-firebase`,\n localePath: `public/locales`,\n blogPath: '',\n repository: `git@github.com:makerkit/remix-firebase-saas-kit`,\n plugins: [],\n },\n RemixSupabase: {\n name: `Remix Supabase`,\n id: `remix-supabase`,\n localePath: `public/locales`,\n blogPath: `app/content/posts`,\n repository: `git@github.com:makerkit/remix-supabase-saas-kit`,\n plugins: [\n PluginsModel.AiChatBot.id,\n PluginsModel.FeedbackPopup.id,\n PluginsModel.CookieBanner.id,\n PluginsModel.AiTextEditor.id,\n ],\n },\n};\n\nexport function getKitById(id: string) {\n return Object.values(KitsModel).find((kit) => kit.id === id);\n}\n\nexport function validateKit(kitId: string) {\n const kit = getKitById(kitId);\n\n invariant(kit, `Kit ${kitId} not found`);\n\n return kit;\n}\n","import { I18nService } from '@/src/commands/i18n/i18n-service';\nimport chalk from 'chalk';\nimport { Command } from 'commander';\nimport prompts from 'prompts';\n\nexport function createTranslateI18nCommand(parentCommand: Command) {\n return parentCommand\n .command('translate')\n .argument('[source-locale]', 'Source Locale')\n .argument('[target-locale]', 'Target Locale')\n .description('Translate i18n files from source locale to target locale')\n .action(async (sourceLocale, targetLocale) => {\n const locales = await promptLocales(sourceLocale, targetLocale);\n\n await I18nService.translate(locales.sourceLocale, locales.targetLocale);\n });\n}\n\nasync function promptLocales(maybeSource?: string, maybeTarget?: string) {\n const hint = 'e.g. en, fr, es, etc.';\n\n const sourceLocale =\n maybeSource ||\n (\n await prompts([\n {\n type: 'text',\n name: 'locale',\n message: `Enter your ${chalk.cyan('Source Locale')}. ${hint}`,\n hint,\n },\n ])\n ).locale;\n\n const targetLocale =\n maybeTarget ||\n (\n await prompts([\n {\n type: 'text',\n name: 'locale',\n message: `Enter your ${chalk.cyan('Target Locale')}. ${hint}`,\n hint,\n },\n ])\n ).locale;\n\n return {\n sourceLocale,\n targetLocale,\n };\n}\n","import { I18nService } from '@/src/commands/i18n/i18n-service';\nimport { Command } from 'commander';\n\nexport function createVerifyI18nCommand(parentCommand: Command) {\n return parentCommand\n .command('verify')\n .argument('[base-locale]', 'Base Locale')\n .description(\n 'Verify i18n files have no missing keys compared to base locale'\n )\n .action(async (baseLocale = 'en') => {\n await I18nService.verify(baseLocale);\n });\n}\n","import { createTranslateI18nCommand } from '@/src/commands/i18n/translate/translate.command';\nimport { createVerifyI18nCommand } from '@/src/commands/i18n/verify/verify.command';\nimport { Workspace } from '@/src/utils/workspace';\nimport { Command } from 'commander';\n\nexport const i18nCommand = new Command()\n .name('i18n')\n .description('Manage and translate your i18n files')\n .hook('preAction', () => {\n return Workspace.logWorkspaceInfo();\n });\n\n// set children commands\ncreateTranslateI18nCommand(i18nCommand);\ncreateVerifyI18nCommand(i18nCommand);\n","import chalk from 'chalk';\nimport { Command } from 'commander';\nimport ora from 'ora';\nimport prompts from 'prompts';\nimport { z } from 'zod';\n\nconst schema = z.object({\n licenseKey: z.string().min(1).max(32),\n githubUsername: z.string().min(1).max(64),\n});\n\nexport function createActivateLicenseCommand(parentCommand: Command) {\n return parentCommand\n .command('activate')\n .description('Activate your license key for MakerKit')\n .action(async () => {\n const params = await prompts([\n {\n type: 'text',\n name: 'licenseKey',\n message: `Enter your ${chalk.cyan('License Key')}.`,\n validate: (value) => {\n if (value.length < 1) {\n return `Please enter a valid license key`;\n }\n\n return true;\n },\n },\n {\n type: 'text',\n name: 'githubUsername',\n message: `Enter your ${chalk.cyan('Github username')}.`,\n validate: (value) => {\n if (value.length < 1) {\n return `Please enter a valid username`;\n }\n\n return true;\n },\n },\n ]);\n\n const spinner = ora(`Activating license...`).start();\n\n const onError = () => {\n spinner.fail(`Failed to activate license`);\n process.exit(1);\n };\n\n try {\n const response = await activateLicense(schema.parse(params));\n\n if (!response.ok) {\n return onError();\n }\n\n spinner.succeed(`License activated successfully`);\n } catch (e) {\n onError();\n }\n });\n}\n\nasync function activateLicense(params: {\n licenseKey: string;\n githubUsername: string;\n}) {\n return fetch(`https://makerkit.dev/api/ls/license/activate`, {\n method: 'POST',\n body: JSON.stringify(params),\n });\n}\n","import { createActivateLicenseCommand } from '@/src/commands/license/activate/activate-license.command';\nimport { Command } from 'commander';\n\nexport const licenseCommand = new Command()\n .name('license')\n .description('Manage Licenses');\n\ncreateActivateLicenseCommand(licenseCommand);\n","import { join } from 'path';\nimport { KitsModel, validateKit } from '@/src/kits-model';\nimport chalk from 'chalk';\nimport { Command } from 'commander';\nimport { execa } from 'execa';\nimport ora from 'ora';\nimport prompts from 'prompts';\n\nexport const newCommand = new Command()\n .name('new')\n .description('Initialize a new Makerkit project')\n .action(async () => {\n const choices = Object.values(KitsModel).map((kit) => {\n return {\n title: kit.name,\n value: kit.id,\n };\n });\n\n const { kit, name: projectName } = await prompts([\n {\n type: 'select',\n name: 'kit',\n message: `Select the ${chalk.cyan(`SaaS Kit`)} you want to clone`,\n choices,\n },\n {\n type: 'text',\n name: 'name',\n message: `Enter your ${chalk.cyan('Project Name')}.`,\n },\n ]);\n\n const { repository, name: kitName } = validateKit(kit);\n\n const { confirm } = await prompts([\n {\n type: 'confirm',\n name: 'confirm',\n message: `Are you sure you want to clone ${chalk.cyan(\n kitName\n )} to ${chalk.cyan(projectName)}?`,\n },\n ]);\n\n if (!confirm) {\n console.log('Aborting...');\n process.exit(0);\n }\n\n // pull repository from github\n await pullFromGithub(repository, kitName, projectName);\n\n // install dependencies\n await installDependencies(projectName);\n });\n\nasync function pullFromGithub(\n repository: string,\n kit: string,\n projectName: string\n) {\n const spinner = ora(`Cloning ${kit}...`).start();\n\n try {\n await execa('git', ['clone', repository, projectName]);\n\n spinner.succeed(`Cloned ${kit} to ${projectName}...`);\n } catch (e) {\n console.error(e);\n spinner.fail(`Failed to clone ${kit}`);\n\n return Promise.reject(`Failed to clone ${kit}`);\n }\n}\n\nasync function installDependencies(projectName: string) {\n const cwd = join(process.cwd(), projectName);\n const spinner = ora(`Installing dependencies. Please wait...`).start();\n\n try {\n await execa('npm', ['install'], { cwd });\n\n spinner.succeed(`Dependencies successfully installed!`);\n\n console.log(\n `🎉 You can now get started. Open the project in your IDE and read the README.md file for more information.`\n );\n } catch (e) {\n console.error(e);\n spinner.fail(`Failed to install dependencies`);\n\n return Promise.reject(`Failed to install dependencies`);\n }\n}\n","import { validateKit } from '@/src/kits-model';\nimport { PluginsModel, validatePlugin } from '@/src/plugins-model';\nimport { Workspace } from '@/src/utils/workspace';\nimport chalk from 'chalk';\nimport { execaCommand } from 'execa';\nimport ora from 'ora';\nimport prompts from 'prompts';\n\nenum PluginAction {\n Add = 'add',\n Pull = 'pull',\n}\n\nexport class PluginsService {\n static async install(pluginId?: string) {\n const action = PluginAction.Add;\n const plugin = pluginId || (await getPluginFromPrompts(action));\n\n await initPluginCommand(plugin, action);\n }\n\n static async pull(pluginId?: string) {\n const action = PluginAction.Pull;\n const plugin = pluginId || (await getPluginFromPrompts(action));\n\n await initPluginCommand(plugin, action);\n }\n}\n\nasync function initPluginCommand(pluginId: string, action: PluginAction) {\n const { id: kitId } = await Workspace.getKitMeta();\n\n const plugin = validatePlugin(pluginId);\n const kit = validateKit(kitId);\n\n if (!(kit.plugins as string[]).includes(plugin.id)) {\n throw new Error(\n `Plugin ${plugin.name} is not compatible with kit ${kit.name}`\n );\n }\n\n const repository = buildPluginRepositoryName(kit.repository);\n const verb = action === PluginAction.Add ? 'Installing' : 'Updating';\n\n console.log(\n `${verb} ${chalk.cyan(plugin.name)} to kit ${chalk.cyan(\n kit.name\n )} using repo: ${repository} ...`\n );\n\n return executePluginCommand({\n action,\n repository,\n branch: plugin.branch,\n folder: plugin.folder,\n });\n}\n\nasync function getPluginFromPrompts(action: PluginAction) {\n const kit = await Workspace.getKitMeta();\n\n const choices = Object.values(PluginsModel)\n .filter((plugin) => {\n return kit.plugins.includes(plugin.id);\n })\n .map((plugin) => {\n return {\n title: plugin.name,\n value: plugin.id,\n };\n });\n\n const verb = action === PluginAction.Add ? 'install' : 'update';\n\n const { plugin } = await prompts([\n {\n type: 'select',\n name: 'plugin',\n message: `Which ${chalk.cyan('Plugin')} would you like to ${verb}?`,\n choices,\n },\n ]);\n\n return plugin;\n}\n\n// the plugin repository name is the kit repository name + `-plugins`\nfunction buildPluginRepositoryName(repository: string) {\n return repository + `-plugins.git`;\n}\n\nasync function executePluginCommand({\n action,\n repository,\n branch,\n folder,\n}: {\n action: PluginAction;\n repository: string;\n branch: string;\n folder: string;\n}) {\n const verb = action === PluginAction.Add ? 'Installing' : 'Updating';\n const spinner = ora(`${verb} plugin...`).start();\n const commandString = `git subtree ${action} --prefix ${folder} ${repository} ${branch} --squash`;\n\n try {\n await execaCommand(commandString);\n\n const verb = action === PluginAction.Add ? 'installed' : 'updated';\n spinner.succeed(`Plugin ${verb} at ${folder}`);\n } catch (e) {\n console.error(e);\n\n const verb = action === PluginAction.Add ? 'installation' : 'update';\n spinner.fail(`Plugin ${verb} failed`);\n }\n}\n","import { PluginsService } from '@/src/commands/plugins/plugins-service';\nimport { Command } from 'commander';\n\nexport function createInstallPluginCommand(parentCommand: Command) {\n return parentCommand\n .command('install')\n .argument('[plugin-id]', 'Plugin id')\n .description('Install plugin')\n .action(async (maybePluginId) => {\n await PluginsService.install(maybePluginId);\n });\n}\n","import { KitsModel } from '@/src/kits-model';\nimport { validatePlugin } from '@/src/plugins-model';\nimport chalk from 'chalk';\nimport { Command } from 'commander';\n\nexport function createListPluginsCommand(parentCommand: Command) {\n return parentCommand\n .command('list')\n .description('List available plugins.')\n .action(() => {\n const kits = Object.values(KitsModel);\n\n console.log(chalk.white('Makerkit available plugins...'));\n console.log(\n `[${chalk.green('Plugin Name')} (${chalk.gray('plugin-id')})]\\n`\n );\n\n for (const kit of kits) {\n console.log(`${chalk.cyan(kit.name)}`);\n\n if (!kit.plugins.length) {\n console.log(chalk.yellow(`- No plugins available`) + '\\n');\n\n continue;\n }\n\n for (const plugin of kit.plugins) {\n const { name, id } = validatePlugin(plugin);\n console.log(`- ${chalk.green(name)} (${chalk.gray(id)})`);\n }\n\n console.log('');\n }\n });\n}\n","import { PluginsService } from '@/src/commands/plugins/plugins-service';\nimport { Command } from 'commander';\n\nexport function createUpdatePluginCommand(parentCommand: Command) {\n return parentCommand\n .command('update')\n .argument('[plugin-id]', 'Plugin id')\n .description('Update plugin to the latest version')\n .action(async (maybePluginId) => {\n await PluginsService.pull(maybePluginId);\n });\n}\n","import { createInstallPluginCommand } from '@/src/commands/plugins/install/install-plugin.command';\nimport { createListPluginsCommand } from '@/src/commands/plugins/list/list-plugins.command';\nimport { createUpdatePluginCommand } from '@/src/commands/plugins/update/update-plugin.command';\nimport { Workspace } from '@/src/utils/workspace';\nimport { Command } from 'commander';\n\nexport const pluginsCommand = new Command()\n .name('plugins')\n .description('List and install plugins.')\n .hook('preAction', () => {\n return Workspace.logWorkspaceInfo();\n });\n\n// set children commands\ncreateListPluginsCommand(pluginsCommand);\ncreateInstallPluginCommand(pluginsCommand);\ncreateUpdatePluginCommand(pluginsCommand);\n","#!/usr/bin/env node\nimport { i18nCommand } from '@/src/commands/i18n/i18n.command';\nimport { licenseCommand } from '@/src/commands/license/license.command';\nimport { newCommand } from '@/src/commands/new/new.command';\nimport { pluginsCommand } from '@/src/commands/plugins/plugins.command';\nimport { Command } from 'commander';\nimport { config } from 'dotenv';\n\nconfig({\n path: '.env.local',\n});\n\nprocess.on('SIGINT', () => process.exit(0));\nprocess.on('SIGTERM', () => process.exit(0));\n\nasync function main() {\n const program = new Command()\n .name('makerkit')\n .description(\n 'Your SaaS Kit companion. Add plugins, manage migrations, and more.'\n )\n .version('-v, --version', 'display the version number');\n\n program\n .addCommand(newCommand)\n .addCommand(pluginsCommand)\n .addCommand(i18nCommand)\n .addCommand(licenseCommand);\n\n program.parse();\n}\n\nvoid main();\n"],"mappings":";;;AAAA,SAAS,QAAAA,aAAY;;;ACArB,OAAO,YAAY;AAEnB,SAAS,kBAAkB;AACzB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c;;;ACXxC,SAAS,WAAAC,gBAAe;AACxB,SAAS,cAAc;AAEvB,OAAO;AAAA,EACL,MAAM;AACR,CAAC;AAED,QAAQ,GAAG,UAAU,MAAM,QAAQ,KAAK,CAAC,CAAC;AAC1C,QAAQ,GAAG,WAAW,MAAM,QAAQ,KAAK,CAAC,CAAC;AAE3C,eAAe,OAAO;AACpB,QAAM,UAAU,IAAIA,SAAQ,EACzB,KAAK,UAAU,EACf;AAAA,IACC;AAAA,EACF,EACC,QAAQ,iBAAiB,4BAA4B;AAExD,UACG,WAAW,UAAU,EACrB,WAAW,cAAc,EACzB,WAAW,WAAW,EACtB,WAAW,cAAc;AAE5B,UAAQ,MAAM;AAChB;AAEA,KAAK,KAAK;","names":["join","invariant","chalk","fs","join","chalk","chalk","prompts","Command","join","chalk","Command","ora","prompts","kit","join","chalk","ora","prompts","chalk","plugin","prompts","ora","verb","chalk","Command","Command"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@makerkit/cli",
3
- "version": "1.3.13",
3
+ "version": "1.3.14",
4
4
  "description": "A CLI for Makerkit",
5
5
  "type": "module",
6
6
  "exports": "./dist/index.js",