@docubook/create 1.4.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/README.md +67 -0
- package/create.js +98 -0
- package/package.json +24 -0
package/README.md
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# DocuBook
|
|
2
|
+
|
|
3
|
+
**DocuBook** is a documentation web project designed to provide a simple and user-friendly interface for accessing various types of documentation. This site is crafted for developers and teams who need quick access to references, guides, and essential documents.
|
|
4
|
+
|
|
5
|
+
> **Note**: This application is a fork of [AriaDocs](https://github.com/nisabmohd/Aria-Docs), created by [Nisab Mohd](https://github.com/nisabmohd). DocuBook provides an alternative to the documentation solution found on [Mintlify](https://mintlify.com/), utilizing `.mdx` (Markdown + JSX) for content creation and management.
|
|
6
|
+
|
|
7
|
+
[](https://vercel.com/import/project?template=https://github.com/mywildancloud/docubook)
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
- **Easy Navigation**: Simple layout for quick navigation between pages.
|
|
12
|
+
- **Quick Search**: Easily find documentation using a search function.
|
|
13
|
+
- **Responsive Theme**: Responsive design optimized for devices ranging from desktops to mobile.
|
|
14
|
+
- **Markdown Content**: Support for markdown-based documents.
|
|
15
|
+
- **SEO Friendly**: Optimized structure for search visibility, enhancing accessibility on search engines.
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npx create_docu
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
#### command output
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
? Enter a name for your project directory: (docubook)
|
|
27
|
+
|
|
28
|
+
Creating a new Docubook project in /path/your/docubook from the main branch...
|
|
29
|
+
✔ Docubook project successfully created in /path/your/docubook!
|
|
30
|
+
|
|
31
|
+
Next steps:
|
|
32
|
+
1. Navigate to your project directory:
|
|
33
|
+
cd docubook
|
|
34
|
+
2. Install dependencies:
|
|
35
|
+
npm install
|
|
36
|
+
3. Start the development server:
|
|
37
|
+
npm run dev
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Update
|
|
41
|
+
### How to Update DocuBook?
|
|
42
|
+
- **Open a New Terminal**: Please open a new terminal on the desktop that has DocuBook installed.
|
|
43
|
+
- **Move Directory**: for example, if the directory name is docubook, then write `cd docubook` and press enter.
|
|
44
|
+
- **npx update_docu**: run `npx update_docu` bash script.
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
npx update_docu@latest
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
#### command output
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
Updating Docubook project in /path/your/docubook...
|
|
54
|
+
ℹ Skipped public
|
|
55
|
+
ℹ Skipped styles
|
|
56
|
+
ℹ Skipped contents
|
|
57
|
+
ℹ Skipped app/page.tsx
|
|
58
|
+
ℹ Skipped app/hire-me
|
|
59
|
+
✔ Docubook project successfully updated in /path/your/docubook!
|
|
60
|
+
|
|
61
|
+
Next steps:
|
|
62
|
+
1. Verify your changes in the current directory.
|
|
63
|
+
2. Run the development server:
|
|
64
|
+
npm run dev
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Access the app on => http://localhost:3000
|
package/create.js
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { program } from "commander";
|
|
4
|
+
import degit from "degit";
|
|
5
|
+
import path from "path";
|
|
6
|
+
import fs from "fs";
|
|
7
|
+
import ora from "ora";
|
|
8
|
+
import chalk from "chalk";
|
|
9
|
+
import inquirer from "inquirer";
|
|
10
|
+
import { execSync } from "child_process";
|
|
11
|
+
|
|
12
|
+
// Cek apakah Node.js sudah terinstal
|
|
13
|
+
function checkNodeInstalled() {
|
|
14
|
+
try {
|
|
15
|
+
execSync("node -v", { stdio: "ignore" });
|
|
16
|
+
return true;
|
|
17
|
+
} catch {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
async function promptInstallNode() {
|
|
23
|
+
const { installNode } = await inquirer.prompt([
|
|
24
|
+
{
|
|
25
|
+
type: "confirm",
|
|
26
|
+
name: "installNode",
|
|
27
|
+
message: "Node.js is not installed. Do you want to install it now?",
|
|
28
|
+
default: true,
|
|
29
|
+
},
|
|
30
|
+
]);
|
|
31
|
+
if (installNode) {
|
|
32
|
+
console.log(chalk.green("Installing Node.js..."));
|
|
33
|
+
try {
|
|
34
|
+
execSync("curl -fsSL https://install-node.vercel.app | bash", { stdio: "inherit" });
|
|
35
|
+
console.log(chalk.green("Node.js installed successfully. Please rerun the command."));
|
|
36
|
+
} catch (error) {
|
|
37
|
+
console.error(chalk.red("Failed to install Node.js automatically. Please install it manually."));
|
|
38
|
+
}
|
|
39
|
+
process.exit(1);
|
|
40
|
+
} else {
|
|
41
|
+
console.log(chalk.yellow("Node.js is required to continue. Exiting."));
|
|
42
|
+
process.exit(1);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
program
|
|
47
|
+
.version("1.4.0")
|
|
48
|
+
.description("CLI to create a new Docubook project")
|
|
49
|
+
.argument("[project-directory]", "Directory to create the new Docubook project")
|
|
50
|
+
.action(async (projectDirectory) => {
|
|
51
|
+
if (!checkNodeInstalled()) {
|
|
52
|
+
await promptInstallNode();
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (!projectDirectory) {
|
|
56
|
+
const { directoryName } = await inquirer.prompt([
|
|
57
|
+
{
|
|
58
|
+
type: "input",
|
|
59
|
+
name: "directoryName",
|
|
60
|
+
message: "Enter a name for your project directory:",
|
|
61
|
+
default: "docubook",
|
|
62
|
+
},
|
|
63
|
+
]);
|
|
64
|
+
projectDirectory = directoryName;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const repo = "github:mywildancloud/docubook#starter";
|
|
68
|
+
const emitter = degit(repo);
|
|
69
|
+
const projectPath = path.resolve(process.cwd(), projectDirectory);
|
|
70
|
+
|
|
71
|
+
const spinner = ora(`Cloning ${chalk.magenta("starter")}...`).start();
|
|
72
|
+
try {
|
|
73
|
+
await emitter.clone(projectPath);
|
|
74
|
+
spinner.succeed(`Docubook project successfully created in ${projectPath}!`);
|
|
75
|
+
|
|
76
|
+
const packageJsonPath = path.join(projectPath, "package.json");
|
|
77
|
+
if (fs.existsSync(packageJsonPath)) {
|
|
78
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf-8"));
|
|
79
|
+
console.log(chalk.green(`\nDocubook version: ${packageJson.version}\n`));
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
console.log(chalk.magenta("\nNext steps:"));
|
|
83
|
+
console.log(`1. Navigate to your project directory:`);
|
|
84
|
+
console.log(` cd ${projectDirectory}`);
|
|
85
|
+
console.log(`2. Install dependencies:`);
|
|
86
|
+
console.log(` npm install`);
|
|
87
|
+
console.log(`3. Start the development server:`);
|
|
88
|
+
console.log(` npm run dev`);
|
|
89
|
+
|
|
90
|
+
process.exit(0);
|
|
91
|
+
} catch (err) {
|
|
92
|
+
spinner.fail("Error creating project:");
|
|
93
|
+
console.error(err.message);
|
|
94
|
+
process.exit(1);
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
program.parse(process.argv);
|
package/package.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@docubook/create",
|
|
3
|
+
"version": "1.4.0",
|
|
4
|
+
"main": "index.js",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"create": "./create.js"
|
|
8
|
+
},
|
|
9
|
+
"keywords": [
|
|
10
|
+
"template",
|
|
11
|
+
"create-template",
|
|
12
|
+
"documentation"
|
|
13
|
+
],
|
|
14
|
+
"author": "wildan.nrs",
|
|
15
|
+
"license": "MIT",
|
|
16
|
+
"description": "CLI to create DocuBook projects",
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"chalk": "^5.3.0",
|
|
19
|
+
"commander": "^12.1.0",
|
|
20
|
+
"degit": "^2.8.4",
|
|
21
|
+
"inquirer": "^11.0.2",
|
|
22
|
+
"ora": "^8.1.0"
|
|
23
|
+
}
|
|
24
|
+
}
|