create-githat-app 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +51 -16
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -11,7 +11,7 @@ import gradient from "gradient-string";
|
|
|
11
11
|
import chalk from "chalk";
|
|
12
12
|
|
|
13
13
|
// src/constants.ts
|
|
14
|
-
var VERSION = "0.
|
|
14
|
+
var VERSION = "1.0.3";
|
|
15
15
|
var DEFAULT_API_URL = "https://api.githat.io";
|
|
16
16
|
var DASHBOARD_URL = "https://githat.io/dashboard/apps";
|
|
17
17
|
var BRAND_COLORS = ["#7c3aed", "#6366f1", "#8b5cf6"];
|
|
@@ -21,7 +21,7 @@ var DEPS = {
|
|
|
21
21
|
next: "^16.0.0",
|
|
22
22
|
react: "^19.0.0",
|
|
23
23
|
"react-dom": "^19.0.0",
|
|
24
|
-
"@githat/nextjs": "^0.
|
|
24
|
+
"@githat/nextjs": "^0.2.2"
|
|
25
25
|
},
|
|
26
26
|
devDependencies: {
|
|
27
27
|
typescript: "^5.9.0",
|
|
@@ -35,7 +35,7 @@ var DEPS = {
|
|
|
35
35
|
react: "^19.0.0",
|
|
36
36
|
"react-dom": "^19.0.0",
|
|
37
37
|
"react-router-dom": "^7.0.0",
|
|
38
|
-
"@githat/nextjs": "^0.
|
|
38
|
+
"@githat/nextjs": "^0.2.2"
|
|
39
39
|
},
|
|
40
40
|
devDependencies: {
|
|
41
41
|
vite: "^7.0.0",
|
|
@@ -388,7 +388,34 @@ async function promptFinalize() {
|
|
|
388
388
|
}
|
|
389
389
|
|
|
390
390
|
// src/prompts/index.ts
|
|
391
|
+
function toDisplayName(projectName) {
|
|
392
|
+
return projectName.replace(/[-_]/g, " ").replace(/\b\w/g, (c) => c.toUpperCase());
|
|
393
|
+
}
|
|
394
|
+
function getDefaults(projectName, publishableKey, typescript) {
|
|
395
|
+
const displayName = toDisplayName(projectName);
|
|
396
|
+
return {
|
|
397
|
+
projectName,
|
|
398
|
+
businessName: displayName,
|
|
399
|
+
description: `${displayName} \u2014 Built with GitHat`,
|
|
400
|
+
framework: "nextjs",
|
|
401
|
+
typescript: typescript ?? true,
|
|
402
|
+
packageManager: detectPackageManager(),
|
|
403
|
+
publishableKey: publishableKey || "",
|
|
404
|
+
apiUrl: DEFAULT_API_URL,
|
|
405
|
+
authFeatures: ["forgot-password"],
|
|
406
|
+
databaseChoice: "none",
|
|
407
|
+
useTailwind: true,
|
|
408
|
+
includeDashboard: true,
|
|
409
|
+
includeGithatFolder: true,
|
|
410
|
+
initGit: true,
|
|
411
|
+
installDeps: true
|
|
412
|
+
};
|
|
413
|
+
}
|
|
391
414
|
async function runPrompts(args) {
|
|
415
|
+
if (args.yes && args.initialName) {
|
|
416
|
+
p6.log.info("Using defaults (--yes flag)");
|
|
417
|
+
return getDefaults(args.initialName, args.publishableKey, args.typescript);
|
|
418
|
+
}
|
|
392
419
|
p6.intro("Let\u2019s set up your GitHat app");
|
|
393
420
|
sectionHeader("Project");
|
|
394
421
|
const project = await promptProject(args.initialName);
|
|
@@ -635,16 +662,18 @@ async function scaffold(context, options) {
|
|
|
635
662
|
}
|
|
636
663
|
p7.outro("Setup complete!");
|
|
637
664
|
displaySuccess(context.projectName, context.packageManager, context.framework, !!context.publishableKey);
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
665
|
+
if (!options.skipPrompts) {
|
|
666
|
+
const starPrompt = await p7.confirm({
|
|
667
|
+
message: "Star GitHat on GitHub? (helps us grow!)",
|
|
668
|
+
initialValue: false
|
|
669
|
+
});
|
|
670
|
+
if (!p7.isCancel(starPrompt) && starPrompt) {
|
|
671
|
+
try {
|
|
672
|
+
const cmd = process.platform === "darwin" ? "open" : process.platform === "win32" ? "start" : "xdg-open";
|
|
673
|
+
execSync3(`${cmd} "https://github.com/GitHat-IO/githat"`, { stdio: "ignore" });
|
|
674
|
+
} catch {
|
|
675
|
+
p7.log.info("Visit https://github.com/GitHat-IO/githat to star us!");
|
|
676
|
+
}
|
|
648
677
|
}
|
|
649
678
|
}
|
|
650
679
|
}
|
|
@@ -1225,19 +1254,25 @@ skillsCommand.action(() => {
|
|
|
1225
1254
|
// src/cli.ts
|
|
1226
1255
|
var program = new Command7();
|
|
1227
1256
|
program.name("githat").description("GitHat CLI - Scaffold apps and manage skills").version(VERSION);
|
|
1228
|
-
program.command("create [project-name]", { isDefault: true }).description("Scaffold a new GitHat app").option("--key <key>", "GitHat publishable key (pk_live_...)").option("--ts", "Use TypeScript (default)").option("--js", "Use JavaScript").action(async (projectName, opts) => {
|
|
1257
|
+
program.command("create [project-name]", { isDefault: true }).description("Scaffold a new GitHat app").option("--key <key>", "GitHat publishable key (pk_live_...)").option("--ts", "Use TypeScript (default)").option("--js", "Use JavaScript").option("-y, --yes", "Skip prompts and use defaults").action(async (projectName, opts) => {
|
|
1229
1258
|
try {
|
|
1230
1259
|
displayBanner();
|
|
1231
1260
|
const typescript = opts.js ? false : opts.ts ? true : void 0;
|
|
1261
|
+
if (opts.yes && !projectName) {
|
|
1262
|
+
p9.cancel(chalk9.red("Project name is required when using --yes flag"));
|
|
1263
|
+
process.exit(1);
|
|
1264
|
+
}
|
|
1232
1265
|
const answers = await runPrompts({
|
|
1233
1266
|
initialName: projectName,
|
|
1234
1267
|
publishableKey: opts.key,
|
|
1235
|
-
typescript
|
|
1268
|
+
typescript,
|
|
1269
|
+
yes: opts.yes
|
|
1236
1270
|
});
|
|
1237
1271
|
const context = answersToContext(answers);
|
|
1238
1272
|
await scaffold(context, {
|
|
1239
1273
|
installDeps: answers.installDeps,
|
|
1240
|
-
initGit: answers.initGit
|
|
1274
|
+
initGit: answers.initGit,
|
|
1275
|
+
skipPrompts: opts.yes
|
|
1241
1276
|
});
|
|
1242
1277
|
} catch (err) {
|
|
1243
1278
|
p9.cancel(chalk9.red(err.message || "Something went wrong."));
|