create-fumadocs-app 15.0.4 → 15.0.6

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.
@@ -60,7 +60,7 @@ function tryGitInit(root) {
60
60
  }
61
61
 
62
62
  // src/versions.js
63
- var versions = { "fumadocs-core": "15.0.4", "fumadocs-ui": "15.0.4", "fumadocs-mdx": "11.5.1", "@fumadocs/content-collections": "1.1.7" };
63
+ var versions = { "fumadocs-core": "15.0.6", "fumadocs-ui": "15.0.6", "fumadocs-mdx": "11.5.3", "@fumadocs/content-collections": "1.1.8" };
64
64
 
65
65
  // ../create-app-versions/package.json
66
66
  var package_default = {
@@ -73,7 +73,7 @@ var package_default = {
73
73
  "@content-collections/core": "^0.8.0",
74
74
  "@content-collections/mdx": "^0.2.0",
75
75
  "@content-collections/next": "^0.2.4",
76
- "@tailwindcss/postcss": "^4.0.3",
76
+ "@tailwindcss/postcss": "^4.0.5",
77
77
  "@types/mdx": "^2.0.13",
78
78
  "@types/node": "22.13.1",
79
79
  "@types/react": "^19.0.8",
@@ -82,7 +82,7 @@ var package_default = {
82
82
  postcss: "^8.5.1",
83
83
  react: "^19.0.0",
84
84
  "react-dom": "^19.0.0",
85
- tailwindcss: "^4.0.3",
85
+ tailwindcss: "^4.0.5",
86
86
  typescript: "^5.7.3"
87
87
  }
88
88
  };
@@ -137,24 +137,55 @@ async function create(options) {
137
137
  } = options;
138
138
  const projectName = path.basename(options.outputDir);
139
139
  const dest = path.resolve(cwd, options.outputDir);
140
- await copy(path.join(sourceDir, `template/+shared`), dest, (name) => {
141
- switch (name) {
142
- case "example.gitignore":
143
- return ".gitignore";
144
- default:
145
- return name;
140
+ function defaultRename(file) {
141
+ file = file.replace("example.gitignore", ".gitignore");
142
+ if (!options.useSrcDir) {
143
+ return file;
146
144
  }
147
- });
148
- await copy(path.join(sourceDir, `template/${options.template}`), dest);
149
- log("Configured Typescript");
145
+ for (const dir of ["app", "lib"]) {
146
+ const relative = path.relative(path.join(dest, dir), file);
147
+ if (!relative.startsWith("../")) {
148
+ return path.join(dest, "src", dir, relative);
149
+ }
150
+ }
151
+ return file;
152
+ }
153
+ await copy(path.join(sourceDir, `template/+shared`), dest, defaultRename);
154
+ await copy(
155
+ path.join(sourceDir, `template/${options.template}`),
156
+ dest,
157
+ defaultRename
158
+ );
150
159
  if (options.tailwindcss) {
151
- await copy(path.join(sourceDir, `template/+tailwindcss`), dest);
160
+ await copy(
161
+ path.join(sourceDir, `template/+tailwindcss`),
162
+ dest,
163
+ defaultRename
164
+ );
152
165
  log("Configured Tailwind CSS");
153
166
  }
154
167
  if (options.eslint) {
155
- await copy(path.join(sourceDir, `template/+eslint`), dest);
168
+ await copy(path.join(sourceDir, `template/+eslint`), dest, defaultRename);
156
169
  log("Configured ESLint");
157
170
  }
171
+ if (options.useSrcDir) {
172
+ const tsconfigPath = path.join(dest, "tsconfig.json");
173
+ const content = (await fs.readFile(tsconfigPath)).toString();
174
+ const config = JSON.parse(content);
175
+ if (config.compilerOptions?.paths) {
176
+ Object.assign(config.compilerOptions.paths, {
177
+ "@/*": ["./src/*"]
178
+ });
179
+ }
180
+ await fs.writeFile(tsconfigPath, JSON.stringify(config, null, 2));
181
+ if (options.tailwindcss) {
182
+ const cssPath = path.join(dest, "src/app/global.css");
183
+ await fs.writeFile(
184
+ cssPath,
185
+ (await fs.readFile(cssPath)).toString().replace("../", "../../")
186
+ );
187
+ }
188
+ }
158
189
  const packageJson = createPackageJson(projectName, options);
159
190
  await fs.writeFile(path.join(dest, "package.json"), packageJson);
160
191
  const readMe = await getReadme(dest, projectName);
@@ -179,7 +210,7 @@ async function copy(from, to, rename = (s) => s) {
179
210
  const files = await fs.readdir(from);
180
211
  await Promise.all(
181
212
  files.map(
182
- (file) => copy(path.join(from, file), path.join(to, rename(file)))
213
+ (file) => copy(path.join(from, file), rename(path.join(to, file)))
183
214
  )
184
215
  );
185
216
  } else {
@@ -241,11 +272,10 @@ function createPackageJson(projectName, options) {
241
272
  );
242
273
  }
243
274
  if (options.eslint) {
244
- packageJson.devDependencies = {
245
- ...packageJson.devDependencies,
275
+ Object.assign(packageJson.devDependencies, {
246
276
  eslint: "^8",
247
277
  "eslint-config-next": package_default.dependencies.next
248
- };
278
+ });
249
279
  }
250
280
  return JSON.stringify(packageJson, void 0, 2);
251
281
  }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  create
3
- } from "./chunk-VLY2YQ4U.js";
3
+ } from "./chunk-VG5GW25Z.js";
4
4
  export {
5
5
  create
6
6
  };
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  create,
4
4
  cwd,
