create-boltdocs 0.2.4 → 0.2.5

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/dist/index.cjs CHANGED
@@ -29,10 +29,8 @@ let node_url = require("node:url");
29
29
  let node_child_process = require("node:child_process");
30
30
  let prompts = require("prompts");
31
31
  prompts = __toESM(prompts);
32
- let picocolors = require("picocolors");
33
- picocolors = __toESM(picocolors);
32
+ let _bdocs_dui = require("@bdocs/dui");
34
33
  //#region src/index.ts
35
- const { green, yellow, bold, cyan, magenta, blue, red, dim } = picocolors.default;
36
34
  function getPackageManager() {
37
35
  const userAgent = process.env.npm_config_user_agent;
38
36
  if (userAgent?.includes("pnpm")) return "pnpm";
@@ -55,13 +53,13 @@ function copy(src, dest, replacements) {
55
53
  }
56
54
  async function run() {
57
55
  const pkgManager = getPackageManager();
58
- console.log(blue(bold(`
56
+ console.log(_bdocs_dui.colors.blue(_bdocs_dui.colors.bold(`
59
57
  ____ ___ _ _____ ____ ___ ____ ____
60
- | __ ) / _ \\| | |_ _| _ \\ / _ \\ / ___/ ___|
61
- | _ \\| | | | | | | | | | | | | | | \\___ \\
62
- | |_) | |_| | |___ | | | |_| | |_| | |___ ___) |
63
- |____/ \\___/|_____| |_| |____/ \\___/ \\____|____/`)));
64
- console.log(dim(`\n v0.0.4 - The modern documentation framework\n`));
58
+ | __ ) / _ \\| | |_ _| _ \\ / _ \\ / ___/ ___|
59
+ | _ \\| | | | | | | | | | | | | | | \\___ \\
60
+ | |_) | |_| | |___ | | | |_| | |_| | |___ ___) |
61
+ |____/ \\___/|_____| |_| |____/ \\___/ \\____|____/`)));
62
+ console.log(_bdocs_dui.colors.dim(`\n v0.0.4 - The modern documentation framework\n`));
65
63
  const response = await (0, prompts.default)([
66
64
  {
67
65
  type: "text",
@@ -87,24 +85,24 @@ async function run() {
87
85
  {
88
86
  type: "confirm",
89
87
  name: "install",
90
- message: `Install dependencies with ${bold(pkgManager)}?`,
88
+ message: `Install dependencies with ${_bdocs_dui.colors.bold(pkgManager)}?`,
91
89
  initial: true
92
90
  }
93
91
  ]);
94
92
  if (!response.projectName || !response.template) {
95
- console.log(yellow("\nOperation canceled."));
93
+ (0, _bdocs_dui.warn)("Operation canceled.");
96
94
  return;
97
95
  }
98
96
  const projectDir = node_path.default.join(process.cwd(), response.projectName);
99
97
  if (node_fs.default.existsSync(projectDir)) {
100
- console.error(red(`\nError: Directory "${response.projectName}" already exists.`));
98
+ (0, _bdocs_dui.error)(`Directory "${response.projectName}" already exists.`);
101
99
  process.exit(1);
102
100
  }
103
- console.log(dim(`\nBuilding your documentation site...\n`));
101
+ (0, _bdocs_dui.info)("Building your documentation site...");
104
102
  const __dirname = node_path.default.dirname((0, node_url.fileURLToPath)(require("url").pathToFileURL(__filename).href));
105
103
  const templateDir = node_path.default.resolve(__dirname, "templates", response.template);
106
104
  if (!node_fs.default.existsSync(templateDir)) {
107
- console.error(red(`\nError: Template "${response.template}" not found at ${templateDir}`));
105
+ (0, _bdocs_dui.error)(`Template "${response.template}" not found at ${templateDir}`);
108
106
  process.exit(1);
109
107
  }
110
108
  try {
@@ -112,28 +110,28 @@ async function run() {
112
110
  name: response.projectName,
113
111
  title: response.projectName
114
112
  });
115
- console.log(`${green("✔")} Created project structure and applied "${response.template}" preset`);
116
- } catch (error) {
117
- console.error(red(`\nError copying template: ${error instanceof Error ? error.message : String(error)}`));
113
+ (0, _bdocs_dui.success)(`Created project structure and applied "${response.template}" preset`);
114
+ } catch (e) {
115
+ (0, _bdocs_dui.error)(`Error copying template: ${e instanceof Error ? e.message : String(e)}`);
118
116
  process.exit(1);
119
117
  }
120
118
  if (response.install) {
121
- console.log(cyan(`\nInstalling dependencies with ${pkgManager}...\n`));
119
+ (0, _bdocs_dui.info)(`Installing dependencies with ${pkgManager}...`);
122
120
  try {
123
121
  (0, node_child_process.execSync)(`${pkgManager} install`, {
124
122
  cwd: projectDir,
125
123
  stdio: "inherit"
126
124
  });
127
- console.log(`\n${green("✔")} Dependencies installed successfully`);
125
+ (0, _bdocs_dui.success)("Dependencies installed successfully");
128
126
  } catch (e) {
129
- console.log(yellow(`\nCould not install dependencies automatically. Please run "${pkgManager} install".`));
127
+ (0, _bdocs_dui.warn)(`Could not install dependencies automatically. Please run "${pkgManager} install".`);
130
128
  }
131
129
  }
132
- console.log(bold(green("\n✨ All set! Your documentation is ready. ✨\n")));
130
+ (0, _bdocs_dui.success)("✨ All set! Your documentation is ready. ");
133
131
  console.log(`To start developing:`);
134
132
  console.log(` cd ${response.projectName}`);
135
133
  if (!response.install) console.log(` ${pkgManager} install`);
136
134
  console.log(` ${pkgManager} run dev\n`);
137
135
  }
