@mdocs/cli 0.1.0 → 0.1.1

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/dist/index.js +4 -19
  2. package/package.json +2 -3
package/dist/index.js CHANGED
@@ -5,12 +5,12 @@ import { Command } from "commander";
5
5
 
6
6
  // src/commands/serve.ts
7
7
  import chalk2 from "chalk";
8
- import inquirer from "inquirer";
9
8
  import { startServer, DEFAULT_ORIGINS } from "@mdocs/server";
10
9
 
11
10
  // src/lib/mdocs.ts
12
11
  import { existsSync, mkdirSync } from "fs";
13
- import { join } from "path";
12
+ import { join, isAbsolute } from "path";
13
+ import { homedir } from "os";
14
14
  var MDOCS_DIR = ".mdocs";
15
15
  var REPOS_DIR = join(MDOCS_DIR, "repos");
16
16
  function mdocsExists(cwd) {
@@ -23,8 +23,8 @@ function createMdocsStructure(cwd) {
23
23
  mkdirSync(join(cwd, REPOS_DIR), { recursive: true });
24
24
  }
25
25
  function resolveDataDir(dataDir) {
26
- if (!dataDir) return process.cwd();
27
- return dataDir.startsWith(".") ? join(process.cwd(), dataDir) : dataDir;
26
+ if (!dataDir) return homedir();
27
+ return isAbsolute(dataDir) ? dataDir : join(process.cwd(), dataDir);
28
28
  }
29
29
 
30
30
  // src/commands/setup.ts
@@ -54,21 +54,6 @@ async function serve(options) {
54
54
  const port = parseInt(options.port, 10);
55
55
  const host = options.host;
56
56
  if (!mdocsExists(cwd) || !reposDirExists(cwd)) {
57
- console.log(chalk2.yellow("\n \u26A0 No .mdocs directory found in this project.\n"));
58
- const { confirm } = await inquirer.prompt([
59
- {
60
- type: "confirm",
61
- name: "confirm",
62
- message: "Would you like to initialize mDocs for this project?",
63
- default: true
64
- }
65
- ]);
66
- if (!confirm) {
67
- console.log(
68
- chalk2.dim("\n Aborted. Run ") + chalk2.cyan("mdocs setup") + chalk2.dim(" to initialize manually.\n")
69
- );
70
- process.exit(0);
71
- }
72
57
  await runSetup(cwd);
73
58
  }
74
59
  console.log(chalk2.dim(`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mdocs/cli",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "mDocs CLI — start the local documentation server",
5
5
  "type": "module",
6
6
  "bin": {
@@ -14,8 +14,7 @@
14
14
  "commander": "^12.1.0",
15
15
  "figlet": "^1.7.0",
16
16
  "gradient-string": "^2.0.2",
17
- "inquirer": "^9.2.23",
18
- "@mdocs/server": "0.1.0"
17
+ "@mdocs/server": "0.1.1"
19
18
  },
20
19
  "devDependencies": {
21
20
  "@types/figlet": "^1.5.8",