Skip to content

Commit 4d701ff

Browse files
committed
fix: update generateConfig to preserve custom integrations and modify base URL handling
1 parent 30129f9 commit 4d701ff

File tree

3 files changed

+26
-27
lines changed

3 files changed

+26
-27
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,20 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.2.1] - 2025-12-29
9+
10+
### Fixed
11+
12+
- **Config**: Fixed `baseUrl` option not being applied to the Astro configuration. It now correctly patches `astro.config.mjs` when a custom base URL is provided.
13+
814
## [0.2.0] - 2025-12-29
15+
916
### Fixed
17+
1018
- **Eject**: Resolved build errors in ejected projects by properly handling dependencies and configuration.
1119

1220
### Improved
21+
1322
- **MDX Components**: Refined `Tabs` and `CodeGroup` components for better stability and rendering.
1423
- **Template**: Modernized documentation template with Astro 5 and Tailwind CSS v4 support.
1524

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@devrohit06/superdocs",
3-
"version": "0.2.0",
3+
"version": "0.2.1",
44
"description": "The open-source Mintlify alternative. Beautiful documentation sites from Markdown.",
55
"main": "src/index.js",
66
"type": "module",
@@ -35,4 +35,4 @@
3535
"picocolors": "^1.1.1",
3636
"zod": "^3.23.0"
3737
}
38-
}
38+
}

src/core/config.js

Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,21 @@
1-
import pkg from 'fs-extra';
2-
const { writeFile } = pkg;
3-
import { join } from 'path';
1+
import pkg from "fs-extra";
2+
const { readFile, writeFile } = pkg;
3+
import { join } from "path";
44

55
export async function generateConfig(projectDir, options) {
6-
// Config is now handled by the template directly.
7-
// We avoid overwriting it to preserve custom integrations like AutoImport and ExpressiveCode.
6+
const { baseUrl } = options;
87

9-
/*
10-
const { theme, baseUrl, search } = options;
8+
// Only modify if base URL is not default
9+
if (baseUrl && baseUrl !== "/") {
10+
const configPath = join(projectDir, "astro.config.mjs");
11+
let content = await readFile(configPath, "utf-8");
1112

12-
const configContent = `import { defineConfig } from 'astro/config';
13-
import mdx from '@astrojs/mdx';
13+
// Add base option to defineConfig
14+
content = content.replace(
15+
"export default defineConfig({",
16+
`export default defineConfig({\n base: '${baseUrl}',`
17+
);
1418

15-
// https://astro.build/config
16-
export default defineConfig({
17-
integrations: [mdx()],
18-
base: '${baseUrl}',
19-
site: 'https://example.com', // Update this with your actual site URL
20-
markdown: {
21-
shikiConfig: {
22-
theme: '${theme === 'dark' ? 'github-dark' : 'github-light'}',
23-
},
24-
},
25-
});
26-
`;
27-
28-
const configPath = join(projectDir, 'astro.config.mjs');
29-
await writeFile(configPath, configContent, 'utf-8');
30-
*/
19+
await writeFile(configPath, content, "utf-8");
20+
}
3121
}

0 commit comments

Comments
 (0)