138
- run().catch(console.error);
136
+ run().catch((e) => (0, _bdocs_dui.error)("Unhandled error", e));
139
137
  //#endregion
package/dist/index.mjs CHANGED
@@ -4,9 +4,8 @@ import path from "node:path";
4
4
  import { fileURLToPath } from "node:url";
5
5
  import { execSync } from "node:child_process";
6
6
  import prompts from "prompts";
7
- import picocolors from "picocolors";
7
+ import { colors, error, info, success, warn } from "@bdocs/dui";
8
8
  //#region src/index.ts
9
- const { green, yellow, bold, cyan, magenta, blue, red, dim } = picocolors;
10
9
  function getPackageManager() {
11
10
  const userAgent = process.env.npm_config_user_agent;
12
11
  if (userAgent?.includes("pnpm")) return "pnpm";
@@ -29,13 +28,13 @@ function copy(src, dest, replacements) {
29
28
  }
30
29
  async function run() {
31
30
  const pkgManager = getPackageManager();
32
- console.log(blue(bold(`
31
+ console.log(colors.blue(colors.bold(`
33
32
  ____ ___ _ _____ ____ ___ ____ ____
34
- | __ ) / _ \\| | |_ _| _ \\ / _ \\ / ___/ ___|
35
- | _ \\| | | | | | | | | | | | | | | \\___ \\
36
- | |_) | |_| | |___ | | | |_| | |_| | |___ ___) |
37
- |____/ \\___/|_____| |_| |____/ \\___/ \\____|____/`)));
38
- console.log(dim(`\n v0.0.4 - The modern documentation framework\n`));
33
+ | __ ) / _ \\| | |_ _| _ \\ / _ \\ / ___/ ___|
34
+ | _ \\| | | | | | | | | | | | | | | \\___ \\
35
+ | |_) | |_| | |___ | | | |_| | |_| | |___ ___) |
36
+ |____/ \\___/|_____| |_| |____/ \\___/ \\____|____/`)));
37
+ console.log(colors.dim(`\n v0.0.4 - The modern documentation framework\n`));
39
38
  const response = await prompts([
40
39
  {
41
40
  type: "text",
@@ -61,24 +60,24 @@ async function run() {
61
60
  {
62
61
  type: "confirm",
63
62
  name: "install",
64
- message: `Install dependencies with ${bold(pkgManager)}?`,
63
+ message: `Install dependencies with ${colors.bold(pkgManager)}?`,
65
64
  initial: true
66
65
  }
67
66
  ]);
68
67
  if (!response.projectName || !response.template) {
69
- console.log(yellow("\nOperation canceled."));
68
+ warn("Operation canceled.");
70
69
  return;
71
70
  }
72
71
  const projectDir = path.join(process.cwd(), response.projectName);
73
72
  if (fs.existsSync(projectDir)) {
74
- console.error(red(`\nError: Directory "${response.projectName}" already exists.`));
73
+ error(`Directory "${response.projectName}" already exists.`);
75
74
  process.exit(1);
76
75
  }
77
- console.log(dim(`\nBuilding your documentation site...\n`));
76
+ info("Building your documentation site...");
78
77
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
79
78
  const templateDir = path.resolve(__dirname, "templates", response.template);
80
79
  if (!fs.existsSync(templateDir)) {
81
- console.error(red(`\nError: Template "${response.template}" not found at ${templateDir}`));
80
+ error(`Template "${response.template}" not found at ${templateDir}`);
82
81
  process.exit(1);
83
82
  }
84
83
  try {
@@ -86,29 +85,29 @@ async function run() {
86
85
  name: response.projectName,
87
86
  title: response.projectName
88
87
  });
89
- console.log(`${green("✔")} Created project structure and applied "${response.template}" preset`);
90
- } catch (error) {
91
- console.error(red(`\nError copying template: ${error instanceof Error ? error.message : String(error)}`));
88
+ success(`Created project structure and applied "${response.template}" preset`);
89
+ } catch (e) {
90
+ error(`Error copying template: ${e instanceof Error ? e.message : String(e)}`);
92
91
  process.exit(1);
93
92
  }
94
93
  if (response.install) {
95
- console.log(cyan(`\nInstalling dependencies with ${pkgManager}...\n`));
94
+ info(`Installing dependencies with ${pkgManager}...`);
96
95
  try {
97
96
  execSync(`${pkgManager} install`, {
98
97
  cwd: projectDir,
99
98
  stdio: "inherit"
100
99
  });
101
- console.log(`\n${green("✔")} Dependencies installed successfully`);
100
+ success("Dependencies installed successfully");
102
101
  } catch (e) {
103
- console.log(yellow(`\nCould not install dependencies automatically. Please run "${pkgManager} install".`));
102
+ warn(`Could not install dependencies automatically. Please run "${pkgManager} install".`);
104
103
  }
105
104
  }
106
- console.log(bold(green("\n✨ All set! Your documentation is ready. ✨\n")));
105
+ success("✨ All set! Your documentation is ready. ");
107
106
  console.log(`To start developing:`);
108
107
  console.log(` cd ${response.projectName}`);
109
108
  if (!response.install) console.log(` ${pkgManager} install`);
110
109
  console.log(` ${pkgManager} run dev\n`);
111
110
  }
112
- run().catch(console.error);
111
+ run().catch((e) => error("Unhandled error", e));
113
112
  //#endregion
114
113
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-boltdocs",
3
- "version": "0.2.4",
3
+ "version": "0.2.5",
4
4
  "description": "Create a new boltdocs project",
5
5
  "type": "module",
6
6
  "author": "Jesus Alcala",
@@ -16,8 +16,8 @@
16
16
  "dist"
17
17
  ],
18
18
  "dependencies": {
19
- "picocolors": "^1.1.0",
20
- "prompts": "^2.4.2"
19
+ "prompts": "^2.4.2",
20
+ "@bdocs/dui": "0.1.1"
21
21
  },
22
22
  "devDependencies": {
23
23
  "@types/node": "^22.0.0",