5
5
  getPackageManager
6
- } from "./chunk-VLY2YQ4U.js";
6
+ } from "./chunk-VG5GW25Z.js";
7
7
 
8
8
  // src/index.ts
9
9
  import { existsSync } from "node:fs";
@@ -15,7 +15,6 @@ import {
15
15
  group,
16
16
  intro,
17
17
  isCancel,
18
- log,
19
18
  outro,
20
19
  select,
21
20
  spinner,
@@ -36,12 +35,20 @@ async function main() {
36
35
  message: "Choose a content source",
37
36
  initialValue: "fuma-docs-mdx",
38
37
  options: [
39
- { value: "fuma-docs-mdx", label: "Fumadocs MDX" },
38
+ {
39
+ value: "fuma-docs-mdx",
40
+ label: "Fumadocs MDX",
41
+ hint: "recommended"
42
+ },
40
43
  { value: "content-collections", label: "Content Collections" }
41
44
  ]
42
45
  }),
46
+ src: () => confirm({ message: "Use `/src` directory?", initialValue: false }),
43
47
  tailwindcss: () => confirm({ message: "Use Tailwind CSS for styling?" }),
44
- eslint: () => confirm({ message: "Add default ESLint configuration?" }),
48
+ eslint: () => confirm({
49
+ message: "Add default ESLint configuration?",
50
+ initialValue: false
51
+ }),
45
52
  installDeps: () => confirm({
46
53
  message: `Do you want to install packages automatically? (detected as ${manager})`
47
54
  })
@@ -82,8 +89,9 @@ async function main() {
82
89
  outputDir: dest,
83
90
  installDeps: options.installDeps,
84
91
  eslint: options.eslint,
92
+ useSrcDir: options.src,
85
93
  log: (message) => {
86
- log.info(message);
94
+ info.message(message);
87
95
  }
88
96
  });
89
97
  info.stop("Project Generated");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-fumadocs-app",
3
- "version": "15.0.4",
3
+ "version": "15.0.6",
4
4
  "description": "Create a new documentation site with Fumadocs",
5
5
  "keywords": [
6
6
  "NextJs",
@@ -16,6 +16,7 @@
16
16
  "jsx": "preserve",
17
17
  "incremental": true,
18
18
  "paths": {
19
+ "@/.source": ["./.source/index.ts"],
19
20
  "@/*": ["./*"]
20
21
  },
21
22
  "plugins": [