@docubook/create 1.5.2 → 1.7.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/create.js +16 -25
- package/package.json +1 -1
package/create.js
CHANGED
|
@@ -36,14 +36,14 @@ function updatePostcssConfig(projectPath) {
|
|
|
36
36
|
|
|
37
37
|
if (fs.existsSync(oldConfigPath)) {
|
|
38
38
|
fs.renameSync(oldConfigPath, newConfigPath);
|
|
39
|
-
console.log(chalk.
|
|
39
|
+
console.log(chalk.yellow("Renamed postcss.config.js to postcss.config.cjs for Bun compatibility."));
|
|
40
40
|
} else {
|
|
41
41
|
console.log(chalk.yellow("No postcss.config.js file found. Skipping rename."));
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
program
|
|
46
|
-
.version("1.
|
|
46
|
+
.version("1.7.0")
|
|
47
47
|
.description("CLI to create a new Docubook project")
|
|
48
48
|
.argument("[project-directory]", "Directory to create the new Docubook project")
|
|
49
49
|
.action(async (projectDirectory) => {
|
|
@@ -58,7 +58,7 @@ program
|
|
|
58
58
|
]);
|
|
59
59
|
projectDirectory = directoryName;
|
|
60
60
|
}
|
|
61
|
-
//
|
|
61
|
+
// --- clone from github ---
|
|
62
62
|
// const repo = "github:mywildancloud/docubook#starter";
|
|
63
63
|
// const emitter = degit(repo);
|
|
64
64
|
// const projectPath = path.resolve(process.cwd(), projectDirectory);
|
|
@@ -67,16 +67,19 @@ program
|
|
|
67
67
|
// try {
|
|
68
68
|
// await emitter.clone(projectPath);
|
|
69
69
|
// spinner.succeed(`Docubook project successfully created in ${projectPath}!`);
|
|
70
|
+
// --- clone from github ---
|
|
70
71
|
|
|
72
|
+
// --- clone from gitlab ---
|
|
71
73
|
const repo = "https://gitlab.com/mywildancloud/docubook.git";
|
|
72
74
|
const branch = "starter";
|
|
73
75
|
const projectPath = path.resolve(process.cwd(), projectDirectory);
|
|
74
76
|
const cloneCommand = `git clone --branch ${branch} ${repo} ${projectPath}`;
|
|
75
77
|
|
|
76
|
-
const spinner = ora(`Cloning ${chalk.
|
|
78
|
+
const spinner = ora(`Cloning ${chalk.yellow(branch)} from GitLab...`).start();
|
|
77
79
|
try {
|
|
78
80
|
execSync(cloneCommand, { stdio: "inherit" });
|
|
79
81
|
spinner.succeed(`Docubook project successfully created in ${projectPath}!`);
|
|
82
|
+
// --- clone from gitlab ---
|
|
80
83
|
|
|
81
84
|
// Jalankan rename hanya jika Bun terdeteksi
|
|
82
85
|
if (checkBunInstalled()) {
|
|
@@ -85,25 +88,6 @@ program
|
|
|
85
88
|
console.log(chalk.yellow("Skipping postcss.config.js rename because Bun is not installed."));
|
|
86
89
|
}
|
|
87
90
|
|
|
88
|
-
const { enter } = await inquirer.prompt([
|
|
89
|
-
{
|
|
90
|
-
type: "confirm",
|
|
91
|
-
name: "enter",
|
|
92
|
-
message: "Install dependencies in the current project directory?",
|
|
93
|
-
default: true,
|
|
94
|
-
},
|
|
95
|
-
]);
|
|
96
|
-
|
|
97
|
-
if (enter) {
|
|
98
|
-
if (checkBunInstalled()) {
|
|
99
|
-
console.log(chalk.green("\nBun detected. Installing dependencies with Bun..."));
|
|
100
|
-
execSync("bun install", { stdio: "inherit", cwd: projectPath });
|
|
101
|
-
} else {
|
|
102
|
-
console.log(chalk.green("\nInstalling dependencies with npm..."));
|
|
103
|
-
execSync("npm install", { stdio: "inherit", cwd: projectPath });
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
91
|
const packageJsonPath = path.join(projectPath, "package.json");
|
|
108
92
|
if (fs.existsSync(packageJsonPath)) {
|
|
109
93
|
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf-8"));
|
|
@@ -113,12 +97,19 @@ program
|
|
|
113
97
|
console.log(chalk.green("\nNext steps:"));
|
|
114
98
|
console.log(`1. Navigate to your project directory:`);
|
|
115
99
|
console.log(` ${chalk.green(`cd ${projectDirectory}`)}`);
|
|
116
|
-
console.log(`2.
|
|
100
|
+
console.log(`2. Install dependencies:`);
|
|
101
|
+
|
|
102
|
+
if (checkBunInstalled()) {
|
|
103
|
+
console.log(` ${chalk.green("bun install")}`);
|
|
104
|
+
} else {
|
|
105
|
+
console.log(` ${chalk.green("npm install or pnpm install or yarn install")}`);
|
|
106
|
+
}
|
|
107
|
+
console.log(`3. Start the development server:`);
|
|
117
108
|
|
|
118
109
|
if (checkBunInstalled()) {
|
|
119
110
|
console.log(` ${chalk.green("bun run dev")}`);
|
|
120
111
|
} else {
|
|
121
|
-
console.log(` ${chalk.green("npm run dev")}`);
|
|
112
|
+
console.log(` ${chalk.green("npm run dev or pnpm run dev or yarn dev")}`);
|
|
122
113
|
}
|
|
123
114
|
|
|
124
115
|
process.exit(0);
|