barodoc 7.1.1 → 7.2.1
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/{chunk-7PJMPS7Q.js → chunk-IEDARORE.js} +36 -6
- package/dist/cli.js +3 -5
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -1,9 +1,13 @@
|
|
|
1
|
+
// package.json
|
|
2
|
+
var version = "7.2.1";
|
|
3
|
+
|
|
1
4
|
// src/runtime/project.ts
|
|
2
5
|
import fs from "fs-extra";
|
|
3
6
|
import path from "path";
|
|
4
7
|
import pc from "picocolors";
|
|
5
8
|
import { execa } from "execa";
|
|
6
9
|
var BARODOC_DIR = ".barodoc";
|
|
10
|
+
var CLI_VERSION_FILE = ".cli-version";
|
|
7
11
|
function isCustomProject(dir) {
|
|
8
12
|
return fs.existsSync(path.join(dir, "astro.config.mjs")) || fs.existsSync(path.join(dir, "astro.config.ts")) || fs.existsSync(path.join(dir, "astro.config.js"));
|
|
9
13
|
}
|
|
@@ -41,9 +45,10 @@ async function createProject(options) {
|
|
|
41
45
|
const nodeModulesDir = path.join(projectDir, "node_modules");
|
|
42
46
|
const hasNodeModules = fs.existsSync(nodeModulesDir);
|
|
43
47
|
if (hasNodeModules) {
|
|
48
|
+
const preserve = /* @__PURE__ */ new Set(["node_modules", CLI_VERSION_FILE]);
|
|
44
49
|
const entries = await fs.readdir(projectDir);
|
|
45
50
|
for (const entry of entries) {
|
|
46
|
-
if (entry
|
|
51
|
+
if (!preserve.has(entry)) {
|
|
47
52
|
await fs.remove(path.join(projectDir, entry));
|
|
48
53
|
}
|
|
49
54
|
}
|
|
@@ -64,8 +69,8 @@ async function createProject(options) {
|
|
|
64
69
|
"@tailwindcss/typography": "^0.5.19",
|
|
65
70
|
"@tailwindcss/vite": "^4.0.0",
|
|
66
71
|
tailwindcss: "^4.0.0",
|
|
67
|
-
"@barodoc/core": "
|
|
68
|
-
"@barodoc/theme-docs": "
|
|
72
|
+
"@barodoc/core": `^${version.split(".")[0]}.0.0`,
|
|
73
|
+
"@barodoc/theme-docs": `^${version.split(".")[0]}.0.0`,
|
|
69
74
|
react: "^19.0.0",
|
|
70
75
|
"react-dom": "^19.0.0"
|
|
71
76
|
}
|
|
@@ -115,14 +120,31 @@ async function createProject(options) {
|
|
|
115
120
|
}
|
|
116
121
|
return projectDir;
|
|
117
122
|
}
|
|
123
|
+
function needsReinstall(projectDir) {
|
|
124
|
+
const versionFile = path.join(projectDir, CLI_VERSION_FILE);
|
|
125
|
+
if (!fs.existsSync(versionFile)) return true;
|
|
126
|
+
const cached = fs.readFileSync(versionFile, "utf-8").trim();
|
|
127
|
+
return cached !== version;
|
|
128
|
+
}
|
|
129
|
+
function writeCLIVersion(projectDir) {
|
|
130
|
+
fs.writeFileSync(path.join(projectDir, CLI_VERSION_FILE), version);
|
|
131
|
+
}
|
|
118
132
|
async function installDependencies(projectDir, force = false) {
|
|
119
133
|
const nodeModulesDir = path.join(projectDir, "node_modules");
|
|
120
|
-
|
|
134
|
+
const hasNodeModules = fs.existsSync(nodeModulesDir);
|
|
135
|
+
const versionChanged = hasNodeModules && needsReinstall(projectDir);
|
|
136
|
+
if (versionChanged && !force) {
|
|
137
|
+
console.log(
|
|
138
|
+
pc.yellow(`Barodoc updated (\u2192 ${version}), reinstalling dependencies...`)
|
|
139
|
+
);
|
|
140
|
+
force = true;
|
|
141
|
+
}
|
|
142
|
+
if (!force && hasNodeModules) {
|
|
121
143
|
console.log(pc.dim("Using cached dependencies..."));
|
|
122
144
|
console.log();
|
|
123
145
|
return;
|
|
124
146
|
}
|
|
125
|
-
if (force &&
|
|
147
|
+
if (force && hasNodeModules) {
|
|
126
148
|
console.log(pc.dim("Clearing cached dependencies..."));
|
|
127
149
|
await fs.remove(nodeModulesDir);
|
|
128
150
|
}
|
|
@@ -131,15 +153,17 @@ async function installDependencies(projectDir, force = false) {
|
|
|
131
153
|
cwd: projectDir,
|
|
132
154
|
stdio: "inherit"
|
|
133
155
|
});
|
|
156
|
+
writeCLIVersion(projectDir);
|
|
134
157
|
console.log(pc.green("\u2713 Dependencies installed"));
|
|
135
158
|
console.log();
|
|
136
159
|
}
|
|
137
160
|
async function cleanupProject(root) {
|
|
138
161
|
const projectDir = path.join(root, BARODOC_DIR);
|
|
139
162
|
if (!fs.existsSync(projectDir)) return;
|
|
163
|
+
const preserve = /* @__PURE__ */ new Set(["node_modules", CLI_VERSION_FILE]);
|
|
140
164
|
const entries = await fs.readdir(projectDir);
|
|
141
165
|
for (const entry of entries) {
|
|
142
|
-
if (entry
|
|
166
|
+
if (!preserve.has(entry)) {
|
|
143
167
|
await fs.remove(path.join(projectDir, entry));
|
|
144
168
|
}
|
|
145
169
|
}
|
|
@@ -160,6 +184,11 @@ export default defineConfig({${siteLine}${baseLine}
|
|
|
160
184
|
theme: docsTheme(),
|
|
161
185
|
}),
|
|
162
186
|
],
|
|
187
|
+
vite: {
|
|
188
|
+
resolve: {
|
|
189
|
+
preserveSymlinks: true,
|
|
190
|
+
},
|
|
191
|
+
},
|
|
163
192
|
});
|
|
164
193
|
`;
|
|
165
194
|
}
|
|
@@ -221,6 +250,7 @@ function findDocsDir(root) {
|
|
|
221
250
|
}
|
|
222
251
|
|
|
223
252
|
export {
|
|
253
|
+
version,
|
|
224
254
|
isCustomProject,
|
|
225
255
|
loadProjectConfig,
|
|
226
256
|
createProject,
|
package/dist/cli.js
CHANGED
|
@@ -5,16 +5,14 @@ import {
|
|
|
5
5
|
findDocsDir,
|
|
6
6
|
installDependencies,
|
|
7
7
|
isCustomProject,
|
|
8
|
-
loadProjectConfig
|
|
9
|
-
|
|
8
|
+
loadProjectConfig,
|
|
9
|
+
version
|
|
10
|
+
} from "./chunk-IEDARORE.js";
|
|
10
11
|
|
|
11
12
|
// src/cli.ts
|
|
12
13
|
import cac from "cac";
|
|
13
14
|
import pc10 from "picocolors";
|
|
14
15
|
|
|
15
|
-
// package.json
|
|
16
|
-
var version = "7.1.1";
|
|
17
|
-
|
|
18
16
|
// src/commands/serve.ts
|
|
19
17
|
import path from "path";
|
|
20
18
|
import pc from "picocolors";
|
package/dist/index.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ interface ProjectOptions {
|
|
|
12
12
|
*/
|
|
13
13
|
declare function createProject(options: ProjectOptions): Promise<string>;
|
|
14
14
|
/**
|
|
15
|
-
* Clean up temporary project files but preserve node_modules cache
|
|
15
|
+
* Clean up temporary project files but preserve node_modules cache and version marker.
|
|
16
16
|
*/
|
|
17
17
|
declare function cleanupProject(root: string): Promise<void>;
|
|
18
18
|
|
package/dist/index.js
CHANGED