honkit 3.7.3 → 4.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.
package/README.md CHANGED
@@ -8,3 +8,8 @@ HonKit documentation is built by HonKit!
8
8
 
9
9
  - <https://honkit.netlify.app/>
10
10
 
11
+ ## License
12
+
13
+ Apache License
14
+
15
+ HonKit includes GitBook v1 source code.
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const bin_1 = require("../bin");
7
+ const path_1 = __importDefault(require("path"));
8
+ const jest_mock_process_1 = require("jest-mock-process");
9
+ const jest_serializer_strip_ansi_1 = require("@relmify/jest-serializer-strip-ansi");
10
+ const CWD = process.cwd();
11
+ const cwdPlugin = {
12
+ test: (value) => typeof value === "string" && value.includes(CWD),
13
+ print: (value, serialize) => {
14
+ if (typeof value === "string") {
15
+ return serialize(value.split(CWD).join("<CWD>").replace(/\\/g, '/'));
16
+ }
17
+ return value;
18
+ },
19
+ };
20
+ expect.addSnapshotSerializer(jest_serializer_strip_ansi_1.stripAnsi);
21
+ expect.addSnapshotSerializer(cwdPlugin);
22
+ describe("e2e", function () {
23
+ let stdoutMock;
24
+ beforeEach(() => {
25
+ stdoutMock = (0, jest_mock_process_1.mockProcessStdout)();
26
+ });
27
+ afterEach(() => {
28
+ stdoutMock.mockRestore();
29
+ });
30
+ it("`honkit parse` for multilang", async () => {
31
+ await (0, bin_1.run)([process.argv[0], "honkit", "parse", path_1.default.join(__dirname, "__fixtures__/multilang")]);
32
+ expect(stdoutMock.mock.calls).toMatchInlineSnapshot(`
33
+ Array [
34
+ Array [
35
+ "info: parsing multilingual book, with 2 languages
36
+ ",
37
+ ],
38
+ Array [
39
+ "warn: no summary file in this book
40
+ ",
41
+ ],
42
+ Array [
43
+ "warn: no summary file in this book
44
+ ",
45
+ ],
46
+ Array [
47
+ "info: Book located in: <CWD>/src/__tests__/__fixtures__/multilang
48
+ ",
49
+ ],
50
+ Array [
51
+ "info: 2 languages
52
+ ",
53
+ ],
54
+ Array [
55
+ "info: Language: English
56
+ ",
57
+ ],
58
+ Array [
59
+ "info: Introduction file is README.md
60
+ ",
61
+ ],
62
+ Array [
63
+ "info:
64
+ ",
65
+ ],
66
+ Array [
67
+ "info: Language: Japanese
68
+ ",
69
+ ],
70
+ Array [
71
+ "info: Introduction file is README.md
72
+ ",
73
+ ],
74
+ Array [
75
+ "info:
76
+ ",
77
+ ],
78
+ ]
79
+ `);
80
+ });
81
+ });
File without changes
package/lib/cli/parse.js CHANGED
@@ -34,7 +34,9 @@ function printMultingualBook(book) {
34
34
  const languages = book.getLanguages();
35
35
  const books = book.getBooks();
36
36
  logger.info.ln(`${languages.size} languages`);
37
- languages.forEach((lang) => {
37
+ const file = languages.getFile();
38
+ const list = languages.getList();
39
+ list.valueSeq().forEach((lang) => {
38
40
  logger.info.ln("Language:", lang.getTitle());
39
41
  printBook(books.get(lang.getID()));
40
42
  logger.info.ln("");
package/lib/cli/watch.js CHANGED
@@ -22,7 +22,9 @@ function watch(dir, callback) {
22
22
  });
23
23
  const watcher = chokidar_1.default.watch(toWatch, {
24
24
  cwd: dir,
25
- ignored: "_book/**",
25
+ // prevent infinity loop
26
+ // https://github.com/honkit/honkit/issues/269
27
+ ignored: ["_book/**", "node_modules/**"],
26
28
  ignoreInitial: true,
27
29
  });
28
30
  watcher.on("all", (e, filepath) => {
@@ -8,6 +8,7 @@ const generateMock_1 = __importDefault(require("../testing/generateMock"));
8
8
  const website_1 = __importDefault(require("../website"));
9
9
  const longTest = (name, fn) => test(name, fn, 1000 * 30);
10
10
  describe("WebsiteGenerator", () => {
11
+ jest.setTimeout(60 * 1000);
11
12
  test("should generate an index.html", async () => {
12
13
  const folder = await (0, generateMock_1.default)(website_1.default, {
13
14
  "README.md": "Hello World"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "honkit",
3
- "version": "3.7.3",
3
+ "version": "4.0.0",
4
4
  "description": "HonKit is building beautiful books using Markdown.",
5
5
  "keywords": [
6
6
  "git",
@@ -19,16 +19,6 @@
19
19
  },
20
20
  "license": "Apache-2.0",
21
21
  "author": "azu <azuciao@gmail.com>",
22
- "contributors": [
23
- {
24
- "name": "Aaron O'Mullan",
25
- "email": "aaron@gitbook.com"
26
- },
27
- {
28
- "name": "Samy Pessé",
29
- "email": "samy@gitbook.com"
30
- }
31
- ],
32
22
  "main": "lib/index.js",
33
23
  "browser": "./lib/browser.js",
34
24
  "bin": {
@@ -47,10 +37,10 @@
47
37
  "updateSnapshot": "jest src -u"
48
38
  },
49
39
  "dependencies": {
50
- "@honkit/asciidoc": "^3.6.17",
51
- "@honkit/honkit-plugin-highlight": "^3.6.19",
52
- "@honkit/honkit-plugin-theme-default": "^3.7.3",
53
- "@honkit/markdown-legacy": "^3.6.17",
40
+ "@honkit/asciidoc": "^4.0.0",
41
+ "@honkit/honkit-plugin-highlight": "^4.0.0",
42
+ "@honkit/honkit-plugin-theme-default": "^4.0.0",
43
+ "@honkit/markdown-legacy": "^4.0.0",
54
44
  "bash-color": "^0.0.4",
55
45
  "cheerio": "^0.20.0",
56
46
  "chokidar": "^3.3.0",
@@ -72,7 +62,6 @@
72
62
  "gitbook-plugin-lunr": "^1.2.0",
73
63
  "gitbook-plugin-search": "^2.2.1",
74
64
  "github-slugid": "^1.0.1",
75
- "global-npm": "^0.4.0",
76
65
  "i18n-t": "^1.0.1",
77
66
  "ignore": "^5.1.8",
78
67
  "immutable": "^3.8.1",
@@ -80,7 +69,7 @@
80
69
  "js-yaml": "^3.6.1",
81
70
  "json-schema-defaults": "^0.1.1",
82
71
  "jsonschema": "1.1.0",
83
- "juice": "^6.0.0",
72
+ "juice": "^8.0.0",
84
73
  "lru_map": "^0.4.1",
85
74
  "memoize-one": "^5.1.1",
86
75
  "mkdirp": "^1.0.4",
@@ -102,12 +91,14 @@
102
91
  "urijs": "^1.19.6"
103
92
  },
104
93
  "devDependencies": {
105
- "@honkit/internal-test-utils": "^3.6.17",
94
+ "@honkit/internal-test-utils": "^4.0.0",
95
+ "@relmify/jest-serializer-strip-ansi": "^1.0.2",
106
96
  "@types/nunjucks": "^3.1.3",
107
97
  "cross-env": "^7.0.3",
108
98
  "jest": "^26.6.3",
99
+ "jest-mock-process": "^1.5.1",
109
100
  "rimraf": "^3.0.2",
110
101
  "typescript": "^4.1.3"
111
102
  },
112
- "gitHead": "e4ef948e6ae302b4500af718d9040b99d162bfa6"
103
+ "gitHead": "32e906fc392accc23940e99e284efea005398544"
113
104
  }