docula 0.12.2 → 0.13.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/README.md +5 -0
- package/dist/docula.js +31 -14
- package/package.json +15 -10
package/README.md
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
- [Getting Started](#getting-started)
|
|
14
14
|
- [Using Your own Template](#using-your-own-template)
|
|
15
15
|
- [Building Multiple Pages](#building-multiple-pages)
|
|
16
|
+
- [Using a Github Token](#using-a-github-token)
|
|
16
17
|
- [Helper Functions for Markdown](#helper-functions-for-markdown)
|
|
17
18
|
- [Code of Conduct and Contributing](#code-of-conduct-and-contributing)
|
|
18
19
|
- [License - MIT](#license)
|
|
@@ -86,6 +87,10 @@ title: Getting Started
|
|
|
86
87
|
order: 2
|
|
87
88
|
```
|
|
88
89
|
|
|
90
|
+
# Using a Github Token
|
|
91
|
+
|
|
92
|
+
If you want to use the Github token to access the Github API you can do so by setting the `GITHUB_TOKEN` environment variable. This is useful if you want to access private repositories or if you want to access the Github API without hitting the rate limit. This is optional and you can still use docula without it but could hit rate limits and will not be able to access private repositories.
|
|
93
|
+
|
|
89
94
|
# Helper Functions for Markdown
|
|
90
95
|
|
|
91
96
|
docula comes with some helper functions that you can use in your markdown files.
|
package/dist/docula.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// src/docula.ts
|
|
2
2
|
import http from "http";
|
|
3
3
|
import path3 from "path";
|
|
4
|
-
import
|
|
4
|
+
import process4 from "process";
|
|
5
5
|
import fs3 from "fs";
|
|
6
6
|
import handler from "serve-handler";
|
|
7
7
|
import updateNotifier from "update-notifier";
|
|
@@ -219,6 +219,7 @@ import he from "he";
|
|
|
219
219
|
import * as cheerio from "cheerio";
|
|
220
220
|
|
|
221
221
|
// src/github.ts
|
|
222
|
+
import process3 from "process";
|
|
222
223
|
import axios from "axios";
|
|
223
224
|
var Github = class {
|
|
224
225
|
options = {
|
|
@@ -240,8 +241,19 @@ var Github = class {
|
|
|
240
241
|
}
|
|
241
242
|
async getReleases() {
|
|
242
243
|
const url = `${this.options.api}/repos/${this.options.author}/${this.options.repo}/releases`;
|
|
244
|
+
let config2 = {};
|
|
245
|
+
if (process3.env.GITHUB_TOKEN) {
|
|
246
|
+
config2 = {
|
|
247
|
+
headers: {
|
|
248
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
249
|
+
Authorization: `Bearer ${process3.env.GITHUB_TOKEN}`,
|
|
250
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
251
|
+
Accept: "application/vnd.github.v3+json"
|
|
252
|
+
}
|
|
253
|
+
};
|
|
254
|
+
}
|
|
243
255
|
try {
|
|
244
|
-
const result = await axios.get(url);
|
|
256
|
+
const result = await axios.get(url, config2);
|
|
245
257
|
if (result && result.data.length > 0) {
|
|
246
258
|
return this.addAnchorLink(result.data);
|
|
247
259
|
}
|
|
@@ -256,8 +268,19 @@ var Github = class {
|
|
|
256
268
|
}
|
|
257
269
|
async getContributors() {
|
|
258
270
|
const url = `${this.options.api}/repos/${this.options.author}/${this.options.repo}/contributors`;
|
|
271
|
+
let config2 = {};
|
|
272
|
+
if (process3.env.GITHUB_TOKEN) {
|
|
273
|
+
config2 = {
|
|
274
|
+
headers: {
|
|
275
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
276
|
+
Authorization: `Bearer ${process3.env.GITHUB_TOKEN}`,
|
|
277
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
278
|
+
Accept: "application/vnd.github.v3+json"
|
|
279
|
+
}
|
|
280
|
+
};
|
|
281
|
+
}
|
|
259
282
|
try {
|
|
260
|
-
const result = await axios.get(url);
|
|
283
|
+
const result = await axios.get(url, config2);
|
|
261
284
|
if (result && result.data.length > 0) {
|
|
262
285
|
return result.data;
|
|
263
286
|
}
|
|
@@ -632,17 +655,11 @@ var DoculaBuilder = class {
|
|
|
632
655
|
}
|
|
633
656
|
}
|
|
634
657
|
return {
|
|
635
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
636
658
|
title: matterData.title,
|
|
637
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
638
659
|
navTitle: matterData.navTitle ?? matterData.title,
|
|
639
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
640
660
|
description: matterData.description ?? "",
|
|
641
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
642
661
|
order: matterData.order ?? void 0,
|
|
643
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
644
662
|
section: matterData.section ?? void 0,
|
|
645
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
646
663
|
keywords: matterData.keywords ?? [],
|
|
647
664
|
content: documentContent,
|
|
648
665
|
markdown: markdownContent,
|
|
@@ -779,7 +796,7 @@ var Docula = class {
|
|
|
779
796
|
* @returns {void}
|
|
780
797
|
*/
|
|
781
798
|
checkForUpdates() {
|
|
782
|
-
const packageJsonPath = path3.join(
|
|
799
|
+
const packageJsonPath = path3.join(process4.cwd(), "package.json");
|
|
783
800
|
if (fs3.existsSync(packageJsonPath)) {
|
|
784
801
|
const packageJson = JSON.parse(fs3.readFileSync(packageJsonPath, "utf8"));
|
|
785
802
|
updateNotifier({ pkg: packageJson }).notify();
|
|
@@ -790,9 +807,9 @@ var Docula = class {
|
|
|
790
807
|
* @param {NodeJS.Process} process
|
|
791
808
|
* @returns {Promise<void>}
|
|
792
809
|
*/
|
|
793
|
-
async execute(
|
|
810
|
+
async execute(process5) {
|
|
794
811
|
this.checkForUpdates();
|
|
795
|
-
const consoleProcess = this._console.parseProcessArgv(
|
|
812
|
+
const consoleProcess = this._console.parseProcessArgv(process5.argv);
|
|
796
813
|
this.options.singlePage = this.isSinglePageWebsite(this.options.sitePath);
|
|
797
814
|
if (consoleProcess.args.sitePath) {
|
|
798
815
|
this.options.sitePath = consoleProcess.args.sitePath;
|
|
@@ -903,12 +920,12 @@ var Docula = class {
|
|
|
903
920
|
}
|
|
904
921
|
const { port } = options;
|
|
905
922
|
const { outputPath } = options;
|
|
906
|
-
const
|
|
923
|
+
const config2 = {
|
|
907
924
|
public: outputPath
|
|
908
925
|
};
|
|
909
926
|
this._server = http.createServer(async (request, response) => (
|
|
910
927
|
/* c8 ignore next */
|
|
911
|
-
handler(request, response,
|
|
928
|
+
handler(request, response, config2)
|
|
912
929
|
));
|
|
913
930
|
this._server.listen(port, () => {
|
|
914
931
|
this._console.log(`Docula \u{1F987} at http://localhost:${port}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "docula",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "Beautiful Website for Your Projects",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/docula.js",
|
|
@@ -47,9 +47,9 @@
|
|
|
47
47
|
"docula": "./bin/docula.mjs"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"axios": "^1.
|
|
51
|
-
"cheerio": "^1.
|
|
52
|
-
"ecto": "^4.
|
|
50
|
+
"axios": "^1.10.0",
|
|
51
|
+
"cheerio": "^1.1.0",
|
|
52
|
+
"ecto": "^4.3.0",
|
|
53
53
|
"feed": "^5.1.0",
|
|
54
54
|
"he": "^1.2.0",
|
|
55
55
|
"serve-handler": "^6.1.6",
|
|
@@ -57,22 +57,27 @@
|
|
|
57
57
|
"writr": "^4.4.4"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
|
-
"@types/express": "^5.0.
|
|
60
|
+
"@types/express": "^5.0.3",
|
|
61
61
|
"@types/he": "^1.2.3",
|
|
62
62
|
"@types/js-yaml": "^4.0.9",
|
|
63
|
-
"@types/node": "^
|
|
63
|
+
"@types/node": "^24.0.3",
|
|
64
64
|
"@types/serve-handler": "^6.1.4",
|
|
65
65
|
"@types/update-notifier": "^6.0.8",
|
|
66
|
-
"@vitest/coverage-v8": "^3.
|
|
66
|
+
"@vitest/coverage-v8": "^3.2.4",
|
|
67
|
+
"dotenv": "^16.5.0",
|
|
67
68
|
"rimraf": "^6.0.1",
|
|
68
69
|
"tsup": "^8.5.0",
|
|
69
|
-
"tsx": "^4.
|
|
70
|
+
"tsx": "^4.20.3",
|
|
70
71
|
"typescript": "^5.8.3",
|
|
71
|
-
"vitest": "^3.
|
|
72
|
+
"vitest": "^3.2.4",
|
|
72
73
|
"webpack": "^5.99.9",
|
|
73
|
-
"xo": "^1.
|
|
74
|
+
"xo": "^1.1.0"
|
|
74
75
|
},
|
|
75
76
|
"xo": {
|
|
77
|
+
"rules": {
|
|
78
|
+
"@typescript-eslint/no-unsafe-call": "off",
|
|
79
|
+
"@typescript-eslint/no-unsafe-assignment": "off"
|
|
80
|
+
},
|
|
76
81
|
"ignores": [
|
|
77
82
|
"docula.config.*",
|
|
78
83
|
"vitest.config.*",
|