create-stackforge 0.1.2 → 0.1.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 +31 -18
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -275,7 +275,6 @@ async function promptForConfig(input) {
|
|
|
275
275
|
|
|
276
276
|
// src/generators/core/project-creator.ts
|
|
277
277
|
import { join as join3 } from "path";
|
|
278
|
-
import { fileURLToPath } from "url";
|
|
279
278
|
|
|
280
279
|
// src/utils/file-system.ts
|
|
281
280
|
import { mkdir, readFile, rm, writeFile } from "fs/promises";
|
|
@@ -643,19 +642,33 @@ async function readProjectConfig(root) {
|
|
|
643
642
|
}
|
|
644
643
|
|
|
645
644
|
// src/generators/core/project-creator.ts
|
|
645
|
+
var GITIGNORE_CONTENT = `node_modules/
|
|
646
|
+
.next/
|
|
647
|
+
dist/
|
|
648
|
+
.env
|
|
649
|
+
.env.local
|
|
650
|
+
.env.*.local
|
|
651
|
+
.DS_Store
|
|
652
|
+
`;
|
|
653
|
+
var EDITORCONFIG_CONTENT = `root = true
|
|
654
|
+
|
|
655
|
+
[*]
|
|
656
|
+
charset = utf-8
|
|
657
|
+
end_of_line = lf
|
|
658
|
+
insert_final_newline = true
|
|
659
|
+
indent_style = space
|
|
660
|
+
indent_size = 2
|
|
661
|
+
`;
|
|
646
662
|
async function createProjectSkeleton(root, config, ctx) {
|
|
647
663
|
const projectRoot = join3(root, config.projectName);
|
|
648
|
-
const templatesRoot = fileURLToPath(new URL("../../../templates", import.meta.url));
|
|
649
664
|
await ensureDir(projectRoot, ctx);
|
|
650
665
|
const readme = buildProjectReadme(config);
|
|
651
666
|
await writeTextFile(join3(projectRoot, "README.md"), readme + "\n", ctx);
|
|
652
667
|
const envExample = `# Environment Variables
|
|
653
668
|
`;
|
|
654
669
|
await writeTextFile(join3(projectRoot, ".env.example"), envExample, ctx);
|
|
655
|
-
|
|
656
|
-
await writeTextFile(join3(projectRoot, ".
|
|
657
|
-
const editorconfig = await readTextFile(join3(templatesRoot, "shared", ".editorconfig"));
|
|
658
|
-
await writeTextFile(join3(projectRoot, ".editorconfig"), editorconfig, ctx);
|
|
670
|
+
await writeTextFile(join3(projectRoot, ".gitignore"), GITIGNORE_CONTENT, ctx);
|
|
671
|
+
await writeTextFile(join3(projectRoot, ".editorconfig"), EDITORCONFIG_CONTENT, ctx);
|
|
659
672
|
const pkg = {
|
|
660
673
|
name: config.projectName,
|
|
661
674
|
version: "0.0.0",
|
|
@@ -699,7 +712,7 @@ async function createProjectSkeleton(root, config, ctx) {
|
|
|
699
712
|
|
|
700
713
|
// src/generators/database/database-files.ts
|
|
701
714
|
import { join as join4 } from "path";
|
|
702
|
-
import { fileURLToPath
|
|
715
|
+
import { fileURLToPath } from "url";
|
|
703
716
|
|
|
704
717
|
// src/utils/env-file.ts
|
|
705
718
|
import { readFile as readFile3, writeFile as writeFile3 } from "fs/promises";
|
|
@@ -743,7 +756,7 @@ async function removeEnvKey(path, key, ctx) {
|
|
|
743
756
|
// src/generators/database/database-files.ts
|
|
744
757
|
async function generateDatabaseFiles(root, config, ctx) {
|
|
745
758
|
const projectRoot = join4(root, config.projectName);
|
|
746
|
-
const templatesRoot =
|
|
759
|
+
const templatesRoot = fileURLToPath(new URL("../../../templates", import.meta.url));
|
|
747
760
|
if (config.database.provider !== "none") {
|
|
748
761
|
const envPath = join4(projectRoot, ".env.example");
|
|
749
762
|
if (config.database.provider === "mongodb") {
|
|
@@ -838,7 +851,7 @@ async function generateDatabaseFiles(root, config, ctx) {
|
|
|
838
851
|
|
|
839
852
|
// src/generators/frontend/frontend-files.ts
|
|
840
853
|
import { join as join5 } from "path";
|
|
841
|
-
import { fileURLToPath as
|
|
854
|
+
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
842
855
|
|
|
843
856
|
// src/generators/templates/template-engine.ts
|
|
844
857
|
function applyTemplate(content, vars) {
|
|
@@ -852,7 +865,7 @@ function applyTemplate(content, vars) {
|
|
|
852
865
|
// src/generators/frontend/frontend-files.ts
|
|
853
866
|
async function generateFrontendFiles(root, config, ctx) {
|
|
854
867
|
const projectRoot = join5(root, config.projectName);
|
|
855
|
-
const templatesRoot =
|
|
868
|
+
const templatesRoot = fileURLToPath2(new URL("../../../templates", import.meta.url));
|
|
856
869
|
if (config.frontend.type === "nextjs") {
|
|
857
870
|
const appDir = join5(projectRoot, "app");
|
|
858
871
|
await ensureDir(appDir, ctx);
|
|
@@ -1189,10 +1202,10 @@ function buildPageLinks(config) {
|
|
|
1189
1202
|
|
|
1190
1203
|
// src/generators/ui/ui-files.ts
|
|
1191
1204
|
import { join as join6 } from "path";
|
|
1192
|
-
import { fileURLToPath as
|
|
1205
|
+
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
1193
1206
|
async function generateUiFiles(root, config, ctx) {
|
|
1194
1207
|
const projectRoot = join6(root, config.projectName);
|
|
1195
|
-
const templatesRoot =
|
|
1208
|
+
const templatesRoot = fileURLToPath3(new URL("../../../templates", import.meta.url));
|
|
1196
1209
|
if (config.ui.library === "tailwind") {
|
|
1197
1210
|
const tailwindTemplate = await readTextFile(join6(templatesRoot, "ui", "tailwind.config.js"));
|
|
1198
1211
|
const postcssTemplate = await readTextFile(join6(templatesRoot, "ui", "postcss.config.js"));
|
|
@@ -1260,10 +1273,10 @@ async function generateUiFiles(root, config, ctx) {
|
|
|
1260
1273
|
|
|
1261
1274
|
// src/generators/auth/auth-files.ts
|
|
1262
1275
|
import { join as join7 } from "path";
|
|
1263
|
-
import { fileURLToPath as
|
|
1276
|
+
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
1264
1277
|
async function generateAuthFiles(root, config, ctx) {
|
|
1265
1278
|
const projectRoot = join7(root, config.projectName);
|
|
1266
|
-
const templatesRoot =
|
|
1279
|
+
const templatesRoot = fileURLToPath4(new URL("../../../templates", import.meta.url));
|
|
1267
1280
|
if (config.auth.provider === "nextauth") {
|
|
1268
1281
|
await appendEnvLine(join7(projectRoot, ".env.example"), 'NEXTAUTH_SECRET=""', ctx);
|
|
1269
1282
|
await appendEnvLine(join7(projectRoot, ".env.example"), 'NEXTAUTH_URL=""', ctx);
|
|
@@ -1434,10 +1447,10 @@ export function createSupabaseServerClient() {
|
|
|
1434
1447
|
|
|
1435
1448
|
// src/generators/api/api-files.ts
|
|
1436
1449
|
import { join as join8 } from "path";
|
|
1437
|
-
import { fileURLToPath as
|
|
1450
|
+
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
1438
1451
|
async function generateApiFiles(root, config, ctx) {
|
|
1439
1452
|
const projectRoot = join8(root, config.projectName);
|
|
1440
|
-
const templatesRoot =
|
|
1453
|
+
const templatesRoot = fileURLToPath5(new URL("../../../templates", import.meta.url));
|
|
1441
1454
|
if (config.api.type === "rest") {
|
|
1442
1455
|
const apiDir = join8(projectRoot, "api");
|
|
1443
1456
|
await ensureDir(apiDir, ctx);
|
|
@@ -2114,10 +2127,10 @@ server.listen(port, () => {
|
|
|
2114
2127
|
|
|
2115
2128
|
// src/generators/features/feature-files.ts
|
|
2116
2129
|
import { join as join10 } from "path";
|
|
2117
|
-
import { fileURLToPath as
|
|
2130
|
+
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
2118
2131
|
async function generateFeatureFiles(root, config, ctx) {
|
|
2119
2132
|
const projectRoot = join10(root, config.projectName);
|
|
2120
|
-
const templatesRoot =
|
|
2133
|
+
const templatesRoot = fileURLToPath6(new URL("../../../templates", import.meta.url));
|
|
2121
2134
|
const libDir = join10(projectRoot, "src", "lib");
|
|
2122
2135
|
const isTs = config.frontend.language === "ts";
|
|
2123
2136
|
if (config.features.includes("email")) {
|