@docubook/create 1.4.0 → 1.4.2
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 +17 -13
- package/create.js +47 -39
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
## Installation
|
|
18
18
|
|
|
19
19
|
```bash
|
|
20
|
-
npx
|
|
20
|
+
npx @docubook/create@latest
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
#### command output
|
|
@@ -41,26 +41,30 @@ Next steps:
|
|
|
41
41
|
### How to Update DocuBook?
|
|
42
42
|
- **Open a New Terminal**: Please open a new terminal on the desktop that has DocuBook installed.
|
|
43
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
44
|
|
|
46
45
|
```bash
|
|
47
|
-
npx
|
|
46
|
+
npx @docubook/update@latest
|
|
48
47
|
```
|
|
49
48
|
|
|
50
49
|
#### command output
|
|
51
50
|
|
|
52
51
|
```bash
|
|
53
|
-
Updating Docubook project in /
|
|
54
|
-
|
|
55
|
-
ℹ Skipped
|
|
56
|
-
ℹ Skipped contents
|
|
57
|
-
ℹ Skipped app/page.tsx
|
|
58
|
-
ℹ Skipped
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
52
|
+
📂 Updating Docubook project in /Users/wildan/Public/docubook...
|
|
53
|
+
|
|
54
|
+
ℹ ⚡ Skipped public
|
|
55
|
+
ℹ ⚡ Skipped contents
|
|
56
|
+
ℹ ⚡ Skipped app/page.tsx
|
|
57
|
+
ℹ ⚡ Skipped docu.json
|
|
58
|
+
ℹ ⚡ Skipped CHANGELOG.md
|
|
59
|
+
✨ Replacing styles folder...
|
|
60
|
+
✨ Replaced all CSS files in styles folder
|
|
61
|
+
✔ ✅ Docubook v1.4.2 successfully updated in /Users/wildan/Public/docubook!
|
|
62
|
+
|
|
63
|
+
🎯 Next steps:
|
|
62
64
|
1. Verify your changes in the current directory.
|
|
63
|
-
2. Run the
|
|
65
|
+
2. Run the install script to check for package updates:
|
|
66
|
+
npm install
|
|
67
|
+
3. Run the development server:
|
|
64
68
|
npm run dev
|
|
65
69
|
```
|
|
66
70
|
|
package/create.js
CHANGED
|
@@ -19,49 +19,44 @@ function checkNodeInstalled() {
|
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
22
|
+
// Cek apakah Bun sudah terinstal
|
|
23
|
+
function checkBunInstalled() {
|
|
24
|
+
try {
|
|
25
|
+
execSync("bun --version", { stdio: "ignore" });
|
|
26
|
+
return true;
|
|
27
|
+
} catch {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Fungsi untuk mengganti nama file postcss
|
|
33
|
+
function updatePostcssConfig(projectPath) {
|
|
34
|
+
const oldConfigPath = path.join(projectPath, "postcss.config.js");
|
|
35
|
+
const newConfigPath = path.join(projectPath, "postcss.config.cjs");
|
|
36
|
+
|
|
37
|
+
if (fs.existsSync(oldConfigPath)) {
|
|
38
|
+
fs.renameSync(oldConfigPath, newConfigPath);
|
|
39
|
+
console.log(chalk.green("Renamed postcss.config.js to postcss.config.cjs for Bun compatibility."));
|
|
40
40
|
} else {
|
|
41
|
-
console.log(chalk.yellow("
|
|
42
|
-
process.exit(1);
|
|
41
|
+
console.log(chalk.yellow("No postcss.config.js file found. Skipping rename."));
|
|
43
42
|
}
|
|
44
43
|
}
|
|
45
44
|
|
|
46
45
|
program
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
if (!checkNodeInstalled()) {
|
|
52
|
-
await promptInstallNode();
|
|
53
|
-
}
|
|
54
|
-
|
|
46
|
+
.version("1.4.2")
|
|
47
|
+
.description("CLI to create a new Docubook project")
|
|
48
|
+
.argument("[project-directory]", "Directory to create the new Docubook project")
|
|
49
|
+
.action(async (projectDirectory) => {
|
|
55
50
|
if (!projectDirectory) {
|
|
56
|
-
|
|
51
|
+
const { directoryName } = await inquirer.prompt([
|
|
57
52
|
{
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
53
|
+
type: "input",
|
|
54
|
+
name: "directoryName",
|
|
55
|
+
message: "Enter a name for your project directory:",
|
|
56
|
+
default: "docubook",
|
|
62
57
|
},
|
|
63
|
-
|
|
64
|
-
|
|
58
|
+
]);
|
|
59
|
+
projectDirectory = directoryName;
|
|
65
60
|
}
|
|
66
61
|
|
|
67
62
|
const repo = "github:mywildancloud/docubook#starter";
|
|
@@ -73,6 +68,16 @@ program
|
|
|
73
68
|
await emitter.clone(projectPath);
|
|
74
69
|
spinner.succeed(`Docubook project successfully created in ${projectPath}!`);
|
|
75
70
|
|
|
71
|
+
updatePostcssConfig(projectPath);
|
|
72
|
+
|
|
73
|
+
if (checkBunInstalled()) {
|
|
74
|
+
console.log(chalk.green("\nBun detected. Installing dependencies with Bun..."));
|
|
75
|
+
execSync("bun install", { cwd: projectPath, stdio: "inherit" });
|
|
76
|
+
} else {
|
|
77
|
+
console.log(chalk.yellow("\nBun not found. Using npm for installation..."));
|
|
78
|
+
execSync("npm install", { cwd: projectPath, stdio: "inherit" });
|
|
79
|
+
}
|
|
80
|
+
|
|
76
81
|
const packageJsonPath = path.join(projectPath, "package.json");
|
|
77
82
|
if (fs.existsSync(packageJsonPath)) {
|
|
78
83
|
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf-8"));
|
|
@@ -82,10 +87,13 @@ program
|
|
|
82
87
|
console.log(chalk.magenta("\nNext steps:"));
|
|
83
88
|
console.log(`1. Navigate to your project directory:`);
|
|
84
89
|
console.log(` cd ${projectDirectory}`);
|
|
85
|
-
console.log(`2.
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
90
|
+
console.log(`2. Start the development server:`);
|
|
91
|
+
|
|
92
|
+
if (checkBunInstalled()) {
|
|
93
|
+
console.log(` bun run dev`);
|
|
94
|
+
} else {
|
|
95
|
+
console.log(` npm run dev`);
|
|
96
|
+
}
|
|
89
97
|
|
|
90
98
|
process.exit(0);
|
|
91
99
|
} catch (err) {
|