@makerkit/cli 1.3.13 → 1.3.15
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 +5 -26
- package/dist/index.d.ts +0 -0
- package/dist/index.js +105 -232
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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
|
|
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.
|
|
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/
|
|
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) {
|
|
@@ -158,7 +188,9 @@ var KitsModel = {
|
|
|
158
188
|
PluginsModel.AiTextEditorTurbo.id,
|
|
159
189
|
PluginsModel.GoogleAnalytics.id,
|
|
160
190
|
PluginsModel.Posthog.id,
|
|
161
|
-
PluginsModel.Umami.id
|
|
191
|
+
PluginsModel.Umami.id,
|
|
192
|
+
PluginsModel.Signoz.id,
|
|
193
|
+
PluginsModel.Paddle.id
|
|
162
194
|
]
|
|
163
195
|
},
|
|
164
196
|
RemixSupabaseTurbo: {
|
|
@@ -217,21 +249,7 @@ function validateKit(kitId) {
|
|
|
217
249
|
return kit;
|
|
218
250
|
}
|
|
219
251
|
|
|
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
252
|
// src/utils/workspace.ts
|
|
234
|
-
import { join } from "path";
|
|
235
253
|
import chalk from "chalk";
|
|
236
254
|
import fs from "fs-extra";
|
|
237
255
|
var Workspace = class _Workspace {
|
|
@@ -293,154 +311,9 @@ async function getPackageJson() {
|
|
|
293
311
|
return fs.readJSON(join(process.cwd(), "package.json")).catch(() => void 0);
|
|
294
312
|
}
|
|
295
313
|
|
|
296
|
-
// src/commands/
|
|
314
|
+
// src/commands/i18n/i18n-service.ts
|
|
297
315
|
import chalk2 from "chalk";
|
|
298
316
|
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
317
|
var I18nService = class {
|
|
445
318
|
/**
|
|
446
319
|
* @name verify
|
|
@@ -448,28 +321,28 @@ var I18nService = class {
|
|
|
448
321
|
*/
|
|
449
322
|
static async verify(base = "en") {
|
|
450
323
|
const kit = await Workspace.getKitMeta();
|
|
451
|
-
const allLocales =
|
|
324
|
+
const allLocales = fs2.readdirSync(kit.localePath).filter((locale) => {
|
|
452
325
|
return locale !== base;
|
|
453
326
|
});
|
|
454
327
|
const baseLocaleFolderPath = `${kit.localePath}/${base}`;
|
|
455
|
-
const localeFiles =
|
|
328
|
+
const localeFiles = fs2.readdirSync(baseLocaleFolderPath).filter((file) => {
|
|
456
329
|
return file.endsWith(".json");
|
|
457
330
|
});
|
|
458
331
|
for (const localeFile of localeFiles) {
|
|
459
332
|
for (const locale of allLocales) {
|
|
460
333
|
const baseLocaleFilePath = `${baseLocaleFolderPath}/${localeFile}`;
|
|
461
334
|
const targetLocaleFilePath = `${kit.localePath}/${locale}/${localeFile}`;
|
|
462
|
-
const baseLocaleFile =
|
|
463
|
-
const file =
|
|
335
|
+
const baseLocaleFile = fs2.readJSONSync(baseLocaleFilePath);
|
|
336
|
+
const file = fs2.readJSONSync(targetLocaleFilePath);
|
|
464
337
|
const missingKeys = collectMissingKeys([baseLocaleFile, file]);
|
|
465
338
|
if (!missingKeys.length) {
|
|
466
339
|
console.log(
|
|
467
|
-
|
|
340
|
+
chalk2.green(`Locale ${locale}/${localeFile} is in sync!`)
|
|
468
341
|
);
|
|
469
342
|
continue;
|
|
470
343
|
}
|
|
471
344
|
console.log(
|
|
472
|
-
|
|
345
|
+
chalk2.yellow(
|
|
473
346
|
`Locale ${locale}/${localeFile} is missing the following keys: ${missingKeys.join(
|
|
474
347
|
", "
|
|
475
348
|
)}`
|
|
@@ -489,28 +362,28 @@ var I18nService = class {
|
|
|
489
362
|
const client = openai_client_default();
|
|
490
363
|
const targetJsonPath = `${kit.localePath}/${target}`;
|
|
491
364
|
const sourceLocalePath = `${kit.localePath}/${source}`;
|
|
492
|
-
const sourceLocale = await
|
|
365
|
+
const sourceLocale = await fs2.exists(sourceLocalePath);
|
|
493
366
|
if (!sourceLocale) {
|
|
494
367
|
throw new Error(`Source locale at ${sourceLocalePath} not found`);
|
|
495
368
|
}
|
|
496
|
-
const files =
|
|
369
|
+
const files = fs2.readdirSync(sourceLocalePath).filter((file) => {
|
|
497
370
|
return file.endsWith(".json");
|
|
498
371
|
});
|
|
499
372
|
console.log(`Found the following files: ${files.join(", ")}`);
|
|
500
373
|
for (const file of files) {
|
|
501
374
|
const data = {};
|
|
502
|
-
const localeFile =
|
|
375
|
+
const localeFile = fs2.readJSONSync(join2(sourceLocalePath, file));
|
|
503
376
|
console.log(
|
|
504
|
-
|
|
377
|
+
chalk2.cyan(`Translating "${file}". This can take a while...`)
|
|
505
378
|
);
|
|
506
379
|
for (const key in localeFile) {
|
|
507
380
|
data[key] = await translateKey(source, target, localeFile[key], client);
|
|
508
381
|
}
|
|
509
|
-
console.log(
|
|
510
|
-
console.log(
|
|
511
|
-
await
|
|
512
|
-
await
|
|
513
|
-
console.log(
|
|
382
|
+
console.log(chalk2.green(`File "${file}" successfully translated!`));
|
|
383
|
+
console.log(chalk2.cyan(`Writing file "${file}" to ${targetJsonPath}`));
|
|
384
|
+
await fs2.exists(targetJsonPath) || await fs2.mkdir(targetJsonPath);
|
|
385
|
+
await fs2.writeJSON(join2(targetJsonPath, file), data, {});
|
|
386
|
+
console.log(chalk2.green(`File "${file}" successfully written!`));
|
|
514
387
|
}
|
|
515
388
|
}
|
|
516
389
|
};
|
|
@@ -562,8 +435,8 @@ function collectMissingKeys(objects) {
|
|
|
562
435
|
}
|
|
563
436
|
|
|
564
437
|
// src/commands/i18n/translate/translate.command.ts
|
|
565
|
-
import
|
|
566
|
-
import
|
|
438
|
+
import chalk3 from "chalk";
|
|
439
|
+
import prompts from "prompts";
|
|
567
440
|
function createTranslateI18nCommand(parentCommand) {
|
|
568
441
|
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
442
|
const locales = await promptLocales(sourceLocale, targetLocale);
|
|
@@ -572,19 +445,19 @@ function createTranslateI18nCommand(parentCommand) {
|
|
|
572
445
|
}
|
|
573
446
|
async function promptLocales(maybeSource, maybeTarget) {
|
|
574
447
|
const hint = "e.g. en, fr, es, etc.";
|
|
575
|
-
const sourceLocale = maybeSource || (await
|
|
448
|
+
const sourceLocale = maybeSource || (await prompts([
|
|
576
449
|
{
|
|
577
450
|
type: "text",
|
|
578
451
|
name: "locale",
|
|
579
|
-
message: `Enter your ${
|
|
452
|
+
message: `Enter your ${chalk3.cyan("Source Locale")}. ${hint}`,
|
|
580
453
|
hint
|
|
581
454
|
}
|
|
582
455
|
])).locale;
|
|
583
|
-
const targetLocale = maybeTarget || (await
|
|
456
|
+
const targetLocale = maybeTarget || (await prompts([
|
|
584
457
|
{
|
|
585
458
|
type: "text",
|
|
586
459
|
name: "locale",
|
|
587
|
-
message: `Enter your ${
|
|
460
|
+
message: `Enter your ${chalk3.cyan("Target Locale")}. ${hint}`,
|
|
588
461
|
hint
|
|
589
462
|
}
|
|
590
463
|
])).locale;
|
|
@@ -604,29 +477,29 @@ function createVerifyI18nCommand(parentCommand) {
|
|
|
604
477
|
}
|
|
605
478
|
|
|
606
479
|
// src/commands/i18n/i18n.command.ts
|
|
607
|
-
import { Command
|
|
608
|
-
var i18nCommand = new
|
|
480
|
+
import { Command } from "commander";
|
|
481
|
+
var i18nCommand = new Command().name("i18n").description("Manage and translate your i18n files").hook("preAction", () => {
|
|
609
482
|
return Workspace.logWorkspaceInfo();
|
|
610
483
|
});
|
|
611
484
|
createTranslateI18nCommand(i18nCommand);
|
|
612
485
|
createVerifyI18nCommand(i18nCommand);
|
|
613
486
|
|
|
614
487
|
// src/commands/license/activate/activate-license.command.ts
|
|
615
|
-
import
|
|
616
|
-
import
|
|
617
|
-
import
|
|
618
|
-
import { z
|
|
619
|
-
var
|
|
620
|
-
licenseKey:
|
|
621
|
-
githubUsername:
|
|
488
|
+
import chalk4 from "chalk";
|
|
489
|
+
import ora from "ora";
|
|
490
|
+
import prompts2 from "prompts";
|
|
491
|
+
import { z } from "zod";
|
|
492
|
+
var schema = z.object({
|
|
493
|
+
licenseKey: z.string().min(1).max(32),
|
|
494
|
+
githubUsername: z.string().min(1).max(64)
|
|
622
495
|
});
|
|
623
496
|
function createActivateLicenseCommand(parentCommand) {
|
|
624
497
|
return parentCommand.command("activate").description("Activate your license key for MakerKit").action(async () => {
|
|
625
|
-
const params = await
|
|
498
|
+
const params = await prompts2([
|
|
626
499
|
{
|
|
627
500
|
type: "text",
|
|
628
501
|
name: "licenseKey",
|
|
629
|
-
message: `Enter your ${
|
|
502
|
+
message: `Enter your ${chalk4.cyan("License Key")}.`,
|
|
630
503
|
validate: (value) => {
|
|
631
504
|
if (value.length < 1) {
|
|
632
505
|
return `Please enter a valid license key`;
|
|
@@ -637,7 +510,7 @@ function createActivateLicenseCommand(parentCommand) {
|
|
|
637
510
|
{
|
|
638
511
|
type: "text",
|
|
639
512
|
name: "githubUsername",
|
|
640
|
-
message: `Enter your ${
|
|
513
|
+
message: `Enter your ${chalk4.cyan("Github username")}.`,
|
|
641
514
|
validate: (value) => {
|
|
642
515
|
if (value.length < 1) {
|
|
643
516
|
return `Please enter a valid username`;
|
|
@@ -646,13 +519,13 @@ function createActivateLicenseCommand(parentCommand) {
|
|
|
646
519
|
}
|
|
647
520
|
}
|
|
648
521
|
]);
|
|
649
|
-
const spinner =
|
|
522
|
+
const spinner = ora(`Activating license...`).start();
|
|
650
523
|
const onError = () => {
|
|
651
524
|
spinner.fail(`Failed to activate license`);
|
|
652
525
|
process.exit(1);
|
|
653
526
|
};
|
|
654
527
|
try {
|
|
655
|
-
const response = await activateLicense(
|
|
528
|
+
const response = await activateLicense(schema.parse(params));
|
|
656
529
|
if (!response.ok) {
|
|
657
530
|
return onError();
|
|
658
531
|
}
|
|
@@ -670,45 +543,45 @@ async function activateLicense(params) {
|
|
|
670
543
|
}
|
|
671
544
|
|
|
672
545
|
// src/commands/license/license.command.ts
|
|
673
|
-
import { Command as
|
|
674
|
-
var licenseCommand = new
|
|
546
|
+
import { Command as Command2 } from "commander";
|
|
547
|
+
var licenseCommand = new Command2().name("license").description("Manage Licenses");
|
|
675
548
|
createActivateLicenseCommand(licenseCommand);
|
|
676
549
|
|
|
677
550
|
// src/commands/new/new.command.ts
|
|
678
|
-
import { join as
|
|
679
|
-
import
|
|
680
|
-
import { Command as
|
|
551
|
+
import { join as join3 } from "path";
|
|
552
|
+
import chalk5 from "chalk";
|
|
553
|
+
import { Command as Command3 } from "commander";
|
|
681
554
|
import { execa } from "execa";
|
|
682
|
-
import
|
|
683
|
-
import
|
|
684
|
-
var newCommand = new
|
|
555
|
+
import ora2 from "ora";
|
|
556
|
+
import prompts3 from "prompts";
|
|
557
|
+
var newCommand = new Command3().name("new").description("Initialize a new Makerkit project").action(async () => {
|
|
685
558
|
const choices = Object.values(KitsModel).map((kit2) => {
|
|
686
559
|
return {
|
|
687
560
|
title: kit2.name,
|
|
688
561
|
value: kit2.id
|
|
689
562
|
};
|
|
690
563
|
});
|
|
691
|
-
const { kit, name: projectName } = await
|
|
564
|
+
const { kit, name: projectName } = await prompts3([
|
|
692
565
|
{
|
|
693
566
|
type: "select",
|
|
694
567
|
name: "kit",
|
|
695
|
-
message: `Select the ${
|
|
568
|
+
message: `Select the ${chalk5.cyan(`SaaS Kit`)} you want to clone`,
|
|
696
569
|
choices
|
|
697
570
|
},
|
|
698
571
|
{
|
|
699
572
|
type: "text",
|
|
700
573
|
name: "name",
|
|
701
|
-
message: `Enter your ${
|
|
574
|
+
message: `Enter your ${chalk5.cyan("Project Name")}.`
|
|
702
575
|
}
|
|
703
576
|
]);
|
|
704
577
|
const { repository, name: kitName } = validateKit(kit);
|
|
705
|
-
const { confirm } = await
|
|
578
|
+
const { confirm } = await prompts3([
|
|
706
579
|
{
|
|
707
580
|
type: "confirm",
|
|
708
581
|
name: "confirm",
|
|
709
|
-
message: `Are you sure you want to clone ${
|
|
582
|
+
message: `Are you sure you want to clone ${chalk5.cyan(
|
|
710
583
|
kitName
|
|
711
|
-
)} to ${
|
|
584
|
+
)} to ${chalk5.cyan(projectName)}?`
|
|
712
585
|
}
|
|
713
586
|
]);
|
|
714
587
|
if (!confirm) {
|
|
@@ -719,7 +592,7 @@ var newCommand = new Command4().name("new").description("Initialize a new Makerk
|
|
|
719
592
|
await installDependencies(projectName);
|
|
720
593
|
});
|
|
721
594
|
async function pullFromGithub(repository, kit, projectName) {
|
|
722
|
-
const spinner =
|
|
595
|
+
const spinner = ora2(`Cloning ${kit}...`).start();
|
|
723
596
|
try {
|
|
724
597
|
await execa("git", ["clone", repository, projectName]);
|
|
725
598
|
spinner.succeed(`Cloned ${kit} to ${projectName}...`);
|
|
@@ -730,8 +603,8 @@ async function pullFromGithub(repository, kit, projectName) {
|
|
|
730
603
|
}
|
|
731
604
|
}
|
|
732
605
|
async function installDependencies(projectName) {
|
|
733
|
-
const cwd =
|
|
734
|
-
const spinner =
|
|
606
|
+
const cwd = join3(process.cwd(), projectName);
|
|
607
|
+
const spinner = ora2(`Installing dependencies. Please wait...`).start();
|
|
735
608
|
try {
|
|
736
609
|
await execa("npm", ["install"], { cwd });
|
|
737
610
|
spinner.succeed(`Dependencies successfully installed!`);
|
|
@@ -746,10 +619,10 @@ async function installDependencies(projectName) {
|
|
|
746
619
|
}
|
|
747
620
|
|
|
748
621
|
// src/commands/plugins/plugins-service.ts
|
|
749
|
-
import
|
|
622
|
+
import chalk6 from "chalk";
|
|
750
623
|
import { execaCommand } from "execa";
|
|
751
|
-
import
|
|
752
|
-
import
|
|
624
|
+
import ora3 from "ora";
|
|
625
|
+
import prompts4 from "prompts";
|
|
753
626
|
var PluginsService = class {
|
|
754
627
|
static async install(pluginId) {
|
|
755
628
|
const action = "add" /* Add */;
|
|
@@ -774,7 +647,7 @@ async function initPluginCommand(pluginId, action) {
|
|
|
774
647
|
const repository = buildPluginRepositoryName(kit.repository);
|
|
775
648
|
const verb = action === "add" /* Add */ ? "Installing" : "Updating";
|
|
776
649
|
console.log(
|
|
777
|
-
`${verb} ${
|
|
650
|
+
`${verb} ${chalk6.cyan(plugin.name)} to kit ${chalk6.cyan(
|
|
778
651
|
kit.name
|
|
779
652
|
)} using repo: ${repository} ...`
|
|
780
653
|
);
|
|
@@ -796,11 +669,11 @@ async function getPluginFromPrompts(action) {
|
|
|
796
669
|
};
|
|
797
670
|
});
|
|
798
671
|
const verb = action === "add" /* Add */ ? "install" : "update";
|
|
799
|
-
const { plugin } = await
|
|
672
|
+
const { plugin } = await prompts4([
|
|
800
673
|
{
|
|
801
674
|
type: "select",
|
|
802
675
|
name: "plugin",
|
|
803
|
-
message: `Which ${
|
|
676
|
+
message: `Which ${chalk6.cyan("Plugin")} would you like to ${verb}?`,
|
|
804
677
|
choices
|
|
805
678
|
}
|
|
806
679
|
]);
|
|
@@ -816,7 +689,7 @@ async function executePluginCommand({
|
|
|
816
689
|
folder
|
|
817
690
|
}) {
|
|
818
691
|
const verb = action === "add" /* Add */ ? "Installing" : "Updating";
|
|
819
|
-
const spinner =
|
|
692
|
+
const spinner = ora3(`${verb} plugin...`).start();
|
|
820
693
|
const commandString = `git subtree ${action} --prefix ${folder} ${repository} ${branch} --squash`;
|
|
821
694
|
try {
|
|
822
695
|
await execaCommand(commandString);
|
|
@@ -837,24 +710,24 @@ function createInstallPluginCommand(parentCommand) {
|
|
|
837
710
|
}
|
|
838
711
|
|
|
839
712
|
// src/commands/plugins/list/list-plugins.command.ts
|
|
840
|
-
import
|
|
713
|
+
import chalk7 from "chalk";
|
|
841
714
|
function createListPluginsCommand(parentCommand) {
|
|
842
715
|
return parentCommand.command("list").description("List available plugins.").action(() => {
|
|
843
716
|
const kits = Object.values(KitsModel);
|
|
844
|
-
console.log(
|
|
717
|
+
console.log(chalk7.white("Makerkit available plugins..."));
|
|
845
718
|
console.log(
|
|
846
|
-
`[${
|
|
719
|
+
`[${chalk7.green("Plugin Name")} (${chalk7.gray("plugin-id")})]
|
|
847
720
|
`
|
|
848
721
|
);
|
|
849
722
|
for (const kit of kits) {
|
|
850
|
-
console.log(`${
|
|
723
|
+
console.log(`${chalk7.cyan(kit.name)}`);
|
|
851
724
|
if (!kit.plugins.length) {
|
|
852
|
-
console.log(
|
|
725
|
+
console.log(chalk7.yellow(`- No plugins available`) + "\n");
|
|
853
726
|
continue;
|
|
854
727
|
}
|
|
855
728
|
for (const plugin of kit.plugins) {
|
|
856
729
|
const { name, id } = validatePlugin(plugin);
|
|
857
|
-
console.log(`- ${
|
|
730
|
+
console.log(`- ${chalk7.green(name)} (${chalk7.gray(id)})`);
|
|
858
731
|
}
|
|
859
732
|
console.log("");
|
|
860
733
|
}
|
|
@@ -869,8 +742,8 @@ function createUpdatePluginCommand(parentCommand) {
|
|
|
869
742
|
}
|
|
870
743
|
|
|
871
744
|
// src/commands/plugins/plugins.command.ts
|
|
872
|
-
import { Command as
|
|
873
|
-
var pluginsCommand = new
|
|
745
|
+
import { Command as Command4 } from "commander";
|
|
746
|
+
var pluginsCommand = new Command4().name("plugins").description("List and install plugins.").hook("preAction", () => {
|
|
874
747
|
return Workspace.logWorkspaceInfo();
|
|
875
748
|
});
|
|
876
749
|
createListPluginsCommand(pluginsCommand);
|
|
@@ -878,7 +751,7 @@ createInstallPluginCommand(pluginsCommand);
|
|
|
878
751
|
createUpdatePluginCommand(pluginsCommand);
|
|
879
752
|
|
|
880
753
|
// src/index.ts
|
|
881
|
-
import { Command as
|
|
754
|
+
import { Command as Command5 } from "commander";
|
|
882
755
|
import { config } from "dotenv";
|
|
883
756
|
config({
|
|
884
757
|
path: ".env.local"
|
|
@@ -886,10 +759,10 @@ config({
|
|
|
886
759
|
process.on("SIGINT", () => process.exit(0));
|
|
887
760
|
process.on("SIGTERM", () => process.exit(0));
|
|
888
761
|
async function main() {
|
|
889
|
-
const program = new
|
|
762
|
+
const program = new Command5().name("makerkit").description(
|
|
890
763
|
"Your SaaS Kit companion. Add plugins, manage migrations, and more."
|
|
891
764
|
).version("-v, --version", "display the version number");
|
|
892
|
-
program.addCommand(newCommand).addCommand(pluginsCommand).addCommand(i18nCommand).addCommand(licenseCommand)
|
|
765
|
+
program.addCommand(newCommand).addCommand(pluginsCommand).addCommand(i18nCommand).addCommand(licenseCommand);
|
|
893
766
|
program.parse();
|
|
894
767
|
}
|
|
895
768
|
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,QAAQ;AAAA,IACR,aAAa;AAAA,IACb,QAAQ;AAAA,EACV;AAAA,EACA,WAAW;AAAA,IACT,MAAM;AAAA,IACN,IAAI;AAAA,IACJ,QAAQ;AAAA,IACR,aAAa;AAAA,IACb,QAAQ;AAAA,EACV;AAAA,EACA,eAAe;AAAA,IACb,MAAM;AAAA,I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AAI,KAAKA,OAAM,MAAM,IAAI,CAAC,KAAKA,OAAM,KAAK,EAAE,CAAC,GAAG;AAAA,MAC1D;AAEA,cAAQ,IAAI,EAAE;AAAA,IAChB;AAAA,EACF,CAAC;AACL;;;AC/BO,SAAS,0BAA0B,eAAwB;AAChE,SAAO,cACJ,QAAQ,QAAQ,EAChB,SAAS,eAAe,WAAW,EACnC,YAAY,qCAAqC,EACjD,OAAO,OAAO,kBAAkB;AAC/B,UAAM,eAAe,KAAK,aAAa;AAAA,EACzC,CAAC;AACL;;;ACPA,SAAS,WAAAC,gBAAe;AAEjB,IAAM,iBAAiB,IAAIA,SAAQ,EACvC,KAAK,SAAS,EACd,YAAY,2BAA2B,EACvC,KAAK,aAAa,MAAM;AACvB,SAAO,UAAU,iBAAiB;AACpC,CAAC;AAGH,yBAAyB,cAAc;AACvC,2BAA2B,cAAc;AACzC,0BAA0B,cAAc;;;ACVxC,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,EACzB,WAAW,WAAW;AAEzB,UAAQ,MAAM;AAChB;AAEA,KAAK,KAAK;","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 PluginsModel.Signoz.id,\n PluginsModel.Paddle.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,QAAM,SAAS,QAAQ,IAAI;AAE3B,MAAI,CAAC,QAAQ;AACX,UAAM,IAAI;AAAA,MACR;AAAA,IAEF;AAAA,EACF;AAEA,SAAO,IAAI,OAAO,EAAE,OAAO,CAAC;AAC9B;AAEA,I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AU,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"]}
|