@nimbuslab/cli 0.6.2 → 0.7.0
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/.github/workflows/publish.yml +2 -0
- package/dist/index.js +115 -115
- package/docs/CI-CD.md +172 -0
- package/package.json +1 -1
- package/src/commands/create.ts +95 -95
- package/src/index.ts +20 -20
package/dist/index.js
CHANGED
|
@@ -921,7 +921,7 @@ async function ensureRailwayCli() {
|
|
|
921
921
|
const hasRailway = await $2`${checkCmd} railway`.quiet().then(() => true).catch(() => false);
|
|
922
922
|
if (hasRailway)
|
|
923
923
|
return true;
|
|
924
|
-
console.log(import_picocolors3.default.yellow("Railway CLI
|
|
924
|
+
console.log(import_picocolors3.default.yellow("Railway CLI not found. Installing..."));
|
|
925
925
|
console.log();
|
|
926
926
|
try {
|
|
927
927
|
if (process.platform === "win32") {
|
|
@@ -929,11 +929,11 @@ async function ensureRailwayCli() {
|
|
|
929
929
|
} else {
|
|
930
930
|
await $2`curl -fsSL https://railway.app/install.sh | sh`.quiet();
|
|
931
931
|
}
|
|
932
|
-
console.log(import_picocolors3.default.green("Railway CLI
|
|
932
|
+
console.log(import_picocolors3.default.green("Railway CLI installed successfully!"));
|
|
933
933
|
return true;
|
|
934
934
|
} catch (error) {
|
|
935
|
-
console.log(import_picocolors3.default.red("
|
|
936
|
-
console.log(import_picocolors3.default.dim("
|
|
935
|
+
console.log(import_picocolors3.default.red("Error installing Railway CLI."));
|
|
936
|
+
console.log(import_picocolors3.default.dim("Install manually: https://docs.railway.app/guides/cli"));
|
|
937
937
|
return false;
|
|
938
938
|
}
|
|
939
939
|
}
|
|
@@ -961,8 +961,8 @@ async function create(args) {
|
|
|
961
961
|
const hasGit = await $2`${checkCmd} git`.quiet().then(() => true).catch(() => false);
|
|
962
962
|
const hasGh = await $2`${checkCmd} gh`.quiet().then(() => true).catch(() => false);
|
|
963
963
|
if (!hasBun) {
|
|
964
|
-
console.log(import_picocolors3.default.red("
|
|
965
|
-
console.log(import_picocolors3.default.dim("
|
|
964
|
+
console.log(import_picocolors3.default.red("Error: Bun not found."));
|
|
965
|
+
console.log(import_picocolors3.default.dim("Install from: https://bun.sh"));
|
|
966
966
|
console.log();
|
|
967
967
|
if (process.platform === "win32") {
|
|
968
968
|
console.log(import_picocolors3.default.cyan('powershell -c "irm bun.sh/install.ps1 | iex"'));
|
|
@@ -973,13 +973,13 @@ async function create(args) {
|
|
|
973
973
|
process.exit(1);
|
|
974
974
|
}
|
|
975
975
|
if (!hasGit) {
|
|
976
|
-
console.log(import_picocolors3.default.red("
|
|
977
|
-
console.log(import_picocolors3.default.dim("
|
|
976
|
+
console.log(import_picocolors3.default.red("Error: Git not found."));
|
|
977
|
+
console.log(import_picocolors3.default.dim("Install git to continue."));
|
|
978
978
|
process.exit(1);
|
|
979
979
|
}
|
|
980
980
|
if (!hasGh) {
|
|
981
|
-
console.log(import_picocolors3.default.red("
|
|
982
|
-
console.log(import_picocolors3.default.dim("
|
|
981
|
+
console.log(import_picocolors3.default.red("Error: GitHub CLI (gh) not found."));
|
|
982
|
+
console.log(import_picocolors3.default.dim("Install from: https://cli.github.com"));
|
|
983
983
|
console.log();
|
|
984
984
|
if (process.platform === "win32") {
|
|
985
985
|
console.log(import_picocolors3.default.cyan("winget install GitHub.cli"));
|
|
@@ -991,21 +991,21 @@ async function create(args) {
|
|
|
991
991
|
}
|
|
992
992
|
const ghAuth = await $2`gh auth status`.quiet().then(() => true).catch(() => false);
|
|
993
993
|
if (!ghAuth) {
|
|
994
|
-
console.log(import_picocolors3.default.red("
|
|
995
|
-
console.log(import_picocolors3.default.dim("
|
|
994
|
+
console.log(import_picocolors3.default.red("Error: GitHub CLI not authenticated."));
|
|
995
|
+
console.log(import_picocolors3.default.dim("Run: gh auth login"));
|
|
996
996
|
process.exit(1);
|
|
997
997
|
}
|
|
998
998
|
const hasRailway = await ensureRailwayCli();
|
|
999
999
|
if (hasRailway) {
|
|
1000
1000
|
const railwayAuth = await isRailwayAuthenticated();
|
|
1001
1001
|
if (!railwayAuth) {
|
|
1002
|
-
console.log(import_picocolors3.default.yellow("Railway CLI
|
|
1003
|
-
console.log(import_picocolors3.default.dim("
|
|
1002
|
+
console.log(import_picocolors3.default.yellow("Railway CLI not authenticated."));
|
|
1003
|
+
console.log(import_picocolors3.default.dim("Run: railway login"));
|
|
1004
1004
|
console.log();
|
|
1005
1005
|
}
|
|
1006
1006
|
}
|
|
1007
1007
|
const { flags, projectName } = parseFlags(args);
|
|
1008
|
-
Ie(import_picocolors3.default.bgCyan(import_picocolors3.default.black("
|
|
1008
|
+
Ie(import_picocolors3.default.bgCyan(import_picocolors3.default.black(" New nimbuslab Project ")));
|
|
1009
1009
|
let config;
|
|
1010
1010
|
const hasTypeFlag = flags.landing || flags.app || flags.turborepo || flags.fast || flags.fastPlus || flags.fastTurborepo;
|
|
1011
1011
|
const typeFromFlag = flags.landing ? "landing" : flags.app ? "app" : flags.turborepo ? "turborepo" : flags.fastTurborepo ? "fast+" : flags.fastPlus ? "fast+" : flags.fast ? "fast" : null;
|
|
@@ -1032,10 +1032,10 @@ async function create(args) {
|
|
|
1032
1032
|
customTemplate: flags.template
|
|
1033
1033
|
};
|
|
1034
1034
|
const typeLabel = flags.turborepo ? "fast+ (monorepo)" : config.type;
|
|
1035
|
-
console.log(import_picocolors3.default.dim(`
|
|
1036
|
-
console.log(import_picocolors3.default.dim(`
|
|
1037
|
-
console.log(import_picocolors3.default.dim(` Git: ${config.git ? "
|
|
1038
|
-
console.log(import_picocolors3.default.dim(`
|
|
1035
|
+
console.log(import_picocolors3.default.dim(` Project: ${projectName}`));
|
|
1036
|
+
console.log(import_picocolors3.default.dim(` Type: ${typeLabel}`));
|
|
1037
|
+
console.log(import_picocolors3.default.dim(` Git: ${config.git ? "yes" : "no"}`));
|
|
1038
|
+
console.log(import_picocolors3.default.dim(` Install: ${config.install ? "yes" : "no"}`));
|
|
1039
1039
|
if (flags.railway)
|
|
1040
1040
|
console.log(import_picocolors3.default.dim(` Railway: configurar`));
|
|
1041
1041
|
if (flags.template)
|
|
@@ -1052,7 +1052,7 @@ async function create(args) {
|
|
|
1052
1052
|
console.log(import_picocolors3.default.green(` Railway: ${fastProject}`));
|
|
1053
1053
|
}
|
|
1054
1054
|
} else {
|
|
1055
|
-
console.log(import_picocolors3.default.dim(`
|
|
1055
|
+
console.log(import_picocolors3.default.dim(` Creating project Railway: ${projectName}...`));
|
|
1056
1056
|
try {
|
|
1057
1057
|
const result = await $2`echo "" | railway init -n ${projectName} -w nimbuslab --json`.text();
|
|
1058
1058
|
const newProject = JSON.parse(result);
|
|
@@ -1063,7 +1063,7 @@ async function create(args) {
|
|
|
1063
1063
|
}
|
|
1064
1064
|
}
|
|
1065
1065
|
} else {
|
|
1066
|
-
console.log(import_picocolors3.default.yellow(` Railway:
|
|
1066
|
+
console.log(import_picocolors3.default.yellow(` Railway: not authenticated (railway login)`));
|
|
1067
1067
|
}
|
|
1068
1068
|
console.log();
|
|
1069
1069
|
}
|
|
@@ -1071,27 +1071,27 @@ async function create(args) {
|
|
|
1071
1071
|
config = await promptConfig(projectName, flags);
|
|
1072
1072
|
}
|
|
1073
1073
|
if (pD(config)) {
|
|
1074
|
-
xe("
|
|
1074
|
+
xe("Operation cancelled");
|
|
1075
1075
|
process.exit(0);
|
|
1076
1076
|
}
|
|
1077
1077
|
await createProject(config);
|
|
1078
|
-
Se(import_picocolors3.default.green("
|
|
1078
|
+
Se(import_picocolors3.default.green("Project created successfully!"));
|
|
1079
1079
|
showNextSteps(config);
|
|
1080
1080
|
}
|
|
1081
1081
|
async function promptConfig(initialName, flags) {
|
|
1082
1082
|
const { isMember, user } = await isNimbuslabMember();
|
|
1083
|
-
const greeting = user ? `
|
|
1083
|
+
const greeting = user ? `Hello, ${user}!` : "Hello!";
|
|
1084
1084
|
console.log(import_picocolors3.default.dim(` ${greeting}`));
|
|
1085
1085
|
console.log();
|
|
1086
1086
|
const name = await he({
|
|
1087
|
-
message: "
|
|
1087
|
+
message: "Project name:",
|
|
1088
1088
|
placeholder: "meu-projeto",
|
|
1089
1089
|
initialValue: initialName,
|
|
1090
1090
|
validate: (value) => {
|
|
1091
1091
|
if (!value)
|
|
1092
|
-
return "
|
|
1092
|
+
return "Name is required";
|
|
1093
1093
|
if (!/^[a-z0-9-]+$/.test(value)) {
|
|
1094
|
-
return "Use
|
|
1094
|
+
return "Use only lowercase letters, numbers and hyphens";
|
|
1095
1095
|
}
|
|
1096
1096
|
return;
|
|
1097
1097
|
}
|
|
@@ -1119,29 +1119,29 @@ async function promptConfig(initialName, flags) {
|
|
|
1119
1119
|
{
|
|
1120
1120
|
value: "fast",
|
|
1121
1121
|
label: "fast",
|
|
1122
|
-
hint: "Landing page
|
|
1122
|
+
hint: "Landing page fast methodology"
|
|
1123
1123
|
},
|
|
1124
1124
|
{
|
|
1125
1125
|
value: "fast+",
|
|
1126
1126
|
label: "fast+",
|
|
1127
|
-
hint: "SaaS
|
|
1127
|
+
hint: "Complete SaaS"
|
|
1128
1128
|
}
|
|
1129
1129
|
] : [];
|
|
1130
1130
|
const type = await ve({
|
|
1131
|
-
message: "
|
|
1131
|
+
message: "Project type:",
|
|
1132
1132
|
options: [...publicOptions, ...privateOptions]
|
|
1133
1133
|
});
|
|
1134
1134
|
if (pD(type))
|
|
1135
1135
|
return type;
|
|
1136
1136
|
const isPublicTemplate = ["landing", "app", "turborepo"].includes(type);
|
|
1137
1137
|
if (!isMember && !isPublicTemplate) {
|
|
1138
|
-
console.log(import_picocolors3.default.red("
|
|
1138
|
+
console.log(import_picocolors3.default.red("Error: Template available only for nimbuslab members"));
|
|
1139
1139
|
process.exit(1);
|
|
1140
1140
|
}
|
|
1141
1141
|
let monorepo = false;
|
|
1142
1142
|
if (type === "fast+") {
|
|
1143
1143
|
const useMonorepo = await ye({
|
|
1144
|
-
message: "
|
|
1144
|
+
message: "Use monorepo (Turborepo)?",
|
|
1145
1145
|
initialValue: false
|
|
1146
1146
|
});
|
|
1147
1147
|
if (pD(useMonorepo))
|
|
@@ -1149,7 +1149,7 @@ async function promptConfig(initialName, flags) {
|
|
|
1149
1149
|
monorepo = useMonorepo;
|
|
1150
1150
|
}
|
|
1151
1151
|
const git = await ye({
|
|
1152
|
-
message: "
|
|
1152
|
+
message: "Initialize Git repository?",
|
|
1153
1153
|
initialValue: true
|
|
1154
1154
|
});
|
|
1155
1155
|
if (pD(git))
|
|
@@ -1159,7 +1159,7 @@ async function promptConfig(initialName, flags) {
|
|
|
1159
1159
|
let githubDescription = "";
|
|
1160
1160
|
if (git) {
|
|
1161
1161
|
const createGithub = await ye({
|
|
1162
|
-
message: "
|
|
1162
|
+
message: "Create GitHub repository?",
|
|
1163
1163
|
initialValue: false
|
|
1164
1164
|
});
|
|
1165
1165
|
if (pD(createGithub))
|
|
@@ -1167,19 +1167,19 @@ async function promptConfig(initialName, flags) {
|
|
|
1167
1167
|
github = createGithub;
|
|
1168
1168
|
if (github) {
|
|
1169
1169
|
const org = await ve({
|
|
1170
|
-
message: "
|
|
1170
|
+
message: "GitHub organization:",
|
|
1171
1171
|
options: [
|
|
1172
|
-
{ value: "nimbuslab", label: "nimbuslab", hint: "
|
|
1173
|
-
{ value: "fast-by-nimbuslab", label: "fast-by-nimbuslab", hint: "
|
|
1172
|
+
{ value: "nimbuslab", label: "nimbuslab", hint: "Main org" },
|
|
1173
|
+
{ value: "fast-by-nimbuslab", label: "fast-by-nimbuslab", hint: "Client projects" },
|
|
1174
1174
|
{ value: "nimbuslab-templates", label: "nimbuslab-templates", hint: "Templates" },
|
|
1175
|
-
{ value: null, label: "Pessoal", hint: "
|
|
1175
|
+
{ value: null, label: "Pessoal", hint: "Personal" }
|
|
1176
1176
|
]
|
|
1177
1177
|
});
|
|
1178
1178
|
if (pD(org))
|
|
1179
1179
|
return org;
|
|
1180
1180
|
githubOrg = org;
|
|
1181
1181
|
const description = await he({
|
|
1182
|
-
message: "
|
|
1182
|
+
message: "Repository description:",
|
|
1183
1183
|
placeholder: "Landing page para cliente X",
|
|
1184
1184
|
initialValue: type === "fast" ? "Landing page fast by nimbuslab" : "SaaS fast+ by nimbuslab"
|
|
1185
1185
|
});
|
|
@@ -1191,9 +1191,9 @@ async function promptConfig(initialName, flags) {
|
|
|
1191
1191
|
let contractNumber = "";
|
|
1192
1192
|
if (type === "fast") {
|
|
1193
1193
|
const contract = await he({
|
|
1194
|
-
message: "
|
|
1194
|
+
message: "Contract number (ex: 001):",
|
|
1195
1195
|
placeholder: "001",
|
|
1196
|
-
validate: (v2) => v2 ? undefined : "
|
|
1196
|
+
validate: (v2) => v2 ? undefined : "Contract number is required for fast"
|
|
1197
1197
|
});
|
|
1198
1198
|
if (pD(contract))
|
|
1199
1199
|
return contract;
|
|
@@ -1201,7 +1201,7 @@ async function promptConfig(initialName, flags) {
|
|
|
1201
1201
|
}
|
|
1202
1202
|
if (isPublicTemplate) {
|
|
1203
1203
|
const install2 = await ye({
|
|
1204
|
-
message: "
|
|
1204
|
+
message: "Install dependencies?",
|
|
1205
1205
|
initialValue: true
|
|
1206
1206
|
});
|
|
1207
1207
|
if (pD(install2))
|
|
@@ -1238,11 +1238,11 @@ async function promptConfig(initialName, flags) {
|
|
|
1238
1238
|
const defaultFromEmail = "no-reply@nimbuslab.com.br";
|
|
1239
1239
|
const defaultContactEmail = type === "fast" ? "fast@nimbuslab.com.br" : "suporte@nimbuslab.com.br";
|
|
1240
1240
|
const infraOptions = await fe({
|
|
1241
|
-
message: "
|
|
1241
|
+
message: "What do you want to configure now?",
|
|
1242
1242
|
options: [
|
|
1243
|
-
{ value: "urls", label: "URLs", hint: "staging
|
|
1244
|
-
{ value: "resend", label: "Resend", hint: "emails
|
|
1245
|
-
{ value: "railway", label: "Railway", hint: "deploy
|
|
1243
|
+
{ value: "urls", label: "URLs", hint: "staging and production" },
|
|
1244
|
+
{ value: "resend", label: "Resend", hint: "form emails" },
|
|
1245
|
+
{ value: "railway", label: "Railway", hint: "deploy and hosting" }
|
|
1246
1246
|
],
|
|
1247
1247
|
required: false
|
|
1248
1248
|
});
|
|
@@ -1251,9 +1251,9 @@ async function promptConfig(initialName, flags) {
|
|
|
1251
1251
|
const configItems = infraOptions;
|
|
1252
1252
|
if (configItems.includes("urls")) {
|
|
1253
1253
|
console.log();
|
|
1254
|
-
console.log(import_picocolors3.default.dim(" URLs
|
|
1254
|
+
console.log(import_picocolors3.default.dim(" Project URLs"));
|
|
1255
1255
|
const staging = await he({
|
|
1256
|
-
message: "URL
|
|
1256
|
+
message: "Staging URL:",
|
|
1257
1257
|
placeholder: defaultStagingUrl,
|
|
1258
1258
|
initialValue: defaultStagingUrl
|
|
1259
1259
|
});
|
|
@@ -1261,7 +1261,7 @@ async function promptConfig(initialName, flags) {
|
|
|
1261
1261
|
return staging;
|
|
1262
1262
|
stagingUrl = staging;
|
|
1263
1263
|
const production = await he({
|
|
1264
|
-
message: "URL
|
|
1264
|
+
message: "Production URL:",
|
|
1265
1265
|
placeholder: defaultStagingUrl.replace(".nimbuslab.net.br", ".com.br"),
|
|
1266
1266
|
initialValue: ""
|
|
1267
1267
|
});
|
|
@@ -1280,7 +1280,7 @@ async function promptConfig(initialName, flags) {
|
|
|
1280
1280
|
return resendKey;
|
|
1281
1281
|
resendApiKey = resendKey;
|
|
1282
1282
|
const fromEmail = await he({
|
|
1283
|
-
message: "
|
|
1283
|
+
message: "From email:",
|
|
1284
1284
|
placeholder: defaultFromEmail,
|
|
1285
1285
|
initialValue: defaultFromEmail
|
|
1286
1286
|
});
|
|
@@ -1288,7 +1288,7 @@ async function promptConfig(initialName, flags) {
|
|
|
1288
1288
|
return fromEmail;
|
|
1289
1289
|
resendFromEmail = fromEmail;
|
|
1290
1290
|
const contact = await he({
|
|
1291
|
-
message: "
|
|
1291
|
+
message: "Contact email (receives forms):",
|
|
1292
1292
|
placeholder: defaultContactEmail,
|
|
1293
1293
|
initialValue: defaultContactEmail
|
|
1294
1294
|
});
|
|
@@ -1306,49 +1306,49 @@ async function promptConfig(initialName, flags) {
|
|
|
1306
1306
|
const fastProject = projects.find((p2) => p2.toLowerCase().includes("fast by nimbuslab"));
|
|
1307
1307
|
if (fastProject) {
|
|
1308
1308
|
railwayProject = fastProject;
|
|
1309
|
-
console.log(import_picocolors3.default.green(`
|
|
1309
|
+
console.log(import_picocolors3.default.green(` Project: ${fastProject} (automatico)`));
|
|
1310
1310
|
} else {
|
|
1311
|
-
console.log(import_picocolors3.default.yellow("
|
|
1312
|
-
console.log(import_picocolors3.default.dim(" Configure
|
|
1311
|
+
console.log(import_picocolors3.default.yellow(" Project 'Fast by nimbuslab' not found."));
|
|
1312
|
+
console.log(import_picocolors3.default.dim(" Configure manually in .env"));
|
|
1313
1313
|
}
|
|
1314
1314
|
} else {
|
|
1315
1315
|
const projectOptions = [
|
|
1316
1316
|
...projects.map((proj) => ({ value: proj, label: proj })),
|
|
1317
|
-
{ value: "__new__", label: "
|
|
1318
|
-
{ value: "__skip__", label: "
|
|
1317
|
+
{ value: "__new__", label: "Create new project", hint: "via railway init" },
|
|
1318
|
+
{ value: "__skip__", label: "Skip", hint: "Configure later" }
|
|
1319
1319
|
];
|
|
1320
1320
|
const selectedProject = await ve({
|
|
1321
|
-
message: "
|
|
1321
|
+
message: "Railway project for this SaaS:",
|
|
1322
1322
|
options: projectOptions
|
|
1323
1323
|
});
|
|
1324
1324
|
if (pD(selectedProject))
|
|
1325
1325
|
return selectedProject;
|
|
1326
1326
|
if (selectedProject === "__new__") {
|
|
1327
1327
|
const projectNameForRailway = name;
|
|
1328
|
-
console.log(import_picocolors3.default.dim(`
|
|
1328
|
+
console.log(import_picocolors3.default.dim(` Creating project "${projectNameForRailway}" on Railway...`));
|
|
1329
1329
|
try {
|
|
1330
1330
|
const result = await $2`echo "" | railway init -n ${projectNameForRailway} -w nimbuslab --json`.text();
|
|
1331
1331
|
const newProject = JSON.parse(result);
|
|
1332
1332
|
railwayProject = newProject.name || projectNameForRailway;
|
|
1333
|
-
console.log(import_picocolors3.default.green(` Projeto "${railwayProject}"
|
|
1333
|
+
console.log(import_picocolors3.default.green(` Projeto "${railwayProject}" created successfully!`));
|
|
1334
1334
|
console.log(import_picocolors3.default.dim(` ID: ${newProject.id || "N/A"}`));
|
|
1335
1335
|
} catch (error) {
|
|
1336
|
-
console.log(import_picocolors3.default.yellow("
|
|
1337
|
-
console.log(import_picocolors3.default.dim("
|
|
1336
|
+
console.log(import_picocolors3.default.yellow(" Error creating project via CLI."));
|
|
1337
|
+
console.log(import_picocolors3.default.dim(" Create manually at: https://railway.app/new"));
|
|
1338
1338
|
}
|
|
1339
1339
|
} else if (selectedProject !== "__skip__") {
|
|
1340
1340
|
railwayProject = selectedProject;
|
|
1341
|
-
console.log(import_picocolors3.default.green(`
|
|
1341
|
+
console.log(import_picocolors3.default.green(` Project selected: ${railwayProject}`));
|
|
1342
1342
|
}
|
|
1343
1343
|
}
|
|
1344
1344
|
} else {
|
|
1345
1345
|
console.log();
|
|
1346
|
-
console.log(import_picocolors3.default.yellow(" Railway:
|
|
1347
|
-
console.log(import_picocolors3.default.dim(" Configure
|
|
1346
|
+
console.log(import_picocolors3.default.yellow(" Railway: not authenticated (railway login)"));
|
|
1347
|
+
console.log(import_picocolors3.default.dim(" Configure manually in .env"));
|
|
1348
1348
|
}
|
|
1349
1349
|
}
|
|
1350
1350
|
const install = await ye({
|
|
1351
|
-
message: "
|
|
1351
|
+
message: "Install dependencies?",
|
|
1352
1352
|
initialValue: true
|
|
1353
1353
|
});
|
|
1354
1354
|
if (pD(install))
|
|
@@ -1386,7 +1386,7 @@ async function createProject(config) {
|
|
|
1386
1386
|
templateLabel = config.monorepo ? `${config.type} (monorepo)` : config.type;
|
|
1387
1387
|
}
|
|
1388
1388
|
const isPublicTemplate = ["landing", "app", "turborepo"].includes(config.type);
|
|
1389
|
-
s.start(`
|
|
1389
|
+
s.start(`Cloning template ${templateLabel}...`);
|
|
1390
1390
|
try {
|
|
1391
1391
|
if (isPublicTemplate) {
|
|
1392
1392
|
const httpsUrl = `https://github.com/${templateRepo}.git`;
|
|
@@ -1395,27 +1395,27 @@ async function createProject(config) {
|
|
|
1395
1395
|
await $2`gh repo clone ${templateRepo} ${config.name} -- --depth 1`.quiet();
|
|
1396
1396
|
}
|
|
1397
1397
|
await rm(join(config.name, ".git"), { recursive: true, force: true });
|
|
1398
|
-
s.stop(`Template
|
|
1398
|
+
s.stop(`Template cloned`);
|
|
1399
1399
|
} catch (error) {
|
|
1400
|
-
s.stop("
|
|
1401
|
-
throw new Error(`
|
|
1400
|
+
s.stop("Error cloning template");
|
|
1401
|
+
throw new Error(`Failed to clone template ${templateRepo}. Check your connection or repository access.`);
|
|
1402
1402
|
}
|
|
1403
|
-
s.start("
|
|
1403
|
+
s.start("Configuring project...");
|
|
1404
1404
|
try {
|
|
1405
1405
|
const pkgPath = `${config.name}/package.json`;
|
|
1406
1406
|
const pkg = await Bun.file(pkgPath).json();
|
|
1407
1407
|
pkg.name = config.name;
|
|
1408
1408
|
await Bun.write(pkgPath, JSON.stringify(pkg, null, 2));
|
|
1409
|
-
s.stop("
|
|
1409
|
+
s.stop("Project configured");
|
|
1410
1410
|
} catch (error) {
|
|
1411
|
-
s.stop("
|
|
1411
|
+
s.stop("Error configuring");
|
|
1412
1412
|
}
|
|
1413
1413
|
if (config.type === "fast+") {
|
|
1414
1414
|
s.start("Configurando fast+ (SaaS)...");
|
|
1415
1415
|
s.stop("Configuracao fast+ preparada");
|
|
1416
1416
|
}
|
|
1417
1417
|
if (config.git) {
|
|
1418
|
-
s.start("
|
|
1418
|
+
s.start("Initializing Git...");
|
|
1419
1419
|
try {
|
|
1420
1420
|
const cwd = config.name;
|
|
1421
1421
|
await $2`git init -b main`.cwd(cwd).quiet();
|
|
@@ -1423,12 +1423,12 @@ async function createProject(config) {
|
|
|
1423
1423
|
await $2`git commit -m "chore: setup inicial via nimbus create"`.cwd(cwd).quiet();
|
|
1424
1424
|
await $2`git checkout -b staging`.cwd(cwd).quiet();
|
|
1425
1425
|
await $2`git checkout -b develop`.cwd(cwd).quiet();
|
|
1426
|
-
s.stop("Git
|
|
1426
|
+
s.stop("Git initialized (main -> staging -> develop)");
|
|
1427
1427
|
} catch (error) {
|
|
1428
|
-
s.stop("
|
|
1428
|
+
s.stop("Error initializing Git");
|
|
1429
1429
|
}
|
|
1430
1430
|
if (config.github) {
|
|
1431
|
-
s.start("
|
|
1431
|
+
s.start("Creating GitHub repository...");
|
|
1432
1432
|
try {
|
|
1433
1433
|
const cwd = config.name;
|
|
1434
1434
|
const repoName = config.githubOrg ? `${config.githubOrg}/${config.name}` : config.name;
|
|
@@ -1442,8 +1442,8 @@ async function createProject(config) {
|
|
|
1442
1442
|
await $2`git push -u origin develop`.cwd(cwd).quiet();
|
|
1443
1443
|
s.stop(`GitHub: ${repoName} criado`);
|
|
1444
1444
|
} catch (error) {
|
|
1445
|
-
s.stop("
|
|
1446
|
-
console.log(import_picocolors3.default.dim("
|
|
1445
|
+
s.stop("Error creating GitHub repository");
|
|
1446
|
+
console.log(import_picocolors3.default.dim(" You can create manually with: gh repo create"));
|
|
1447
1447
|
}
|
|
1448
1448
|
}
|
|
1449
1449
|
}
|
|
@@ -1453,8 +1453,8 @@ async function createProject(config) {
|
|
|
1453
1453
|
await $2`railway link -p ${config.railwayProject}`.cwd(config.name).quiet();
|
|
1454
1454
|
s.stop(`Railway linkado: ${config.railwayProject}`);
|
|
1455
1455
|
} catch (error) {
|
|
1456
|
-
s.stop("
|
|
1457
|
-
console.log(import_picocolors3.default.dim("
|
|
1456
|
+
s.stop("Error linking Railway");
|
|
1457
|
+
console.log(import_picocolors3.default.dim(" Run manually: railway link"));
|
|
1458
1458
|
}
|
|
1459
1459
|
}
|
|
1460
1460
|
if (config.resendApiKey || config.stagingUrl) {
|
|
@@ -1464,16 +1464,16 @@ async function createProject(config) {
|
|
|
1464
1464
|
await Bun.write(`${config.name}/.env`, envContent);
|
|
1465
1465
|
s.stop("Arquivo .env criado");
|
|
1466
1466
|
} catch (error) {
|
|
1467
|
-
s.stop("
|
|
1467
|
+
s.stop("Error creating .env");
|
|
1468
1468
|
}
|
|
1469
1469
|
}
|
|
1470
1470
|
if (config.install) {
|
|
1471
|
-
s.start("
|
|
1471
|
+
s.start("Installing dependencies (pode demorar)...");
|
|
1472
1472
|
try {
|
|
1473
1473
|
await $2`bun install`.cwd(config.name).quiet();
|
|
1474
|
-
s.stop("
|
|
1474
|
+
s.stop("Dependencies installed");
|
|
1475
1475
|
} catch (error) {
|
|
1476
|
-
s.stop("
|
|
1476
|
+
s.stop("Error installing dependencies");
|
|
1477
1477
|
}
|
|
1478
1478
|
}
|
|
1479
1479
|
}
|
|
@@ -1499,7 +1499,7 @@ function generateEnvFile(config) {
|
|
|
1499
1499
|
lines.push("");
|
|
1500
1500
|
lines.push("# Railway");
|
|
1501
1501
|
if (config.railwayProject) {
|
|
1502
|
-
lines.push(`#
|
|
1502
|
+
lines.push(`# Project: ${config.railwayProject}`);
|
|
1503
1503
|
}
|
|
1504
1504
|
lines.push(`RAILWAY_TOKEN=${config.railwayToken || "# Configure com: railway link"}`);
|
|
1505
1505
|
}
|
|
@@ -1519,7 +1519,7 @@ function generateEnvFile(config) {
|
|
|
1519
1519
|
function showNextSteps(config) {
|
|
1520
1520
|
const isPublicTemplate = ["landing", "app", "turborepo"].includes(config.type);
|
|
1521
1521
|
console.log();
|
|
1522
|
-
console.log(import_picocolors3.default.bold("
|
|
1522
|
+
console.log(import_picocolors3.default.bold("Next steps:"));
|
|
1523
1523
|
console.log();
|
|
1524
1524
|
console.log(` ${import_picocolors3.default.cyan("cd")} ${config.name}`);
|
|
1525
1525
|
if (!config.install) {
|
|
@@ -1531,43 +1531,43 @@ function showNextSteps(config) {
|
|
|
1531
1531
|
console.log(` ${import_picocolors3.default.cyan("bun")} dev`);
|
|
1532
1532
|
console.log();
|
|
1533
1533
|
if (config.git) {
|
|
1534
|
-
console.log(import_picocolors3.default.dim(" Git flow: main -> staging -> develop (branch
|
|
1534
|
+
console.log(import_picocolors3.default.dim(" Git flow: main -> staging -> develop (current branch)"));
|
|
1535
1535
|
console.log();
|
|
1536
1536
|
if (config.github) {
|
|
1537
1537
|
const repoUrl = config.githubOrg ? `https://github.com/${config.githubOrg}/${config.name}` : `https://github.com/${config.name}`;
|
|
1538
1538
|
console.log(import_picocolors3.default.green(` GitHub: ${repoUrl}`));
|
|
1539
1539
|
console.log();
|
|
1540
1540
|
} else {
|
|
1541
|
-
console.log(import_picocolors3.default.yellow("
|
|
1541
|
+
console.log(import_picocolors3.default.yellow(" Tip: To create GitHub repo, use 'gh repo create' ou 'bun setup'."));
|
|
1542
1542
|
console.log();
|
|
1543
1543
|
}
|
|
1544
1544
|
}
|
|
1545
1545
|
if (config.type === "fast+") {
|
|
1546
|
-
console.log(import_picocolors3.default.dim("
|
|
1546
|
+
console.log(import_picocolors3.default.dim(" Tip: For fast+, configure DATABASE_URL e BETTER_AUTH_SECRET no .env"));
|
|
1547
1547
|
if (!config.railwayToken) {
|
|
1548
|
-
console.log(import_picocolors3.default.dim(" Railway:
|
|
1548
|
+
console.log(import_picocolors3.default.dim(" Railway: Create a project at https://railway.app/new"));
|
|
1549
1549
|
}
|
|
1550
1550
|
console.log();
|
|
1551
1551
|
}
|
|
1552
1552
|
if (config.resendApiKey || config.stagingUrl) {
|
|
1553
|
-
console.log(import_picocolors3.default.green(" .env
|
|
1553
|
+
console.log(import_picocolors3.default.green(" .env configured successfully!"));
|
|
1554
1554
|
console.log();
|
|
1555
1555
|
} else {
|
|
1556
|
-
console.log(import_picocolors3.default.yellow("
|
|
1556
|
+
console.log(import_picocolors3.default.yellow(" Tip: Configure .env manually or use 'bun setup'."));
|
|
1557
1557
|
console.log();
|
|
1558
1558
|
}
|
|
1559
1559
|
if (isPublicTemplate) {
|
|
1560
|
-
console.log(import_picocolors3.default.dim("
|
|
1561
|
-
console.log(import_picocolors3.default.dim(`
|
|
1560
|
+
console.log(import_picocolors3.default.dim(" Open source template (MIT) by nimbuslab"));
|
|
1561
|
+
console.log(import_picocolors3.default.dim(` Documentation: https://github.com/nimbuslab/create-next-${config.type === "turborepo" ? "turborepo" : config.type}`));
|
|
1562
1562
|
} else {
|
|
1563
|
-
console.log(import_picocolors3.default.dim("
|
|
1563
|
+
console.log(import_picocolors3.default.dim(" Documentation: https://github.com/nimbuslab-templates"));
|
|
1564
1564
|
}
|
|
1565
1565
|
console.log();
|
|
1566
1566
|
}
|
|
1567
1567
|
|
|
1568
1568
|
// src/index.ts
|
|
1569
1569
|
var PACKAGE_NAME = "@nimbuslab/cli";
|
|
1570
|
-
var CURRENT_VERSION = "0.
|
|
1570
|
+
var CURRENT_VERSION = "0.7.0";
|
|
1571
1571
|
var LOGO = `
|
|
1572
1572
|
\u2588\u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2557\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557
|
|
1573
1573
|
\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2551\u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D
|
|
@@ -1599,8 +1599,8 @@ function showUpdateNotice(latestVersion) {
|
|
|
1599
1599
|
const current = CURRENT_VERSION;
|
|
1600
1600
|
const latest = latestVersion;
|
|
1601
1601
|
const command = `bun add -g ${PACKAGE_NAME}`;
|
|
1602
|
-
const line1 = `
|
|
1603
|
-
const line2 = `
|
|
1602
|
+
const line1 = ` New version available: ${current} \u2192 ${latest}`;
|
|
1603
|
+
const line2 = ` Update with: ${command}`;
|
|
1604
1604
|
const maxLen = Math.max(line1.length, line2.length);
|
|
1605
1605
|
const border = "\u2500".repeat(maxLen + 2);
|
|
1606
1606
|
console.log(import_picocolors4.default.yellow(` \u250C${border}\u2510`));
|
|
@@ -1613,8 +1613,8 @@ async function main() {
|
|
|
1613
1613
|
const args = process.argv.slice(2);
|
|
1614
1614
|
const command = args[0];
|
|
1615
1615
|
console.log(import_picocolors4.default.cyan(LOGO));
|
|
1616
|
-
console.log(import_picocolors4.default.white(" CLI
|
|
1617
|
-
console.log(import_picocolors4.default.dim("
|
|
1616
|
+
console.log(import_picocolors4.default.white(" nimbuslab CLI"));
|
|
1617
|
+
console.log(import_picocolors4.default.dim(" Create awesome projects"));
|
|
1618
1618
|
console.log();
|
|
1619
1619
|
const latestVersion = await checkForUpdates();
|
|
1620
1620
|
if (latestVersion) {
|
|
@@ -1627,35 +1627,35 @@ async function main() {
|
|
|
1627
1627
|
} else if (command === "version" || command === "--version" || command === "-v") {
|
|
1628
1628
|
showVersion();
|
|
1629
1629
|
} else {
|
|
1630
|
-
console.log(import_picocolors4.default.red(`
|
|
1630
|
+
console.log(import_picocolors4.default.red(`Unknown command: ${command}`));
|
|
1631
1631
|
showHelp();
|
|
1632
1632
|
process.exit(1);
|
|
1633
1633
|
}
|
|
1634
1634
|
}
|
|
1635
1635
|
function showHelp() {
|
|
1636
1636
|
console.log(`
|
|
1637
|
-
${import_picocolors4.default.bold("
|
|
1637
|
+
${import_picocolors4.default.bold("Usage:")} nimbus [command] [options]
|
|
1638
1638
|
|
|
1639
|
-
${import_picocolors4.default.bold("
|
|
1640
|
-
create [
|
|
1641
|
-
help
|
|
1642
|
-
version
|
|
1639
|
+
${import_picocolors4.default.bold("Commands:")}
|
|
1640
|
+
create [name] Create a new project
|
|
1641
|
+
help Show this help
|
|
1642
|
+
version Show version
|
|
1643
1643
|
|
|
1644
1644
|
${import_picocolors4.default.bold("Templates:")}
|
|
1645
1645
|
--landing Landing page (Next.js 16 + Tailwind 4 + shadcn)
|
|
1646
1646
|
--app Web app (Landing + Better Auth + Prisma)
|
|
1647
1647
|
--turborepo Monorepo (Turborepo + apps/packages)
|
|
1648
1648
|
|
|
1649
|
-
${import_picocolors4.default.bold("
|
|
1650
|
-
-y, --yes
|
|
1651
|
-
--no-git
|
|
1652
|
-
--no-install
|
|
1653
|
-
--template <url>
|
|
1649
|
+
${import_picocolors4.default.bold("Options:")}
|
|
1650
|
+
-y, --yes Accept defaults
|
|
1651
|
+
--no-git Don't initialize Git
|
|
1652
|
+
--no-install Don't install dependencies
|
|
1653
|
+
--template <url> Use custom template
|
|
1654
1654
|
|
|
1655
|
-
${import_picocolors4.default.bold("
|
|
1656
|
-
${import_picocolors4.default.dim("$")} nimbus create
|
|
1657
|
-
${import_picocolors4.default.dim("$")} nimbus create
|
|
1658
|
-
${import_picocolors4.default.dim("$")} nimbus create
|
|
1655
|
+
${import_picocolors4.default.bold("Examples:")}
|
|
1656
|
+
${import_picocolors4.default.dim("$")} nimbus create my-landing --landing
|
|
1657
|
+
${import_picocolors4.default.dim("$")} nimbus create my-app --app
|
|
1658
|
+
${import_picocolors4.default.dim("$")} nimbus create my-monorepo --turborepo
|
|
1659
1659
|
`);
|
|
1660
1660
|
}
|
|
1661
1661
|
function showVersion() {
|