create-fumadocs-app 13.1.0 → 13.2.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.
|
@@ -2,8 +2,65 @@
|
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import fs from "node:fs/promises";
|
|
4
4
|
|
|
5
|
+
// src/git.ts
|
|
6
|
+
import { execSync } from "node:child_process";
|
|
7
|
+
import { rmSync } from "node:fs";
|
|
8
|
+
import { join } from "node:path";
|
|
9
|
+
function isInGitRepository(cwd2) {
|
|
10
|
+
try {
|
|
11
|
+
execSync("git rev-parse --is-inside-work-tree", { stdio: "ignore", cwd: cwd2 });
|
|
12
|
+
return true;
|
|
13
|
+
} catch (_) {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
function isInMercurialRepository(cwd2) {
|
|
18
|
+
try {
|
|
19
|
+
execSync("hg --cwd . root", { stdio: "ignore", cwd: cwd2 });
|
|
20
|
+
return true;
|
|
21
|
+
} catch (_) {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
function isDefaultBranchSet(cwd2) {
|
|
26
|
+
try {
|
|
27
|
+
execSync("git config init.defaultBranch", { stdio: "ignore", cwd: cwd2 });
|
|
28
|
+
return true;
|
|
29
|
+
} catch (_) {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function tryGitInit(root) {
|
|
34
|
+
let didInit = false;
|
|
35
|
+
try {
|
|
36
|
+
execSync("git --version", { stdio: "ignore" });
|
|
37
|
+
if (isInGitRepository(root) || isInMercurialRepository(root)) {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
execSync("git init", { stdio: "ignore", cwd: root });
|
|
41
|
+
didInit = true;
|
|
42
|
+
if (!isDefaultBranchSet(root)) {
|
|
43
|
+
execSync("git checkout -b main", { stdio: "ignore", cwd: root });
|
|
44
|
+
}
|
|
45
|
+
execSync("git add -A", { stdio: "ignore", cwd: root });
|
|
46
|
+
execSync('git commit -m "Initial commit from Create Fumadocs App"', {
|
|
47
|
+
stdio: "ignore",
|
|
48
|
+
cwd: root
|
|
49
|
+
});
|
|
50
|
+
return true;
|
|
51
|
+
} catch (e) {
|
|
52
|
+
if (didInit) {
|
|
53
|
+
try {
|
|
54
|
+
rmSync(join(root, ".git"), { recursive: true, force: true });
|
|
55
|
+
} catch (_) {
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
5
62
|
// versions.json
|
|
6
|
-
var versions_default = { "fumadocs-core": "13.
|
|
63
|
+
var versions_default = { "fumadocs-core": "13.2.0", "fumadocs-ui": "13.2.0", "fumadocs-mdx": "9.0.0", "@fumadocs/content-collections": "1.1.0" };
|
|
7
64
|
|
|
8
65
|
// ../create-app-versions/package.json
|
|
9
66
|
var package_default = {
|
|
@@ -72,6 +129,11 @@ var cwd = process.cwd();
|
|
|
72
129
|
|
|
73
130
|
// src/create-app.ts
|
|
74
131
|
async function create(options) {
|
|
132
|
+
const {
|
|
133
|
+
installDeps = true,
|
|
134
|
+
initializeGit = true,
|
|
135
|
+
log = console.log
|
|
136
|
+
} = options;
|
|
75
137
|
const projectName = path.basename(options.outputDir);
|
|
76
138
|
const dest = path.resolve(cwd, options.outputDir);
|
|
77
139
|
await copy(path.join(sourceDir, `template/+shared`), dest, (name) => {
|
|
@@ -83,15 +145,21 @@ async function create(options) {
|
|
|
83
145
|
}
|
|
84
146
|
});
|
|
85
147
|
await copy(path.join(sourceDir, `template/${options.template}`), dest);
|
|
148
|
+
log("Configured Typescript");
|
|
86
149
|
if (options.tailwindcss) {
|
|
87
150
|
await copy(path.join(sourceDir, `template/+tailwindcss`), dest);
|
|
151
|
+
log("Configured Tailwind CSS");
|
|
88
152
|
}
|
|
89
153
|
const packageJson = createPackageJson(projectName, options);
|
|
90
154
|
await fs.writeFile(path.join(dest, "package.json"), packageJson);
|
|
91
155
|
const readMe = await getReadme(dest, projectName);
|
|
92
156
|
await fs.writeFile(path.join(dest, "README.md"), readMe);
|
|
93
|
-
if (
|
|
157
|
+
if (installDeps) {
|
|
94
158
|
await autoInstall(options.packageManager, dest);
|
|
159
|
+
log("Installed dependencies");
|
|
160
|
+
}
|
|
161
|
+
if (initializeGit && tryGitInit(dest)) {
|
|
162
|
+
log("Initialized Git repository");
|
|
95
163
|
}
|
|
96
164
|
}
|
|
97
165
|
async function getReadme(dest, projectName) {
|
package/dist/create-app.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
create,
|
|
4
4
|
cwd,
|
|
5
5
|
getPackageManager
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-JN2LQKSS.js";
|
|
7
7
|
|
|
8
8
|
// src/index.ts
|
|
9
9
|
import { existsSync } from "node:fs";
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
group,
|
|
16
16
|
intro,
|
|
17
17
|
isCancel,
|
|
18
|
+
log,
|
|
18
19
|
outro,
|
|
19
20
|
select,
|
|
20
21
|
spinner,
|
|
@@ -78,14 +79,13 @@ async function main() {
|
|
|
78
79
|
tailwindcss: options.tailwindcss,
|
|
79
80
|
template: options.template,
|
|
80
81
|
outputDir: dest,
|
|
81
|
-
installDeps: options.installDeps
|
|
82
|
+
installDeps: options.installDeps,
|
|
83
|
+
log: (message) => {
|
|
84
|
+
log.info(message);
|
|
85
|
+
}
|
|
82
86
|
});
|
|
83
87
|
info.stop("Project Generated");
|
|
84
88
|
outro(pc.bgGreen(pc.bold("Done")));
|
|
85
|
-
if (options.tailwindcss) {
|
|
86
|
-
console.log("\u2714 Tailwind CSS");
|
|
87
|
-
}
|
|
88
|
-
console.log("\u2714 Typescript");
|
|
89
89
|
console.log(pc.bold("\nOpen the project"));
|
|
90
90
|
console.log(pc.cyan(`cd ${projectName}`));
|
|
91
91
|
console.log(pc.bold("\nRun Development Server"));
|