barodoc 7.1.0 → 7.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.
- package/dist/{chunk-7PJMPS7Q.js → chunk-G25BMQMN.js} +31 -6
- package/dist/cli.js +3 -5
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +3 -3
|
@@ -1,9 +1,13 @@
|
|
|
1
|
+
// package.json
|
|
2
|
+
var version = "7.2.0";
|
|
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
|
}
|
|
@@ -221,6 +245,7 @@ function findDocsDir(root) {
|
|
|
221
245
|
}
|
|
222
246
|
|
|
223
247
|
export {
|
|
248
|
+
version,
|
|
224
249
|
isCustomProject,
|
|
225
250
|
loadProjectConfig,
|
|
226
251
|
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-G25BMQMN.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.0";
|
|
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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "barodoc",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.2.0",
|
|
4
4
|
"description": "Documentation framework powered by Astro",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"picocolors": "^1.1.1",
|
|
27
27
|
"zod": "^3.24.0",
|
|
28
28
|
"zod-to-json-schema": "^3.25.1",
|
|
29
|
-
"@barodoc/
|
|
30
|
-
"@barodoc/
|
|
29
|
+
"@barodoc/theme-docs": "7.1.1",
|
|
30
|
+
"@barodoc/core": "7.0.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@types/fs-extra": "^11.0.4",
|