@docubook/create 1.4.8 → 1.5.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.
Files changed (2) hide show
  1. package/create.js +38 -19
  2. package/package.json +1 -1
package/create.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import { program } from "commander";
4
- import degit from "degit";
4
+ // import degit from "degit";
5
5
  import path from "path";
6
6
  import fs from "fs";
7
7
  import ora from "ora";
@@ -43,32 +43,51 @@ function updatePostcssConfig(projectPath) {
43
43
  }
44
44
 
45
45
  program
46
- .version("1.4.8")
47
- .description("CLI to create a new Docubook project")
48
- .argument("[project-directory]", "Directory to create the new Docubook project")
49
- .action(async (projectDirectory) => {
46
+ .version("1.5.0")
47
+ .description("CLI to create a new Docubook project")
48
+ .argument("[project-directory]", "Directory to create the new Docubook project")
49
+ .action(async (projectDirectory) => {
50
50
  if (!projectDirectory) {
51
- const { directoryName } = await inquirer.prompt([
51
+ const { directoryName } = await inquirer.prompt([
52
52
  {
53
- type: "input",
54
- name: "directoryName",
55
- message: "Enter a name for your project directory:",
56
- default: "docubook",
53
+ type: "input",
54
+ name: "directoryName",
55
+ message: "Enter a name for your project directory:",
56
+ default: "docubook",
57
57
  },
58
- ]);
59
- projectDirectory = directoryName;
58
+ ]);
59
+ projectDirectory = directoryName;
60
60
  }
61
+ // for github skrip
62
+ // const repo = "github:mywildancloud/docubook#starter";
63
+ // const emitter = degit(repo);
64
+ // const projectPath = path.resolve(process.cwd(), projectDirectory);
65
+
66
+ // const spinner = ora(`Cloning ${chalk.green("starter")}...`).start();
67
+ // try {
68
+ // await emitter.clone(projectPath);
69
+ // spinner.succeed(`Docubook project successfully created in ${projectPath}!`);
61
70
 
62
- const repo = "github:mywildancloud/docubook#starter";
63
- const emitter = degit(repo);
64
- const projectPath = path.resolve(process.cwd(), projectDirectory);
71
+ const repo = "https://gitlab.com/mywildancloud/docubook.git";
72
+ const branch = "starter";
73
+ const cloneCommand = `git clone --branch ${branch} ${repo} ${projectPath}`;
65
74
 
66
- const spinner = ora(`Cloning ${chalk.green("starter")}...`).start();
75
+ const spinner = ora(`Cloning ${chalk.green(branch)} from GitLab...`).start();
67
76
  try {
68
- await emitter.clone(projectPath);
69
- spinner.succeed(`Docubook project successfully created in ${projectPath}!`);
77
+ execSync(cloneCommand, { stdio: "inherit" });
78
+ spinner.succeed(`Docubook project successfully created in ${projectPath}!`);
79
+ } catch (err) {
80
+ spinner.fail("Error cloning project:");
81
+ console.error(err.message);
82
+ process.exit(1);
83
+ }
70
84
 
71
- updatePostcssConfig(projectPath);
85
+ // Jalankan rename hanya jika Bun terdeteksi
86
+ if (checkBunInstalled()) {
87
+ updatePostcssConfig(projectPath);
88
+ } else {
89
+ console.log(chalk.yellow("Skipping postcss.config.js rename because Bun is not installed."));
90
+ }
72
91
 
73
92
  const { enter } = await inquirer.prompt([
74
93
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docubook/create",
3
- "version": "1.4.8",
3
+ "version": "1.5.0",
4
4
  "main": "index.js",
5
5
  "type": "module",
6
6
  "bin": {