vuepress-jsdoc 4.3.0 → 5.0.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.
@@ -1,12 +1,12 @@
1
1
  /**
2
2
  * Runs through the given tree structure and creates a vuepress config
3
- * @param {object} data Informations to build config
4
- * @param {array} data.fileTree tree strcture
3
+ * @param {object} data Information to build config
4
+ * @param {array} data.fileTree tree structure
5
5
  * @param {string} data.codeFolder ./code/ folder
6
6
  * @param {string} data.srcFolder ./src/ folder
7
7
  * @param {string} data.docsFolder ./documentation/ folder
8
8
  * @param {string} data.title title string
9
- * @returns {object} returns the vuepress menu strcture
9
+ * @returns {object} returns the vuepress menu structure
10
10
  */
11
11
  export declare const generateVueSidebar: ({ fileTree, codeFolder, srcFolder, docsFolder, title }: {
12
12
  fileTree: any;
@@ -16,8 +16,11 @@ export declare const generateVueSidebar: ({ fileTree, codeFolder, srcFolder, doc
16
16
  title: string;
17
17
  }) => {
18
18
  [x: string]: {
19
- title: string;
19
+ text: string;
20
20
  collapsable: boolean;
21
- children: string[][];
21
+ children: {
22
+ link: string;
23
+ text: string;
24
+ }[];
22
25
  }[];
23
26
  };
@@ -1,15 +1,4 @@
1
1
  "use strict";
2
- var __values = (this && this.__values) || function(o) {
3
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
4
- if (m) return m.call(o);
5
- if (o && typeof o.length === "number") return {
6
- next: function () {
7
- if (o && i >= o.length) o = void 0;
8
- return { value: o && o[i++], done: !o };
9
- }
10
- };
11
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
12
- };
13
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
14
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
15
4
  };
@@ -21,62 +10,50 @@ exports.generateVueSidebar = void 0;
21
10
  * headline: lib/vue-sidebar.ts
22
11
  * ---
23
12
  */
24
- var fs_1 = __importDefault(require("fs"));
25
- var path_1 = require("path");
13
+ const node_fs_1 = __importDefault(require("node:fs"));
14
+ const node_path_1 = require("node:path");
26
15
  /**
27
16
  * Runs through the given tree structure and creates a vuepress config
28
- * @param {object} data Informations to build config
29
- * @param {array} data.fileTree tree strcture
17
+ * @param {object} data Information to build config
18
+ * @param {array} data.fileTree tree structure
30
19
  * @param {string} data.codeFolder ./code/ folder
31
20
  * @param {string} data.srcFolder ./src/ folder
32
21
  * @param {string} data.docsFolder ./documentation/ folder
33
22
  * @param {string} data.title title string
34
- * @returns {object} returns the vuepress menu strcture
23
+ * @returns {object} returns the vuepress menu structure
35
24
  */
36
- var generateVueSidebar = function (_a) {
37
- var _b;
38
- var fileTree = _a.fileTree, codeFolder = _a.codeFolder, srcFolder = _a.srcFolder, docsFolder = _a.docsFolder, title = _a.title;
39
- var rootFiles = [['', '::vuepress-jsdoc-title::']];
40
- rootFiles = rootFiles.concat(fileTree.filter(function (file) { return !file.children; }).map(function (file) { return file.name; }));
41
- var rootFolder = fileTree.filter(function (file) { return file.children && file.children.length > 0; });
42
- var buildChildren = function (children, name, depth) {
43
- var e_1, _a;
44
- var newChildren = [];
45
- try {
46
- for (var children_1 = __values(children), children_1_1 = children_1.next(); !children_1_1.done; children_1_1 = children_1.next()) {
47
- var child = children_1_1.value;
48
- if (child.children && child.children.length > 0) {
49
- newChildren = newChildren.concat(buildChildren(child.children, child.name, depth + 1));
50
- }
51
- else if (child.fullPath) {
52
- if (fs_1.default.existsSync((0, path_1.join)(docsFolder, child.fullPath.replace(srcFolder, '')) + '.md')) {
53
- newChildren.push(child.fullPath.replace("".concat(srcFolder, "/"), ''));
54
- }
55
- }
25
+ const generateVueSidebar = ({ fileTree, codeFolder, srcFolder, docsFolder, title }) => {
26
+ let rootFiles = [{ link: `/${codeFolder}/`, text: '::vuepress-jsdoc-title::' }];
27
+ rootFiles = rootFiles.concat(fileTree.filter((file) => !file.children).map((file) => `/${(0, node_path_1.join)(codeFolder, file.name)}`));
28
+ const rootFolder = fileTree.filter((file) => file.children && file.children.length > 0);
29
+ const buildChildren = (children, name, depth) => {
30
+ let newChildren = [];
31
+ for (const child of children) {
32
+ if (child.children && child.children.length > 0) {
33
+ newChildren = newChildren.concat(buildChildren(child.children, child.name, depth + 1));
56
34
  }
57
- }
58
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
59
- finally {
60
- try {
61
- if (children_1_1 && !children_1_1.done && (_a = children_1.return)) _a.call(children_1);
35
+ else if (child.fullPath) {
36
+ const path = child.fullPath.replace(srcFolder, '');
37
+ if (node_fs_1.default.existsSync(`${(0, node_path_1.join)(docsFolder, path)}.md`)) {
38
+ newChildren.push(`/${(0, node_path_1.join)(codeFolder, path)}`);
39
+ }
62
40
  }
63
- finally { if (e_1) throw e_1.error; }
64
41
  }
65
42
  return newChildren;
66
43
  };
67
- var tree = rootFolder.map(function (folder) { return ({
68
- title: folder.name,
44
+ const tree = rootFolder.map((folder) => ({
45
+ text: folder.name,
69
46
  collapsable: false,
70
47
  children: buildChildren(folder.children, folder.name, 0)
71
- }); });
72
- return _b = {},
73
- _b["/".concat(codeFolder, "/")] = [
48
+ }));
49
+ return {
50
+ [`/${codeFolder}/`]: [
74
51
  {
75
- title: title,
52
+ text: title,
76
53
  collapsable: false,
77
54
  children: rootFiles
78
55
  }
79
- ].concat(tree),
80
- _b;
56
+ ].concat(tree)
57
+ };
81
58
  };
82
59
  exports.generateVueSidebar = generateVueSidebar;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vuepress-jsdoc",
3
- "version": "4.3.0",
3
+ "version": "5.0.0",
4
4
  "description": "Generate jsdoc markdown files for vuepress",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -14,8 +14,8 @@
14
14
  "prepare": "husky install",
15
15
  "version": "conventional-changelog -p karma -i CHANGELOG.md -s -r 0 && git add .",
16
16
  "docs": "./bin/vuepress-jsdoc.js --source=./dist --partials=./example/partials/*.hbs --readme ./README.md --include=\"**/*.(ts|js)\" --exclude=\"**/*.d.ts,**/interfaces.*,**/constants.*\"",
17
- "docs:dev": "npx concurrently --kill-others \"npm run dev\" \"npm run docs && npx vuepress dev documentation\"",
18
- "docs:build": "npm run build && npm run docs && npx vuepress build documentation"
17
+ "docs:dev": "npx concurrently --kill-others \"npm run dev\" \"npm run docs -- -w\" \"vuepress dev documentation\"",
18
+ "docs:build": "npm run build && npm run docs && vuepress build documentation"
19
19
  },
20
20
  "keywords": [
21
21
  "jsdoc",
@@ -79,36 +79,39 @@
79
79
  "vuepress-jsdoc": "bin/vuepress-jsdoc.js"
80
80
  },
81
81
  "dependencies": {
82
- "chalk": "^4.1.2",
83
82
  "chokidar": "^3.5.3",
84
- "commander": "^9.0.0",
83
+ "commander": "^11.1.0",
85
84
  "del": "^6.0.0",
86
85
  "front-matter": "^4.0.2",
87
- "jsdoc-to-markdown": "^7.1.1",
88
- "micromatch": "^4.0.4",
89
- "mkdirp": "^1.0.4",
90
- "vue-docgen-cli": "^4.44.15"
86
+ "jsdoc-to-markdown": "^8.0.0",
87
+ "kleur": "^4.1.5",
88
+ "micromatch": "^4.0.5",
89
+ "mkdirp": "^3.0.1",
90
+ "vue-docgen-cli": "^4.67.0"
91
91
  },
92
92
  "devDependencies": {
93
- "@types/jest": "^27.4.0",
94
- "@types/jsdoc-to-markdown": "^7.0.3",
95
- "@types/micromatch": "^4.0.2",
93
+ "@types/jest": "^29.5.10",
94
+ "@types/jsdoc-to-markdown": "^7.0.6",
95
+ "@types/micromatch": "^4.0.6",
96
96
  "@types/mkdirp": "^1.0.2",
97
- "@typescript-eslint/eslint-plugin": "^5.12.0",
98
- "@typescript-eslint/parser": "^5.12.0",
99
- "babel-jest": "^27.5.1",
97
+ "@typescript-eslint/eslint-plugin": "^6.12.0",
98
+ "@typescript-eslint/parser": "^6.12.0",
99
+ "@vuepress/client": "^2.0.0-rc.0",
100
+ "babel-jest": "^29.7.0",
100
101
  "cross-env": "^7.0.3",
101
- "eslint": "^8.9.0",
102
- "eslint-config-prettier": "^8.3.0",
103
- "eslint-plugin-import": "^2.25.4",
104
- "eslint-plugin-jest": "^26.1.1",
102
+ "eslint": "^8.54.0",
103
+ "eslint-config-prettier": "^9.0.0",
104
+ "eslint-plugin-import": "^2.29.0",
105
+ "eslint-plugin-jest": "^27.6.0",
105
106
  "eslint-plugin-prefer-arrow": "^1.2.3",
106
- "husky": "^7.0.4",
107
- "jest": "^27.5.1",
108
- "lint-staged": "^12.3.4",
109
- "memfs": "^3.4.1",
110
- "ts-jest": "^27.1.3",
111
- "typescript": "^4.5.5"
107
+ "husky": "^8.0.3",
108
+ "jest": "^29.7.0",
109
+ "lint-staged": "^15.1.0",
110
+ "memfs": "^4.6.0",
111
+ "ts-jest": "^29.1.1",
112
+ "typescript": "^5.3.2",
113
+ "vue": "^3.3.8",
114
+ "vuepress": "^2.0.0-rc.0"
112
115
  },
113
116
  "lint-staged": {
114
117
  "src/**/*.{css,scss,json}": [