@docubook/cli 0.2.6 → 0.2.8
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/package.json +5 -4
- package/src/cli/program.js +10 -6
- package/templates.json +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docubook/cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.8",
|
|
4
4
|
"description": "DocuBook CLI tool that helps you initialize, update, and deploy documentation directly from your terminal.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -28,16 +28,17 @@
|
|
|
28
28
|
"author-url": "https://wildan.dev",
|
|
29
29
|
"license": "MIT",
|
|
30
30
|
"dependencies": {
|
|
31
|
+
"boxen": "^8.0.1",
|
|
31
32
|
"chalk": "^5.3.0",
|
|
33
|
+
"cli-progress": "^3.12.0",
|
|
32
34
|
"commander": "^12.1.0",
|
|
33
35
|
"ora": "^8.1.0",
|
|
34
36
|
"prompts": "^2.4.2",
|
|
35
|
-
"
|
|
36
|
-
"cli-progress": "^3.12.0"
|
|
37
|
+
"semver": "^7.7.4"
|
|
37
38
|
},
|
|
38
39
|
"devDependencies": {
|
|
39
|
-
"eslint": "^9.39.3",
|
|
40
40
|
"@eslint/js": "^9.39.3",
|
|
41
|
+
"eslint": "^9.39.3",
|
|
41
42
|
"eslint-config-next": "^16.1.3"
|
|
42
43
|
},
|
|
43
44
|
"engines": {
|
package/src/cli/program.js
CHANGED
|
@@ -12,6 +12,7 @@ import ora from "ora";
|
|
|
12
12
|
import fs from "fs";
|
|
13
13
|
import os from "os";
|
|
14
14
|
import path from "path";
|
|
15
|
+
import { lt } from "semver";
|
|
15
16
|
|
|
16
17
|
// Helpers to show changelog once per installed version. Stores shown versions under
|
|
17
18
|
// $HOME/.docubook_cli_seen_changelogs.json as a map: { "@docubook/cli": ["1.2.3"] }
|
|
@@ -59,8 +60,11 @@ async function _fetchChangelogFromGitHub(version) {
|
|
|
59
60
|
function _extractVersionSection(changelogText, version) {
|
|
60
61
|
if (!changelogText) return null;
|
|
61
62
|
const lines = changelogText.split(/\r?\n/);
|
|
62
|
-
// Look for headings that include the version
|
|
63
|
-
|
|
63
|
+
// Look for level-2 headings that include the version
|
|
64
|
+
// Matches patterns like "## cli-v0.2.7", "## v0.2.7", or "## 0.2.7"
|
|
65
|
+
// Use exactly "##" (level 2), not "###" or other levels
|
|
66
|
+
const versionEscaped = version.replace(/\./g, "\\.");
|
|
67
|
+
const headerRe = new RegExp(`^##\\s*(?:cli-)?v?${versionEscaped}(?:\\b|\\D)`, "i");
|
|
64
68
|
let start = -1;
|
|
65
69
|
for (let i = 0; i < lines.length; i++) {
|
|
66
70
|
if (headerRe.test(lines[i])) {
|
|
@@ -94,7 +98,7 @@ async function showChangelogOnce(pkgName, version) {
|
|
|
94
98
|
if (!section) return;
|
|
95
99
|
|
|
96
100
|
// Print a concise changelog section
|
|
97
|
-
console.log("\n
|
|
101
|
+
console.log("\n===========================================================\n");
|
|
98
102
|
console.log(section.trim());
|
|
99
103
|
console.log("\nFor full changelog, visit:");
|
|
100
104
|
console.log(` https://github.com/DocuBook/docubook/blob/main/CHANGELOG.md\n`);
|
|
@@ -145,8 +149,8 @@ export function initializeProgram(version) {
|
|
|
145
149
|
if (spinner && typeof spinner.stop === 'function') spinner.stop();
|
|
146
150
|
console.log('Checking for updates...');
|
|
147
151
|
|
|
148
|
-
if (latest
|
|
149
|
-
console.log(`No update needed, current version is ${version},
|
|
152
|
+
if (!lt(version, latest)) {
|
|
153
|
+
console.log(`No update needed, current version is ${version}, latest release is ${latest}`);
|
|
150
154
|
return;
|
|
151
155
|
}
|
|
152
156
|
|
|
@@ -192,7 +196,7 @@ export function initializeProgram(version) {
|
|
|
192
196
|
.argument("[directory]", "The name of the project directory")
|
|
193
197
|
.action(async (directory) => {
|
|
194
198
|
const state = new CLIState();
|
|
195
|
-
|
|
199
|
+
|
|
196
200
|
try {
|
|
197
201
|
// Render welcome screen with version
|
|
198
202
|
renderWelcome(version);
|
package/templates.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
{
|
|
4
4
|
"id": "nextjs-vercel",
|
|
5
5
|
"name": "nextjs-vercel",
|
|
6
|
-
"description": "
|
|
6
|
+
"description": "Next.js and Vercel deployment (optimized for vercel)",
|
|
7
7
|
"features": [
|
|
8
8
|
"Next.js 16",
|
|
9
9
|
"React 19",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
{
|
|
20
20
|
"id": "nextjs-docker",
|
|
21
21
|
"name": "nextjs-docker",
|
|
22
|
-
"description": "
|
|
22
|
+
"description": "Next.js standalone with Docker image (optimized for coolify, etc.)",
|
|
23
23
|
"features": [
|
|
24
24
|
"Next.js 16",
|
|
25
25
|
"React 19",
|