@docubook/cli 0.2.5 → 0.2.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docubook/cli",
3
- "version": "0.2.5",
3
+ "version": "0.2.7",
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
- "boxen": "^8.0.1",
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": {
@@ -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"] }
@@ -32,21 +33,18 @@ function _writeChangelogStore(obj) {
32
33
  }
33
34
  }
34
35
 
35
- async function _fetchChangelogFromGitHub(tag) {
36
- // Try to fetch CHANGELOG.md from the repo tag. Support several tag-name variants
37
- // (e.g. v1.2.3, 1.2.3, cli-v1.2.3, cli-1.2.3) and common filename variants.
36
+ async function _fetchChangelogFromGitHub(version) {
37
+ // Fetch CHANGELOG.md from the CLI release tag format: cli-v0.2.5
38
38
  const repo = "DocuBook/docubook";
39
+ const bare = version.replace(/^v/, "");
40
+ const tag = `cli-v${bare}`;
39
41
 
40
- const bare = tag.replace(/^v/, "");
41
- const variants = [tag, bare, `cli-${tag}`, `cli-${bare}`].filter(Boolean);
42
-
43
- const candidates = [];
44
- for (const v of variants) {
45
- candidates.push(`https://raw.githubusercontent.com/${repo}/${v}/CHANGELOG.md`);
46
- candidates.push(`https://raw.githubusercontent.com/${repo}/${v}/CHANGELOG.MD`);
47
- }
48
- // final fallback to main branch
49
- candidates.push(`https://raw.githubusercontent.com/${repo}/main/CHANGELOG.md`);
42
+ const candidates = [
43
+ `https://raw.githubusercontent.com/${repo}/${tag}/CHANGELOG.md`,
44
+ `https://raw.githubusercontent.com/${repo}/${tag}/CHANGELOG.MD`,
45
+ // Fallback to main branch
46
+ `https://raw.githubusercontent.com/${repo}/main/CHANGELOG.md`,
47
+ ];
50
48
 
51
49
  for (const url of candidates) {
52
50
  try {
@@ -75,7 +73,8 @@ function _extractVersionSection(changelogText, version) {
75
73
 
76
74
  let end = lines.length;
77
75
  for (let j = start + 1; j < lines.length; j++) {
78
- if (/^#{1,3}\s*/.test(lines[j])) {
76
+ // Match the next version heading (level 2, ## but not ###)
77
+ if (/^##\s*(?!#)/.test(lines[j])) {
79
78
  end = j;
80
79
  break;
81
80
  }
@@ -89,15 +88,14 @@ async function showChangelogOnce(pkgName, version) {
89
88
  const seen = Array.isArray(store[pkgName]) ? store[pkgName] : [];
90
89
  if (seen.includes(version)) return;
91
90
 
92
- const tag = version.startsWith("v") ? version : `v${version}`;
93
- const changelog = await _fetchChangelogFromGitHub(tag);
91
+ const changelog = await _fetchChangelogFromGitHub(version);
94
92
  if (!changelog) return;
95
93
 
96
94
  const section = _extractVersionSection(changelog, version);
97
95
  if (!section) return;
98
96
 
99
97
  // Print a concise changelog section
100
- console.log("\n=== DocuBook CLI changelog (new) ===\n");
98
+ console.log("\n===========================================================\n");
101
99
  console.log(section.trim());
102
100
  console.log("\nFor full changelog, visit:");
103
101
  console.log(` https://github.com/DocuBook/docubook/blob/main/CHANGELOG.md\n`);
@@ -148,8 +146,8 @@ export function initializeProgram(version) {
148
146
  if (spinner && typeof spinner.stop === 'function') spinner.stop();
149
147
  console.log('Checking for updates...');
150
148
 
151
- if (latest === version) {
152
- console.log(`No update needed, current version is ${version}, fetched latest release is ${latest}`);
149
+ if (!lt(version, latest)) {
150
+ console.log(`No update needed, current version is ${version}, latest release is ${latest}`);
153
151
  return;
154
152
  }
155
153
 
@@ -195,7 +193,7 @@ export function initializeProgram(version) {
195
193
  .argument("[directory]", "The name of the project directory")
196
194
  .action(async (directory) => {
197
195
  const state = new CLIState();
198
-
196
+
199
197
  try {
200
198
  // Render welcome screen with version
201
199
  renderWelcome(version);
package/templates.json CHANGED
@@ -3,7 +3,7 @@
3
3
  {
4
4
  "id": "nextjs-vercel",
5
5
  "name": "nextjs-vercel",
6
- "description": "Modern documentation with Next.js and Vercel deployment",
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": "Modern documentation with Next.js standalone and Docker deployment",
22
+ "description": "Next.js standalone with Docker image (optimized for coolify, etc.)",
23
23
  "features": [
24
24
  "Next.js 16",
25
25
  "React 19",