vuepress-jsdoc 4.0.4 → 4.3.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/CHANGELOG.md +28 -0
- package/README.md +2 -1
- package/dist/cmds.d.ts +6 -0
- package/dist/cmds.js +13 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +100 -110
- package/dist/interfaces.d.ts +1 -0
- package/dist/lib/comment-parser.d.ts +3 -3
- package/dist/lib/comment-parser.js +6 -6
- package/dist/lib/list-folder.d.ts +6 -5
- package/dist/lib/list-folder.js +57 -41
- package/dist/lib/parser.d.ts +5 -5
- package/dist/lib/parser.js +9 -8
- package/dist/lib/utils.d.ts +4 -4
- package/dist/lib/utils.js +17 -8
- package/dist/lib/vue-sidebar.d.ts +6 -6
- package/dist/lib/vue-sidebar.js +8 -8
- package/package.json +21 -21
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
|
+
## 4.3.0 (2022-02-15)
|
|
2
|
+
|
|
3
|
+
* feat(include): add include flag, fix some bugs and improve performance ([082a60a](https://github.com/ph1p/vuepress-jsdoc/commit/082a60a))
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
## 4.2.0 (2021-11-17)
|
|
8
|
+
|
|
9
|
+
* 4.2.0 ([3cdbc8a](https://github.com/ph1p/vuepress-jsdoc/commit/3cdbc8a))
|
|
10
|
+
* build(deps): update dependencies ([858dff8](https://github.com/ph1p/vuepress-jsdoc/commit/858dff8))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## <small>4.1.1 (2021-10-05)</small>
|
|
15
|
+
|
|
16
|
+
* 4.1.1 ([975b04f](https://github.com/ph1p/vuepress-jsdoc/commit/975b04f))
|
|
17
|
+
* chore(deps): update dependencies ([b3ac12c](https://github.com/ph1p/vuepress-jsdoc/commit/b3ac12c))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
## 4.1.0 (2021-09-20)
|
|
22
|
+
|
|
23
|
+
* 4.1.0 ([ac88980](https://github.com/ph1p/vuepress-jsdoc/commit/ac88980))
|
|
24
|
+
* chore: update dependencies and documentation ([8e83013](https://github.com/ph1p/vuepress-jsdoc/commit/8e83013))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
1
28
|
## <small>4.0.4 (2021-09-03)</small>
|
|
2
29
|
|
|
30
|
+
* 4.0.4 ([1452e46](https://github.com/ph1p/vuepress-jsdoc/commit/1452e46))
|
|
3
31
|
* refactor: fix some code smells ([a910cff](https://github.com/ph1p/vuepress-jsdoc/commit/a910cff))
|
|
4
32
|
* docs: fix watch-mode and add more informations ([c356bcc](https://github.com/ph1p/vuepress-jsdoc/commit/c356bcc))
|
|
5
33
|
* docs: remove old informations ([1e4f344](https://github.com/ph1p/vuepress-jsdoc/commit/1e4f344))
|
package/README.md
CHANGED
|
@@ -66,6 +66,7 @@ Use these options after `vuepress-jsdoc`.
|
|
|
66
66
|
| --version | -v | | Show current version |
|
|
67
67
|
| --readme | -r | | Path to custom readme file |
|
|
68
68
|
| --exclude | -e | | Pattern to exclude files/folders (Comma seperated) - \*.test.js,exclude.js [more information](https://github.com/micromatch/micromatch#ismatch) |
|
|
69
|
+
| --include | -e | | Pattern to include files/folders (Comma seperated) - \*.test.js,exclude.js [more information](https://github.com/micromatch/micromatch#ismatch) |
|
|
69
70
|
| --rmPattern | -rm | | Pattern when removing files. You can ex- and include files. (glob pattern) |
|
|
70
71
|
| --partials | -p | | jsdoc2markdown partial templates (overwrites default ones) |
|
|
71
72
|
| --jsDocConfigPath | -c | | Path to [JsDoc Config](http://usejsdoc.org/about-configuring-jsdoc.html) (experimental) |
|
|
@@ -162,7 +163,7 @@ Use `headline` to add a custom `h1` title.
|
|
|
162
163
|
To use typescript, you have to install these dev-dependencies:
|
|
163
164
|
|
|
164
165
|
```bash
|
|
165
|
-
|
|
166
|
+
npm install -D typescript jsdoc-babel @babel/cli @babel/core @babel/preset-env @babel/preset-typescript jsdoc-to-markdown
|
|
166
167
|
```
|
|
167
168
|
|
|
168
169
|
Next, you have to add a `jsdoc.json` to your project with some settings and add it with the `-c` parameter.
|
package/dist/cmds.d.ts
CHANGED
|
@@ -1,2 +1,8 @@
|
|
|
1
1
|
declare const _default: (version: string) => void;
|
|
2
|
+
/**
|
|
3
|
+
* This method builds the cli interface and is necessary because
|
|
4
|
+
* we need the version from the package.json here. We do not import
|
|
5
|
+
* this here, because otherwise the folder structure in the dist folder would get mixed up.
|
|
6
|
+
* @param {string} version a version string
|
|
7
|
+
*/
|
|
2
8
|
export default _default;
|
package/dist/cmds.js
CHANGED
|
@@ -1,7 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/*
|
|
4
|
+
* @vuepress
|
|
5
|
+
* ---
|
|
6
|
+
* headline: cmds.ts
|
|
7
|
+
* ---
|
|
8
|
+
*/
|
|
3
9
|
var commander_1 = require("commander");
|
|
4
10
|
var _1 = require(".");
|
|
11
|
+
/**
|
|
12
|
+
* This method builds the cli interface and is necessary because
|
|
13
|
+
* we need the version from the package.json here. We do not import
|
|
14
|
+
* this here, because otherwise the folder structure in the dist folder would get mixed up.
|
|
15
|
+
* @param {string} version a version string
|
|
16
|
+
*/
|
|
5
17
|
exports.default = (function (version) {
|
|
6
18
|
commander_1.program.version(version).description('a CLI Tool to generate markdown files for vuepress');
|
|
7
19
|
commander_1.program
|
|
@@ -11,6 +23,7 @@ exports.default = (function (version) {
|
|
|
11
23
|
.option('-f, --folder <string>', 'Folder inside destination folder. Gets overwritten everytime', 'code')
|
|
12
24
|
.option('-t, --title <string>', 'Title of your documentation', 'API')
|
|
13
25
|
.option('-r, --readme <string>', 'Path to your custom readme')
|
|
26
|
+
.option('-i, --include <string>', 'Pattern to include files/folders (Comma seperated) - *.test.js,include.js')
|
|
14
27
|
.option('-e, --exclude <string>', 'Pattern to exclude files/folders (Comma seperated) - *.test.js,exclude.js')
|
|
15
28
|
.option('-w, --watch', 'This flag watches your source files')
|
|
16
29
|
.option('-rm, --rmPattern [files...]', 'Pattern when removing files. You can ex- and include files. (glob pattern)', '')
|
package/dist/index.d.ts
CHANGED
|
@@ -6,8 +6,8 @@ import { CLIArguments } from './interfaces';
|
|
|
6
6
|
export declare const generate: (argv: CLIArguments) => Promise<void>;
|
|
7
7
|
/**
|
|
8
8
|
* The vuepress plugins
|
|
9
|
-
* @param
|
|
10
|
-
* @param
|
|
9
|
+
* @param {CLIArguments} argv
|
|
10
|
+
* @param {object} ctx
|
|
11
11
|
* @returns {object}
|
|
12
12
|
*/
|
|
13
13
|
declare const plugin: (argv: CLIArguments, ctx: any) => {
|
package/dist/index.js
CHANGED
|
@@ -88,7 +88,6 @@ var chokidar_1 = __importDefault(require("chokidar"));
|
|
|
88
88
|
var del_1 = __importDefault(require("del"));
|
|
89
89
|
var promises_1 = __importDefault(require("fs/promises"));
|
|
90
90
|
var mkdirp_1 = __importDefault(require("mkdirp"));
|
|
91
|
-
var path_1 = require("path");
|
|
92
91
|
var readline_1 = __importDefault(require("readline"));
|
|
93
92
|
var constants_1 = require("./constants");
|
|
94
93
|
var list_folder_1 = require("./lib/list-folder");
|
|
@@ -96,66 +95,58 @@ var parser_1 = require("./lib/parser");
|
|
|
96
95
|
var vue_sidebar_1 = require("./lib/vue-sidebar");
|
|
97
96
|
/**
|
|
98
97
|
* Create the sidebar
|
|
99
|
-
* @param
|
|
98
|
+
* @param {object} options
|
|
100
99
|
* @returns {Promise}
|
|
101
100
|
*/
|
|
102
101
|
var createVuepressSidebar = function (options) {
|
|
103
|
-
return promises_1.default.writeFile(options.docsFolder
|
|
102
|
+
return promises_1.default.writeFile("".concat(options.docsFolder, "/config.js"), "exports.fileTree=".concat(JSON.stringify(options.fileTree), ";exports.sidebarTree = (title = 'Mainpage') => (").concat(JSON.stringify((0, vue_sidebar_1.generateVueSidebar)(options)).replace('::vuepress-jsdoc-title::', '"+title+"'), ");"));
|
|
104
103
|
};
|
|
105
104
|
/**
|
|
106
105
|
* Parse file
|
|
107
|
-
* @param
|
|
108
|
-
* @param
|
|
106
|
+
* @param {DirectoryFile} file
|
|
107
|
+
* @param {CLIArguments} argv
|
|
109
108
|
* @returns {Promise}
|
|
110
109
|
*/
|
|
111
|
-
var parseDirectoryFile = function (file, argv) {
|
|
112
|
-
var _a, srcFolder, docsFolder, partials
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
_a = parseArguments(argv), srcFolder = _a.srcFolder, docsFolder = _a.docsFolder, partials = _a.partials;
|
|
117
|
-
if (!(!file.isDir && file.folder)) return [3 /*break*/, 5];
|
|
118
|
-
dest = (0, path_1.join)(docsFolder, file.folder.replace(srcFolder, ''));
|
|
119
|
-
content = void 0;
|
|
120
|
-
if (!['.jsx', '.tsx', '.ts', '.js'].includes(file.ext || '')) return [3 /*break*/, 2];
|
|
121
|
-
return [4 /*yield*/, (0, parser_1.parseFile)(file, srcFolder, docsFolder, argv.jsDocConfigPath, partials)];
|
|
122
|
-
case 1:
|
|
123
|
-
content = _b.sent();
|
|
124
|
-
_b.label = 2;
|
|
125
|
-
case 2:
|
|
126
|
-
if (!(file.ext === '.vue')) return [3 /*break*/, 4];
|
|
127
|
-
return [4 /*yield*/, (0, parser_1.parseVueFile)(file, srcFolder, docsFolder)];
|
|
128
|
-
case 3:
|
|
129
|
-
content = _b.sent();
|
|
130
|
-
_b.label = 4;
|
|
131
|
-
case 4: return [2 /*return*/, { content: content, dest: dest }];
|
|
132
|
-
case 5: return [2 /*return*/];
|
|
110
|
+
var parseDirectoryFile = function (file, argv) {
|
|
111
|
+
var _a = parseArguments(argv), srcFolder = _a.srcFolder, docsFolder = _a.docsFolder, partials = _a.partials;
|
|
112
|
+
if (!file.isDir && file.folder) {
|
|
113
|
+
if (['.jsx', '.tsx', '.ts', '.js'].includes(file.ext || '')) {
|
|
114
|
+
return (0, parser_1.parseFile)(file, srcFolder, docsFolder, argv.jsDocConfigPath, partials);
|
|
133
115
|
}
|
|
134
|
-
|
|
135
|
-
|
|
116
|
+
if (file.ext === '.vue') {
|
|
117
|
+
return (0, parser_1.parseVueFile)(file, srcFolder, docsFolder);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
/**
|
|
122
|
+
* Create the readme file. First page when entering the documentation.
|
|
123
|
+
* @param {CLIArguments} argv
|
|
124
|
+
* @param {string} deletedPaths
|
|
125
|
+
* @returns {void}
|
|
126
|
+
*/
|
|
136
127
|
var createReadmeFile = function (argv, deletedPaths) { return __awaiter(void 0, void 0, void 0, function () {
|
|
137
128
|
var _a, srcFolder, codeFolder, docsFolder, title, readme, readMeContent, readmePath, e_1;
|
|
138
129
|
return __generator(this, function (_b) {
|
|
139
130
|
switch (_b.label) {
|
|
140
131
|
case 0:
|
|
141
132
|
_a = parseArguments(argv), srcFolder = _a.srcFolder, codeFolder = _a.codeFolder, docsFolder = _a.docsFolder, title = _a.title, readme = _a.readme;
|
|
142
|
-
readMeContent = "### Welcome to "
|
|
143
|
-
readmePath = readme || srcFolder
|
|
133
|
+
readMeContent = "### Welcome to ".concat(title);
|
|
134
|
+
readmePath = readme || "".concat(srcFolder, "/README.md");
|
|
144
135
|
_b.label = 1;
|
|
145
136
|
case 1:
|
|
146
137
|
_b.trys.push([1, 3, , 4]);
|
|
147
138
|
return [4 /*yield*/, promises_1.default.readFile(readmePath, 'utf-8')];
|
|
148
139
|
case 2:
|
|
149
140
|
readMeContent = _b.sent();
|
|
150
|
-
if (deletedPaths === null || deletedPaths === void 0 ? void 0 : deletedPaths.some(function (p) { return p.indexOf(codeFolder
|
|
151
|
-
console.log("\n"
|
|
141
|
+
if (deletedPaths === null || deletedPaths === void 0 ? void 0 : deletedPaths.some(function (p) { return p.indexOf("".concat(codeFolder, "/README.md")) !== -1; })) {
|
|
142
|
+
console.log("\n".concat(chalk_1.default.white.bgBlack(' README '), " ").concat(chalk_1.default.dim(readmePath.replace('README.md', ''))).concat(chalk_1.default.bold('README.md'), " \u2192 ").concat(chalk_1.default.dim(docsFolder)).concat(chalk_1.default.bold('/README.md')));
|
|
152
143
|
}
|
|
153
144
|
return [3 /*break*/, 4];
|
|
154
145
|
case 3:
|
|
155
146
|
e_1 = _b.sent();
|
|
156
|
-
console.log("\n"
|
|
147
|
+
console.log("\n".concat(chalk_1.default.white.bgBlack(' README '), " Add default README.md"));
|
|
157
148
|
return [3 /*break*/, 4];
|
|
158
|
-
case 4: return [4 /*yield*/, promises_1.default.writeFile(docsFolder
|
|
149
|
+
case 4: return [4 /*yield*/, promises_1.default.writeFile("".concat(docsFolder, "/README.md"), readMeContent)];
|
|
159
150
|
case 5:
|
|
160
151
|
_b.sent();
|
|
161
152
|
return [2 /*return*/];
|
|
@@ -164,15 +155,16 @@ var createReadmeFile = function (argv, deletedPaths) { return __awaiter(void 0,
|
|
|
164
155
|
}); };
|
|
165
156
|
/**
|
|
166
157
|
* Parse all CLI arguments
|
|
167
|
-
* @param
|
|
158
|
+
* @param {CLIArguments} argv
|
|
168
159
|
* @returns {object} all arguments
|
|
169
160
|
*/
|
|
170
161
|
var parseArguments = function (argv) {
|
|
171
162
|
return {
|
|
163
|
+
include: (argv.include || '').split(',').filter(Boolean),
|
|
172
164
|
exclude: (argv.exclude || '').split(',').filter(Boolean),
|
|
173
165
|
srcFolder: argv.source.replace('./', ''),
|
|
174
166
|
codeFolder: argv.folder,
|
|
175
|
-
docsFolder: argv.dist
|
|
167
|
+
docsFolder: "".concat(argv.dist, "/").concat(argv.folder),
|
|
176
168
|
title: argv.title,
|
|
177
169
|
readme: argv.readme,
|
|
178
170
|
rmPattern: argv.rmPattern || [],
|
|
@@ -184,17 +176,17 @@ var parseArguments = function (argv) {
|
|
|
184
176
|
* @param {object} argv passed arguments
|
|
185
177
|
*/
|
|
186
178
|
var generate = function (argv) { return __awaiter(void 0, void 0, void 0, function () {
|
|
187
|
-
var _a, exclude, srcFolder, codeFolder, docsFolder, title, rmPattern, startTime, deletedPaths, lsFolder, parsePromises, _b, _c, file, e_2_1, _d, _e, file,
|
|
179
|
+
var _a, exclude, include, srcFolder, codeFolder, docsFolder, title, rmPattern, startTime, deletedPaths, lsFolder, parsePromises, _b, _c, file, e_2_1, _loop_1, _d, _e, file, result, _f, _g, file, _h, _j, entry, color, resultTime;
|
|
188
180
|
var e_2, _k, e_3, _l, e_4, _m, e_5, _o, _p;
|
|
189
181
|
return __generator(this, function (_q) {
|
|
190
182
|
switch (_q.label) {
|
|
191
183
|
case 0:
|
|
192
|
-
_a = parseArguments(argv), exclude = _a.exclude, srcFolder = _a.srcFolder, codeFolder = _a.codeFolder, docsFolder = _a.docsFolder, title = _a.title, rmPattern = _a.rmPattern;
|
|
184
|
+
_a = parseArguments(argv), exclude = _a.exclude, include = _a.include, srcFolder = _a.srcFolder, codeFolder = _a.codeFolder, docsFolder = _a.docsFolder, title = _a.title, rmPattern = _a.rmPattern;
|
|
193
185
|
startTime = +new Date();
|
|
194
|
-
return [4 /*yield*/, (0, del_1.default)(__spreadArray([docsFolder
|
|
186
|
+
return [4 /*yield*/, (0, del_1.default)(__spreadArray(["".concat(docsFolder, "/**/*")], __read(rmPattern), false))];
|
|
195
187
|
case 1:
|
|
196
188
|
deletedPaths = _q.sent();
|
|
197
|
-
return [4 /*yield*/, (0, list_folder_1.listFolder)(srcFolder, exclude)];
|
|
189
|
+
return [4 /*yield*/, (0, list_folder_1.listFolder)(srcFolder, exclude, include)];
|
|
198
190
|
case 2:
|
|
199
191
|
lsFolder = _q.sent();
|
|
200
192
|
return [4 /*yield*/, (0, mkdirp_1.default)(docsFolder)];
|
|
@@ -212,7 +204,7 @@ var generate = function (argv) { return __awaiter(void 0, void 0, void 0, functi
|
|
|
212
204
|
if (!!file.isDir) return [3 /*break*/, 7];
|
|
213
205
|
readline_1.default.clearLine(process.stdout, 0);
|
|
214
206
|
readline_1.default.cursorTo(process.stdout, 0);
|
|
215
|
-
process.stdout.write(chalk_1.default.dim(" "
|
|
207
|
+
process.stdout.write(chalk_1.default.dim(" ".concat(file.path, " ")));
|
|
216
208
|
return [4 /*yield*/, new Promise(function (resolve) { return setTimeout(resolve, 20); })];
|
|
217
209
|
case 6:
|
|
218
210
|
_q.sent();
|
|
@@ -234,38 +226,40 @@ var generate = function (argv) { return __awaiter(void 0, void 0, void 0, functi
|
|
|
234
226
|
case 11:
|
|
235
227
|
readline_1.default.clearLine(process.stdout, 0);
|
|
236
228
|
readline_1.default.cursorTo(process.stdout, 0);
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
_e = _d.next();
|
|
254
|
-
return [3 /*break*/, 13];
|
|
255
|
-
case 16: return [3 /*break*/, 19];
|
|
256
|
-
case 17:
|
|
257
|
-
e_3_1 = _q.sent();
|
|
258
|
-
e_3 = { error: e_3_1 };
|
|
259
|
-
return [3 /*break*/, 19];
|
|
260
|
-
case 18:
|
|
229
|
+
_loop_1 = function (file) {
|
|
230
|
+
parsePromises.push((function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
231
|
+
var data;
|
|
232
|
+
return __generator(this, function (_a) {
|
|
233
|
+
switch (_a.label) {
|
|
234
|
+
case 0: return [4 /*yield*/, parseDirectoryFile(file, argv)];
|
|
235
|
+
case 1:
|
|
236
|
+
data = _a.sent();
|
|
237
|
+
if (data && (data === null || data === void 0 ? void 0 : data.relativePathDest)) {
|
|
238
|
+
return [2 /*return*/, (0, parser_1.writeContentToFile)(data, data.relativePathDest)];
|
|
239
|
+
}
|
|
240
|
+
return [2 /*return*/];
|
|
241
|
+
}
|
|
242
|
+
});
|
|
243
|
+
}); })());
|
|
244
|
+
};
|
|
261
245
|
try {
|
|
262
|
-
|
|
246
|
+
// iterate through files and parse them
|
|
247
|
+
for (_d = __values(lsFolder.paths), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
248
|
+
file = _e.value;
|
|
249
|
+
_loop_1(file);
|
|
250
|
+
}
|
|
263
251
|
}
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
252
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
253
|
+
finally {
|
|
254
|
+
try {
|
|
255
|
+
if (_e && !_e.done && (_l = _d.return)) _l.call(_d);
|
|
256
|
+
}
|
|
257
|
+
finally { if (e_3) throw e_3.error; }
|
|
258
|
+
}
|
|
259
|
+
return [4 /*yield*/, Promise.all(parsePromises)];
|
|
260
|
+
case 12:
|
|
268
261
|
result = _q.sent();
|
|
262
|
+
result = result.filter(Boolean);
|
|
269
263
|
// write vuepress sidebar
|
|
270
264
|
return [4 /*yield*/, createVuepressSidebar({
|
|
271
265
|
fileTree: lsFolder.tree,
|
|
@@ -274,14 +268,14 @@ var generate = function (argv) { return __awaiter(void 0, void 0, void 0, functi
|
|
|
274
268
|
codeFolder: codeFolder,
|
|
275
269
|
title: title
|
|
276
270
|
})];
|
|
277
|
-
case
|
|
271
|
+
case 13:
|
|
278
272
|
// write vuepress sidebar
|
|
279
273
|
_q.sent();
|
|
280
274
|
try {
|
|
281
275
|
// print stats
|
|
282
276
|
for (_f = __values(lsFolder.excluded), _g = _f.next(); !_g.done; _g = _f.next()) {
|
|
283
277
|
file = _g.value;
|
|
284
|
-
console.log(chalk_1.default.reset.inverse.bold.blue(' EXCLUDE '), ""
|
|
278
|
+
console.log(chalk_1.default.reset.inverse.bold.blue(' EXCLUDE '), "".concat(chalk_1.default.dim(file.folder)).concat(chalk_1.default.bold(file.name + file.ext)));
|
|
285
279
|
}
|
|
286
280
|
}
|
|
287
281
|
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
@@ -303,7 +297,7 @@ var generate = function (argv) { return __awaiter(void 0, void 0, void 0, functi
|
|
|
303
297
|
_p[constants_1.StatisticType.EMPTY] = 'yellow',
|
|
304
298
|
_p[constants_1.StatisticType.EXCLUDE] = 'blue',
|
|
305
299
|
_p)[entry.type];
|
|
306
|
-
console.log(chalk_1.default.reset.inverse.bold[color](" "
|
|
300
|
+
console.log(chalk_1.default.reset.inverse.bold[color](" ".concat(entry.type, " ")), "".concat(chalk_1.default.dim(entry.relativePathSrc)).concat(chalk_1.default.bold(entry.file.name + entry.file.ext), " \u2192 ").concat(chalk_1.default.dim(entry.relativePathDest)).concat(chalk_1.default.bold(entry.file.name + '.md')));
|
|
307
301
|
}
|
|
308
302
|
}
|
|
309
303
|
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
@@ -315,11 +309,11 @@ var generate = function (argv) { return __awaiter(void 0, void 0, void 0, functi
|
|
|
315
309
|
}
|
|
316
310
|
// create README.md
|
|
317
311
|
return [4 /*yield*/, createReadmeFile(argv, deletedPaths)];
|
|
318
|
-
case
|
|
312
|
+
case 14:
|
|
319
313
|
// create README.md
|
|
320
314
|
_q.sent();
|
|
321
315
|
resultTime = (Math.abs(startTime - +new Date()) / 1000).toFixed(2);
|
|
322
|
-
console.log("\n\u23F0 Time: "
|
|
316
|
+
console.log("\n\u23F0 Time: ".concat(resultTime, "s"));
|
|
323
317
|
watchFiles(argv);
|
|
324
318
|
return [2 /*return*/];
|
|
325
319
|
}
|
|
@@ -328,53 +322,49 @@ var generate = function (argv) { return __awaiter(void 0, void 0, void 0, functi
|
|
|
328
322
|
exports.generate = generate;
|
|
329
323
|
/**
|
|
330
324
|
* Watch files in source folder
|
|
331
|
-
* @param
|
|
325
|
+
* @param {CLIArguments} argv
|
|
332
326
|
*/
|
|
333
327
|
var watchFiles = function (argv) {
|
|
334
|
-
var _a = parseArguments(argv), exclude = _a.exclude, srcFolder = _a.srcFolder, codeFolder = _a.codeFolder, docsFolder = _a.docsFolder, title = _a.title;
|
|
328
|
+
var _a = parseArguments(argv), exclude = _a.exclude, include = _a.include, srcFolder = _a.srcFolder, codeFolder = _a.codeFolder, docsFolder = _a.docsFolder, title = _a.title;
|
|
335
329
|
if (argv.watch) {
|
|
336
330
|
console.log('\n---\n\n👀 watching files...');
|
|
337
|
-
var watcher = chokidar_1.default.watch([srcFolder, argv.readme, srcFolder
|
|
331
|
+
var watcher = chokidar_1.default.watch([srcFolder, argv.readme, "".concat(srcFolder, "/README.md")].filter(Boolean), {
|
|
338
332
|
ignored: /(^|[\/\\])\../,
|
|
339
333
|
persistent: true
|
|
340
334
|
});
|
|
341
335
|
watcher.on('change', function (path) { return __awaiter(void 0, void 0, void 0, function () {
|
|
342
|
-
var lsFolder, file
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
336
|
+
var lsFolder, file;
|
|
337
|
+
var _a;
|
|
338
|
+
return __generator(this, function (_b) {
|
|
339
|
+
switch (_b.label) {
|
|
340
|
+
case 0: return [4 /*yield*/, (0, list_folder_1.listFolder)(srcFolder, exclude, include)];
|
|
346
341
|
case 1:
|
|
347
|
-
lsFolder =
|
|
342
|
+
lsFolder = _b.sent();
|
|
348
343
|
file = lsFolder.paths.find(function (p) { return p.path === path; });
|
|
349
344
|
readline_1.default.clearLine(process.stdout, 0);
|
|
350
345
|
readline_1.default.cursorTo(process.stdout, 0);
|
|
351
|
-
if (!(path === 'README.md' || path === srcFolder
|
|
346
|
+
if (!(path === 'README.md' || path === "".concat(srcFolder, "/README.md"))) return [3 /*break*/, 3];
|
|
352
347
|
return [4 /*yield*/, createReadmeFile(argv)];
|
|
353
348
|
case 2:
|
|
354
|
-
|
|
355
|
-
|
|
349
|
+
_b.sent();
|
|
350
|
+
_b.label = 3;
|
|
356
351
|
case 3:
|
|
357
|
-
if (
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
})];
|
|
374
|
-
case 7:
|
|
375
|
-
_a.sent();
|
|
376
|
-
_a.label = 8;
|
|
377
|
-
case 8: return [2 /*return*/];
|
|
352
|
+
if (file) {
|
|
353
|
+
process.stdout.write(chalk_1.default.dim("update ".concat(file.name + file.ext)));
|
|
354
|
+
(_a = parseDirectoryFile(file, argv)) === null || _a === void 0 ? void 0 : _a.then(function (data) {
|
|
355
|
+
if (data) {
|
|
356
|
+
(0, parser_1.writeContentToFile)(data, data.relativePathDest);
|
|
357
|
+
}
|
|
358
|
+
createVuepressSidebar({
|
|
359
|
+
fileTree: lsFolder.tree,
|
|
360
|
+
srcFolder: srcFolder,
|
|
361
|
+
docsFolder: docsFolder,
|
|
362
|
+
codeFolder: codeFolder,
|
|
363
|
+
title: title
|
|
364
|
+
});
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
return [2 /*return*/];
|
|
378
368
|
}
|
|
379
369
|
});
|
|
380
370
|
}); });
|
|
@@ -382,8 +372,8 @@ var watchFiles = function (argv) {
|
|
|
382
372
|
};
|
|
383
373
|
/**
|
|
384
374
|
* The vuepress plugins
|
|
385
|
-
* @param
|
|
386
|
-
* @param
|
|
375
|
+
* @param {CLIArguments} argv
|
|
376
|
+
* @param {object} ctx
|
|
387
377
|
* @returns {object}
|
|
388
378
|
*/
|
|
389
379
|
var plugin = function (argv, ctx) { return ({
|
package/dist/interfaces.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DirectoryFile } from '../interfaces';
|
|
2
2
|
/**
|
|
3
3
|
* Search in file for @vuepress comment
|
|
4
|
-
* @param
|
|
4
|
+
* @param {string} fileContent content of given file
|
|
5
5
|
* @returns {object} object of found frontmatter data
|
|
6
6
|
*/
|
|
7
7
|
export declare const parseComment: (fileContent: string) => import("front-matter").FrontMatterResult<Record<string, string>> | {
|
|
@@ -10,8 +10,8 @@ export declare const parseComment: (fileContent: string) => import("front-matter
|
|
|
10
10
|
};
|
|
11
11
|
/**
|
|
12
12
|
* Helper function to get header as structured markdown
|
|
13
|
-
* @param
|
|
14
|
-
* @param
|
|
13
|
+
* @param {string} content file content
|
|
14
|
+
* @param {object} file file object
|
|
15
15
|
* @returns {string} markdown header
|
|
16
16
|
*/
|
|
17
17
|
export declare const parseVuepressFileHeader: (content: string, file: DirectoryFile) => string;
|
|
@@ -13,7 +13,7 @@ exports.parseVuepressFileHeader = exports.parseComment = void 0;
|
|
|
13
13
|
var front_matter_1 = __importDefault(require("front-matter"));
|
|
14
14
|
/**
|
|
15
15
|
* Search in file for @vuepress comment
|
|
16
|
-
* @param
|
|
16
|
+
* @param {string} fileContent content of given file
|
|
17
17
|
* @returns {object} object of found frontmatter data
|
|
18
18
|
*/
|
|
19
19
|
var parseComment = function (fileContent) {
|
|
@@ -46,17 +46,17 @@ var parseComment = function (fileContent) {
|
|
|
46
46
|
exports.parseComment = parseComment;
|
|
47
47
|
/**
|
|
48
48
|
* Helper function to get header as structured markdown
|
|
49
|
-
* @param
|
|
50
|
-
* @param
|
|
49
|
+
* @param {string} content file content
|
|
50
|
+
* @param {object} file file object
|
|
51
51
|
* @returns {string} markdown header
|
|
52
52
|
*/
|
|
53
53
|
var parseVuepressFileHeader = function (content, file) {
|
|
54
54
|
var _a = (0, exports.parseComment)(content), frontmatter = _a.frontmatter, attributes = _a.attributes;
|
|
55
55
|
var fileContent = '---\n';
|
|
56
|
-
fileContent += !(attributes === null || attributes === void 0 ? void 0 : attributes.title) ? "title: "
|
|
56
|
+
fileContent += !(attributes === null || attributes === void 0 ? void 0 : attributes.title) ? "title: ".concat(file.name) : '';
|
|
57
57
|
if (frontmatter) {
|
|
58
58
|
fileContent += !(attributes === null || attributes === void 0 ? void 0 : attributes.title) ? '\n' : '';
|
|
59
|
-
fileContent += ""
|
|
59
|
+
fileContent += "".concat(frontmatter);
|
|
60
60
|
}
|
|
61
61
|
fileContent += '\n---\n';
|
|
62
62
|
if ((attributes === null || attributes === void 0 ? void 0 : attributes.title) || file.ext !== '.vue') {
|
|
@@ -67,7 +67,7 @@ var parseVuepressFileHeader = function (content, file) {
|
|
|
67
67
|
else if (attributes === null || attributes === void 0 ? void 0 : attributes.title) {
|
|
68
68
|
headline = attributes.title;
|
|
69
69
|
}
|
|
70
|
-
fileContent += "\n# "
|
|
70
|
+
fileContent += "\n# ".concat(headline, "\n\n");
|
|
71
71
|
}
|
|
72
72
|
return fileContent;
|
|
73
73
|
};
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { DirectoryFile, FileTree } from '../interfaces';
|
|
2
2
|
/**
|
|
3
3
|
* Recursively traverse folders and return exluded files, a file list and a file tree.
|
|
4
|
-
* @param
|
|
5
|
-
* @param
|
|
6
|
-
* @param
|
|
7
|
-
* @param
|
|
4
|
+
* @param {string} srcPath path to source dir
|
|
5
|
+
* @param {array} exclude exluded file patter list
|
|
6
|
+
* @param {array} include included file patter list
|
|
7
|
+
* @param {string} mainPath path to hold source dir
|
|
8
|
+
* @param {object} tree tree array
|
|
8
9
|
* @returns {object} paths array, tree, excluded array
|
|
9
10
|
*/
|
|
10
|
-
export declare const listFolder: (srcPath: string, exclude
|
|
11
|
+
export declare const listFolder: (srcPath: string, exclude: string[], include: string[], mainPath?: string | undefined, tree?: FileTree[]) => Promise<{
|
|
11
12
|
paths: DirectoryFile[];
|
|
12
13
|
tree: FileTree[];
|
|
13
14
|
excluded: DirectoryFile[];
|
package/dist/lib/list-folder.js
CHANGED
|
@@ -98,35 +98,50 @@ var micromatch_1 = __importDefault(require("micromatch"));
|
|
|
98
98
|
var path_1 = __importDefault(require("path"));
|
|
99
99
|
/**
|
|
100
100
|
* Recursively traverse folders and return exluded files, a file list and a file tree.
|
|
101
|
-
* @param
|
|
102
|
-
* @param
|
|
103
|
-
* @param
|
|
104
|
-
* @param
|
|
101
|
+
* @param {string} srcPath path to source dir
|
|
102
|
+
* @param {array} exclude exluded file patter list
|
|
103
|
+
* @param {array} include included file patter list
|
|
104
|
+
* @param {string} mainPath path to hold source dir
|
|
105
|
+
* @param {object} tree tree array
|
|
105
106
|
* @returns {object} paths array, tree, excluded array
|
|
106
107
|
*/
|
|
107
|
-
var listFolder = function (srcPath, exclude, mainPath, tree) {
|
|
108
|
-
if (exclude === void 0) { exclude = []; }
|
|
108
|
+
var listFolder = function (srcPath, exclude, include, mainPath, tree) {
|
|
109
109
|
if (tree === void 0) { tree = []; }
|
|
110
110
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
111
|
-
var paths, excluded, dirs, dirs_1, dirs_1_1, dirent, filePath, isDir, ext, name_1, folder, file, baseSrc, treeEntry,
|
|
112
|
-
var e_1,
|
|
113
|
-
return __generator(this, function (
|
|
114
|
-
switch (
|
|
111
|
+
var paths, excluded, dirs, _a, dirs_1, dirs_1_1, dirent, filePath, isDir, ext, name_1, folder, file, baseSrc, treeEntry, _b, _c, _d, _e, e_1_1;
|
|
112
|
+
var e_1, _f;
|
|
113
|
+
return __generator(this, function (_g) {
|
|
114
|
+
switch (_g.label) {
|
|
115
115
|
case 0:
|
|
116
|
+
if (!Boolean(exclude) || !Array.isArray(exclude)) {
|
|
117
|
+
exclude = [];
|
|
118
|
+
}
|
|
119
|
+
if (!Boolean(include) || !Array.isArray(include)) {
|
|
120
|
+
include = [];
|
|
121
|
+
}
|
|
122
|
+
exclude = exclude.filter(Boolean);
|
|
123
|
+
include = include.filter(Boolean);
|
|
116
124
|
paths = [];
|
|
117
125
|
excluded = [];
|
|
126
|
+
if (!srcPath) return [3 /*break*/, 2];
|
|
118
127
|
return [4 /*yield*/, promises_1.default.readdir(srcPath, {
|
|
119
128
|
withFileTypes: true
|
|
120
129
|
})];
|
|
121
130
|
case 1:
|
|
122
|
-
|
|
123
|
-
|
|
131
|
+
_a = _g.sent();
|
|
132
|
+
return [3 /*break*/, 3];
|
|
124
133
|
case 2:
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
_f.label = 3;
|
|
134
|
+
_a = [];
|
|
135
|
+
_g.label = 3;
|
|
128
136
|
case 3:
|
|
129
|
-
|
|
137
|
+
dirs = _a;
|
|
138
|
+
_g.label = 4;
|
|
139
|
+
case 4:
|
|
140
|
+
_g.trys.push([4, 12, 13, 14]);
|
|
141
|
+
dirs_1 = __values(dirs), dirs_1_1 = dirs_1.next();
|
|
142
|
+
_g.label = 5;
|
|
143
|
+
case 5:
|
|
144
|
+
if (!!dirs_1_1.done) return [3 /*break*/, 11];
|
|
130
145
|
dirent = dirs_1_1.value;
|
|
131
146
|
filePath = path_1.default.join(srcPath, dirent.name);
|
|
132
147
|
isDir = dirent.isDirectory();
|
|
@@ -139,46 +154,47 @@ var listFolder = function (srcPath, exclude, mainPath, tree) {
|
|
|
139
154
|
file = __assign({ isDir: isDir, name: name_1, path: filePath }, (!isDir ? { ext: ext, folder: folder } : {}));
|
|
140
155
|
// skip readmes as they are automatically resolved
|
|
141
156
|
if (name_1.toLowerCase() === 'readme')
|
|
142
|
-
return [3 /*break*/,
|
|
157
|
+
return [3 /*break*/, 10];
|
|
143
158
|
baseSrc = mainPath || srcPath;
|
|
144
|
-
if (
|
|
159
|
+
if (!(micromatch_1.default.every(path_1.default.join(srcPath.replace(baseSrc, ''), dirent.name), __spreadArray(__spreadArray([], __read(include), false), __read(exclude.map(function (e) { return '!' + e; })), false)) ||
|
|
160
|
+
isDir)) return [3 /*break*/, 9];
|
|
145
161
|
treeEntry = {
|
|
146
162
|
name: name_1
|
|
147
163
|
};
|
|
148
|
-
if (!isDir) return [3 /*break*/,
|
|
164
|
+
if (!isDir) return [3 /*break*/, 7];
|
|
149
165
|
treeEntry.children = [];
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
return [4 /*yield*/, (0, exports.listFolder)(filePath, exclude, baseSrc, treeEntry.children)];
|
|
154
|
-
case 4:
|
|
155
|
-
_b.apply(_a, _c.concat([__spreadArray.apply(void 0, _d.concat([__read.apply(void 0, [(_f.sent()).paths]), false]))]));
|
|
156
|
-
return [3 /*break*/, 6];
|
|
157
|
-
case 5:
|
|
158
|
-
treeEntry = __assign(__assign({}, treeEntry), { path: "/" + name_1, fullPath: path_1.default.join(srcPath, name_1), ext: ext });
|
|
159
|
-
_f.label = 6;
|
|
166
|
+
_c = (_b = paths.push).apply;
|
|
167
|
+
_d = [paths];
|
|
168
|
+
_e = [[]];
|
|
169
|
+
return [4 /*yield*/, (0, exports.listFolder)(filePath, exclude, include, baseSrc, treeEntry.children)];
|
|
160
170
|
case 6:
|
|
161
|
-
|
|
162
|
-
paths.push(file);
|
|
171
|
+
_c.apply(_b, _d.concat([__spreadArray.apply(void 0, _e.concat([__read.apply(void 0, [(_g.sent()).paths]), false]))]));
|
|
163
172
|
return [3 /*break*/, 8];
|
|
164
173
|
case 7:
|
|
165
|
-
|
|
166
|
-
|
|
174
|
+
treeEntry = __assign(__assign({}, treeEntry), { path: "/".concat(name_1), fullPath: path_1.default.join(srcPath, name_1), ext: ext });
|
|
175
|
+
_g.label = 8;
|
|
167
176
|
case 8:
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
177
|
+
tree.push(treeEntry);
|
|
178
|
+
paths.push(file);
|
|
179
|
+
return [3 /*break*/, 10];
|
|
180
|
+
case 9:
|
|
181
|
+
excluded.push(file);
|
|
182
|
+
_g.label = 10;
|
|
171
183
|
case 10:
|
|
172
|
-
|
|
184
|
+
dirs_1_1 = dirs_1.next();
|
|
185
|
+
return [3 /*break*/, 5];
|
|
186
|
+
case 11: return [3 /*break*/, 14];
|
|
187
|
+
case 12:
|
|
188
|
+
e_1_1 = _g.sent();
|
|
173
189
|
e_1 = { error: e_1_1 };
|
|
174
|
-
return [3 /*break*/,
|
|
175
|
-
case
|
|
190
|
+
return [3 /*break*/, 14];
|
|
191
|
+
case 13:
|
|
176
192
|
try {
|
|
177
|
-
if (dirs_1_1 && !dirs_1_1.done && (
|
|
193
|
+
if (dirs_1_1 && !dirs_1_1.done && (_f = dirs_1.return)) _f.call(dirs_1);
|
|
178
194
|
}
|
|
179
195
|
finally { if (e_1) throw e_1.error; }
|
|
180
196
|
return [7 /*endfinally*/];
|
|
181
|
-
case
|
|
197
|
+
case 14: return [2 /*return*/, { paths: paths, tree: tree, excluded: excluded }];
|
|
182
198
|
}
|
|
183
199
|
});
|
|
184
200
|
});
|
package/dist/lib/parser.d.ts
CHANGED
|
@@ -12,16 +12,16 @@ import { DirectoryFile, ParseReturn } from '../interfaces';
|
|
|
12
12
|
export declare const parseFile: (file: DirectoryFile, srcFolder: string, destFolder: string, configPath: string, partials: string | string[]) => Promise<ParseReturn | null>;
|
|
13
13
|
/**
|
|
14
14
|
* Parse a vue file
|
|
15
|
-
* @param
|
|
16
|
-
* @param
|
|
17
|
-
* @param
|
|
15
|
+
* @param {DirectoryFile} file
|
|
16
|
+
* @param {string} srcFolder
|
|
17
|
+
* @param {string} destFolder
|
|
18
18
|
* @returns {object} file data
|
|
19
19
|
*/
|
|
20
20
|
export declare const parseVueFile: (file: DirectoryFile, srcFolder: string, destFolder: string) => Promise<ParseReturn | null>;
|
|
21
21
|
/**
|
|
22
22
|
* Write content on disk
|
|
23
|
-
* @param
|
|
24
|
-
* @param
|
|
23
|
+
* @param {ParseReturn | null} parseData
|
|
24
|
+
* @param {string} dest
|
|
25
25
|
* @returns {Promise | null} null or type with some data of the saved file
|
|
26
26
|
*/
|
|
27
27
|
export declare const writeContentToFile: (parseData: ParseReturn | null, dest: string) => Promise<{
|
package/dist/lib/parser.js
CHANGED
|
@@ -123,6 +123,7 @@ var parseFile = function (file, srcFolder, destFolder, configPath, partials) { r
|
|
|
123
123
|
fileName = 'index';
|
|
124
124
|
}
|
|
125
125
|
return [4 /*yield*/, jsdoc_to_markdown_1.default.render({
|
|
126
|
+
'no-cache': configPath ? true : false,
|
|
126
127
|
files: [(0, path_1.join)(process.cwd(), file.folder, fileName + file.ext)],
|
|
127
128
|
configure: configPath,
|
|
128
129
|
partial: __spreadArray([
|
|
@@ -133,7 +134,7 @@ var parseFile = function (file, srcFolder, destFolder, configPath, partials) { r
|
|
|
133
134
|
case 2:
|
|
134
135
|
content = _b.sent();
|
|
135
136
|
_a = comment_parser_1.parseVuepressFileHeader;
|
|
136
|
-
return [4 /*yield*/, promises_1.default.readFile(""
|
|
137
|
+
return [4 /*yield*/, promises_1.default.readFile("".concat((0, path_1.join)(folderInSrc, fileName + file.ext)), 'utf-8')];
|
|
137
138
|
case 3:
|
|
138
139
|
fileContent = _a.apply(void 0, [_b.sent(), file]);
|
|
139
140
|
if (content) {
|
|
@@ -164,9 +165,9 @@ var parseFile = function (file, srcFolder, destFolder, configPath, partials) { r
|
|
|
164
165
|
exports.parseFile = parseFile;
|
|
165
166
|
/**
|
|
166
167
|
* Parse a vue file
|
|
167
|
-
* @param
|
|
168
|
-
* @param
|
|
169
|
-
* @param
|
|
168
|
+
* @param {DirectoryFile} file
|
|
169
|
+
* @param {string} srcFolder
|
|
170
|
+
* @param {string} destFolder
|
|
170
171
|
* @returns {object} file data
|
|
171
172
|
*/
|
|
172
173
|
var parseVueFile = function (file, srcFolder, destFolder) { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -195,7 +196,7 @@ var parseVueFile = function (file, srcFolder, destFolder) { return __awaiter(voi
|
|
|
195
196
|
case 2:
|
|
196
197
|
data = _b.sent();
|
|
197
198
|
_a = comment_parser_1.parseVuepressFileHeader;
|
|
198
|
-
return [4 /*yield*/, promises_1.default.readFile(""
|
|
199
|
+
return [4 /*yield*/, promises_1.default.readFile("".concat((0, path_1.join)(folderInSrc, fileName + file.ext)), 'utf-8')];
|
|
199
200
|
case 3:
|
|
200
201
|
fileContent = _a.apply(void 0, [_b.sent(), file]);
|
|
201
202
|
if (data.content) {
|
|
@@ -225,8 +226,8 @@ var parseVueFile = function (file, srcFolder, destFolder) { return __awaiter(voi
|
|
|
225
226
|
exports.parseVueFile = parseVueFile;
|
|
226
227
|
/**
|
|
227
228
|
* Write content on disk
|
|
228
|
-
* @param
|
|
229
|
-
* @param
|
|
229
|
+
* @param {ParseReturn | null} parseData
|
|
230
|
+
* @param {string} dest
|
|
230
231
|
* @returns {Promise | null} null or type with some data of the saved file
|
|
231
232
|
*/
|
|
232
233
|
var writeContentToFile = function (parseData, dest) { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -244,7 +245,7 @@ var writeContentToFile = function (parseData, dest) { return __awaiter(void 0, v
|
|
|
244
245
|
case 1:
|
|
245
246
|
_b.trys.push([1, 5, , 6]);
|
|
246
247
|
if (!(parseData === null || parseData === void 0 ? void 0 : parseData.content)) return [3 /*break*/, 4];
|
|
247
|
-
path = (0, path_1.join)(dest, parseData.file.name)
|
|
248
|
+
path = "".concat((0, path_1.join)(dest, parseData.file.name), ".md");
|
|
248
249
|
return [4 /*yield*/, (0, mkdirp_1.default)(dest)];
|
|
249
250
|
case 2:
|
|
250
251
|
_b.sent();
|
package/dist/lib/utils.d.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Get extension of file
|
|
3
|
-
* @param
|
|
3
|
+
* @param {string} path
|
|
4
4
|
* @returns {string} extension of file
|
|
5
5
|
*/
|
|
6
6
|
export declare const getExtension: (path: string) => string;
|
|
7
7
|
/**
|
|
8
8
|
* Check if extension ist correct
|
|
9
|
-
* @param
|
|
10
|
-
* @param
|
|
9
|
+
* @param {string} path
|
|
10
|
+
* @param {string[]} extensions
|
|
11
11
|
* @returns {boolean}
|
|
12
12
|
*/
|
|
13
13
|
export declare const checkExtension: (path: string, extensions: string[]) => boolean;
|
|
14
14
|
/**
|
|
15
15
|
* Get filename without extension
|
|
16
|
-
* @param
|
|
16
|
+
* @param {string} path
|
|
17
17
|
* @returns {string} filename
|
|
18
18
|
*/
|
|
19
19
|
export declare const getFilename: (path: string) => string;
|
package/dist/lib/utils.js
CHANGED
|
@@ -9,26 +9,35 @@ exports.getFilename = exports.checkExtension = exports.getExtension = void 0;
|
|
|
9
9
|
*/
|
|
10
10
|
/**
|
|
11
11
|
* Get extension of file
|
|
12
|
-
* @param
|
|
12
|
+
* @param {string} path
|
|
13
13
|
* @returns {string} extension of file
|
|
14
14
|
*/
|
|
15
|
-
var getExtension = function (path) {
|
|
15
|
+
var getExtension = function (path) {
|
|
16
|
+
return path && typeof path === 'string' ? path.substring(path.length, path.lastIndexOf('.')) : '';
|
|
17
|
+
};
|
|
16
18
|
exports.getExtension = getExtension;
|
|
17
19
|
/**
|
|
18
20
|
* Check if extension ist correct
|
|
19
|
-
* @param
|
|
20
|
-
* @param
|
|
21
|
+
* @param {string} path
|
|
22
|
+
* @param {string[]} extensions
|
|
21
23
|
* @returns {boolean}
|
|
22
24
|
*/
|
|
23
|
-
var checkExtension = function (path, extensions) {
|
|
25
|
+
var checkExtension = function (path, extensions) {
|
|
26
|
+
if (!extensions || !path || typeof path !== 'string')
|
|
27
|
+
return false;
|
|
28
|
+
return extensions.indexOf((0, exports.getExtension)(path)) >= 0;
|
|
29
|
+
};
|
|
24
30
|
exports.checkExtension = checkExtension;
|
|
25
31
|
/**
|
|
26
32
|
* Get filename without extension
|
|
27
|
-
* @param
|
|
33
|
+
* @param {string} path
|
|
28
34
|
* @returns {string} filename
|
|
29
35
|
*/
|
|
30
36
|
var getFilename = function (path) {
|
|
31
|
-
var _a
|
|
32
|
-
|
|
37
|
+
var _a;
|
|
38
|
+
if (!path || (path && typeof path !== 'string'))
|
|
39
|
+
return '';
|
|
40
|
+
var splitted = (_a = path.split('/').pop()) !== null && _a !== void 0 ? _a : path;
|
|
41
|
+
return splitted.substring(0, splitted.lastIndexOf('.'));
|
|
33
42
|
};
|
|
34
43
|
exports.getFilename = getFilename;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Runs through the given tree structure and creates a vuepress config
|
|
3
|
-
* @param data Informations to build config
|
|
4
|
-
* @param data.fileTree
|
|
5
|
-
* @param data.codeFolder
|
|
6
|
-
* @param data.srcFolder
|
|
7
|
-
* @param data.docsFolder
|
|
8
|
-
* @param
|
|
3
|
+
* @param {object} data Informations to build config
|
|
4
|
+
* @param {array} data.fileTree tree strcture
|
|
5
|
+
* @param {string} data.codeFolder ./code/ folder
|
|
6
|
+
* @param {string} data.srcFolder ./src/ folder
|
|
7
|
+
* @param {string} data.docsFolder ./documentation/ folder
|
|
8
|
+
* @param {string} data.title title string
|
|
9
9
|
* @returns {object} returns the vuepress menu strcture
|
|
10
10
|
*/
|
|
11
11
|
export declare const generateVueSidebar: ({ fileTree, codeFolder, srcFolder, docsFolder, title }: {
|
package/dist/lib/vue-sidebar.js
CHANGED
|
@@ -25,12 +25,12 @@ var fs_1 = __importDefault(require("fs"));
|
|
|
25
25
|
var path_1 = require("path");
|
|
26
26
|
/**
|
|
27
27
|
* Runs through the given tree structure and creates a vuepress config
|
|
28
|
-
* @param data Informations to build config
|
|
29
|
-
* @param data.fileTree
|
|
30
|
-
* @param data.codeFolder
|
|
31
|
-
* @param data.srcFolder
|
|
32
|
-
* @param data.docsFolder
|
|
33
|
-
* @param
|
|
28
|
+
* @param {object} data Informations to build config
|
|
29
|
+
* @param {array} data.fileTree tree strcture
|
|
30
|
+
* @param {string} data.codeFolder ./code/ folder
|
|
31
|
+
* @param {string} data.srcFolder ./src/ folder
|
|
32
|
+
* @param {string} data.docsFolder ./documentation/ folder
|
|
33
|
+
* @param {string} data.title title string
|
|
34
34
|
* @returns {object} returns the vuepress menu strcture
|
|
35
35
|
*/
|
|
36
36
|
var generateVueSidebar = function (_a) {
|
|
@@ -50,7 +50,7 @@ var generateVueSidebar = function (_a) {
|
|
|
50
50
|
}
|
|
51
51
|
else if (child.fullPath) {
|
|
52
52
|
if (fs_1.default.existsSync((0, path_1.join)(docsFolder, child.fullPath.replace(srcFolder, '')) + '.md')) {
|
|
53
|
-
newChildren.push(child.fullPath.replace(srcFolder
|
|
53
|
+
newChildren.push(child.fullPath.replace("".concat(srcFolder, "/"), ''));
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
}
|
|
@@ -70,7 +70,7 @@ var generateVueSidebar = function (_a) {
|
|
|
70
70
|
children: buildChildren(folder.children, folder.name, 0)
|
|
71
71
|
}); });
|
|
72
72
|
return _b = {},
|
|
73
|
-
_b["/"
|
|
73
|
+
_b["/".concat(codeFolder, "/")] = [
|
|
74
74
|
{
|
|
75
75
|
title: title,
|
|
76
76
|
collapsable: false,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vuepress-jsdoc",
|
|
3
|
-
"version": "4.0
|
|
3
|
+
"version": "4.3.0",
|
|
4
4
|
"description": "Generate jsdoc markdown files for vuepress",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
"prepublishOnly": "npm i && npm run build",
|
|
14
14
|
"prepare": "husky install",
|
|
15
15
|
"version": "conventional-changelog -p karma -i CHANGELOG.md -s -r 0 && git add .",
|
|
16
|
-
"docs": "
|
|
17
|
-
"docs:dev": "npm run docs && npx vuepress dev documentation",
|
|
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
18
|
"docs:build": "npm run build && npm run docs && npx vuepress build documentation"
|
|
19
19
|
},
|
|
20
20
|
"keywords": [
|
|
@@ -80,35 +80,35 @@
|
|
|
80
80
|
},
|
|
81
81
|
"dependencies": {
|
|
82
82
|
"chalk": "^4.1.2",
|
|
83
|
-
"chokidar": "^3.5.
|
|
84
|
-
"commander": "^
|
|
83
|
+
"chokidar": "^3.5.3",
|
|
84
|
+
"commander": "^9.0.0",
|
|
85
85
|
"del": "^6.0.0",
|
|
86
86
|
"front-matter": "^4.0.2",
|
|
87
|
-
"jsdoc-to-markdown": "^7.
|
|
87
|
+
"jsdoc-to-markdown": "^7.1.1",
|
|
88
88
|
"micromatch": "^4.0.4",
|
|
89
89
|
"mkdirp": "^1.0.4",
|
|
90
|
-
"vue-docgen-cli": "^4.
|
|
90
|
+
"vue-docgen-cli": "^4.44.15"
|
|
91
91
|
},
|
|
92
92
|
"devDependencies": {
|
|
93
|
-
"@types/jest": "^27.0
|
|
94
|
-
"@types/jsdoc-to-markdown": "^7.0.
|
|
93
|
+
"@types/jest": "^27.4.0",
|
|
94
|
+
"@types/jsdoc-to-markdown": "^7.0.3",
|
|
95
95
|
"@types/micromatch": "^4.0.2",
|
|
96
96
|
"@types/mkdirp": "^1.0.2",
|
|
97
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
98
|
-
"@typescript-eslint/parser": "^
|
|
99
|
-
"babel-jest": "^27.1
|
|
97
|
+
"@typescript-eslint/eslint-plugin": "^5.12.0",
|
|
98
|
+
"@typescript-eslint/parser": "^5.12.0",
|
|
99
|
+
"babel-jest": "^27.5.1",
|
|
100
100
|
"cross-env": "^7.0.3",
|
|
101
|
-
"eslint": "^
|
|
101
|
+
"eslint": "^8.9.0",
|
|
102
102
|
"eslint-config-prettier": "^8.3.0",
|
|
103
|
-
"eslint-plugin-import": "^2.
|
|
104
|
-
"eslint-plugin-jest": "^
|
|
103
|
+
"eslint-plugin-import": "^2.25.4",
|
|
104
|
+
"eslint-plugin-jest": "^26.1.1",
|
|
105
105
|
"eslint-plugin-prefer-arrow": "^1.2.3",
|
|
106
|
-
"husky": "^7.0.
|
|
107
|
-
"jest": "^27.1
|
|
108
|
-
"lint-staged": "^
|
|
109
|
-
"memfs": "^3.
|
|
110
|
-
"ts-jest": "^27.
|
|
111
|
-
"typescript": "^4.
|
|
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"
|
|
112
112
|
},
|
|
113
113
|
"lint-staged": {
|
|
114
114
|
"src/**/*.{css,scss,json}": [
|