portosaurus 0.16.6 → 0.16.7
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.
Potentially problematic release.
This version of portosaurus might be problematic. Click here for more details.
package/docusaurus.config.ts
CHANGED
|
@@ -9,6 +9,26 @@ import generateFaviconPlugin from './src/utils/generateFavicon.js';
|
|
|
9
9
|
import generateRobotsTxtPlugin from './src/utils/generateRobotsTxt.js';
|
|
10
10
|
import { metaTags } from './src/config/metaTags.js';
|
|
11
11
|
import { catppuccinMocha, catppuccinLatte } from './src/config/prism.js';
|
|
12
|
+
import fs from 'fs';
|
|
13
|
+
import path from 'path';
|
|
14
|
+
import { fileURLToPath } from 'url';
|
|
15
|
+
|
|
16
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
17
|
+
const __dirname = path.dirname(__filename);
|
|
18
|
+
|
|
19
|
+
function resolveResource(relativePath: string) {
|
|
20
|
+
const resolved = path.resolve(__dirname, relativePath);
|
|
21
|
+
if (fs.existsSync(resolved)) {
|
|
22
|
+
return resolved;
|
|
23
|
+
}
|
|
24
|
+
// Try finding it in src/ if we are in lib/
|
|
25
|
+
// ../src/css/custom.css
|
|
26
|
+
const alt = path.resolve(__dirname, `../${relativePath}`);
|
|
27
|
+
if (fs.existsSync(alt)) {
|
|
28
|
+
return alt;
|
|
29
|
+
}
|
|
30
|
+
return resolved; // let docusaurus fail or handle it
|
|
31
|
+
}
|
|
12
32
|
|
|
13
33
|
// Helper to filter enabled items
|
|
14
34
|
const useEnabled = (items: any[]) => {
|
|
@@ -54,7 +74,7 @@ export default async function createConfig(): Promise<Config> {
|
|
|
54
74
|
docs: {
|
|
55
75
|
routeBasePath: 'notes',
|
|
56
76
|
path: 'notes',
|
|
57
|
-
sidebarPath: '
|
|
77
|
+
sidebarPath: resolveResource('src/config/sidebar.js'), // Resolves to .js in lib, check if dev needs handling
|
|
58
78
|
admonitions: {
|
|
59
79
|
keywords: ["note", "tip", "info", "warning", "danger", "question"],
|
|
60
80
|
extendDefaults: true,
|
|
@@ -73,7 +93,7 @@ export default async function createConfig(): Promise<Config> {
|
|
|
73
93
|
onUntruncatedBlogPosts: 'warn',
|
|
74
94
|
},
|
|
75
95
|
theme: {
|
|
76
|
-
customCss: '
|
|
96
|
+
customCss: resolveResource('src/css/custom.css'),
|
|
77
97
|
},
|
|
78
98
|
} satisfies Preset.Options,
|
|
79
99
|
],
|
package/lib/docusaurus.config.js
CHANGED
|
@@ -5,6 +5,24 @@ import generateFaviconPlugin from './src/utils/generateFavicon.js';
|
|
|
5
5
|
import generateRobotsTxtPlugin from './src/utils/generateRobotsTxt.js';
|
|
6
6
|
import { metaTags } from './src/config/metaTags.js';
|
|
7
7
|
import { catppuccinMocha, catppuccinLatte } from './src/config/prism.js';
|
|
8
|
+
import fs from 'fs';
|
|
9
|
+
import path from 'path';
|
|
10
|
+
import { fileURLToPath } from 'url';
|
|
11
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
12
|
+
const __dirname = path.dirname(__filename);
|
|
13
|
+
function resolveResource(relativePath) {
|
|
14
|
+
const resolved = path.resolve(__dirname, relativePath);
|
|
15
|
+
if (fs.existsSync(resolved)) {
|
|
16
|
+
return resolved;
|
|
17
|
+
}
|
|
18
|
+
// Try finding it in src/ if we are in lib/
|
|
19
|
+
// ../src/css/custom.css
|
|
20
|
+
const alt = path.resolve(__dirname, `../${relativePath}`);
|
|
21
|
+
if (fs.existsSync(alt)) {
|
|
22
|
+
return alt;
|
|
23
|
+
}
|
|
24
|
+
return resolved; // let docusaurus fail or handle it
|
|
25
|
+
}
|
|
8
26
|
// Helper to filter enabled items
|
|
9
27
|
const useEnabled = (items) => {
|
|
10
28
|
return items.flatMap(item => {
|
|
@@ -41,7 +59,7 @@ export default async function createConfig() {
|
|
|
41
59
|
docs: {
|
|
42
60
|
routeBasePath: 'notes',
|
|
43
61
|
path: 'notes',
|
|
44
|
-
sidebarPath: '
|
|
62
|
+
sidebarPath: resolveResource('src/config/sidebar.js'), // Resolves to .js in lib, check if dev needs handling
|
|
45
63
|
admonitions: {
|
|
46
64
|
keywords: ["note", "tip", "info", "warning", "danger", "question"],
|
|
47
65
|
extendDefaults: true,
|
|
@@ -60,7 +78,7 @@ export default async function createConfig() {
|
|
|
60
78
|
onUntruncatedBlogPosts: 'warn',
|
|
61
79
|
},
|
|
62
80
|
theme: {
|
|
63
|
-
customCss: '
|
|
81
|
+
customCss: resolveResource('src/css/custom.css'),
|
|
64
82
|
},
|
|
65
83
|
},
|
|
66
84
|
],
|
|
@@ -113,7 +113,8 @@ export async function initCommand(directory) {
|
|
|
113
113
|
dependencies: {
|
|
114
114
|
'portosaurus': portosaurusVersion,
|
|
115
115
|
'react': '^18.0.0',
|
|
116
|
-
'react-dom': '^18.0.0'
|
|
116
|
+
'react-dom': '^18.0.0',
|
|
117
|
+
'@docusaurus/tsconfig': '^3.0.0'
|
|
117
118
|
}
|
|
118
119
|
};
|
|
119
120
|
// Use the version from our own package.json if possible, or default
|
package/package.json
CHANGED
package/src/cli/commands/init.ts
CHANGED