honkit 3.7.2 → 3.7.5

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.
@@ -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) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "honkit",
3
- "version": "3.7.2",
3
+ "version": "3.7.5",
4
4
  "description": "HonKit is building beautiful books using Markdown.",
5
5
  "keywords": [
6
6
  "git",
@@ -49,7 +49,7 @@
49
49
  "dependencies": {
50
50
  "@honkit/asciidoc": "^3.6.17",
51
51
  "@honkit/honkit-plugin-highlight": "^3.6.19",
52
- "@honkit/honkit-plugin-theme-default": "^3.6.20",
52
+ "@honkit/honkit-plugin-theme-default": "^3.7.3",
53
53
  "@honkit/markdown-legacy": "^3.6.17",
54
54
  "bash-color": "^0.0.4",
55
55
  "cheerio": "^0.20.0",
@@ -103,11 +103,13 @@
103
103
  },
104
104
  "devDependencies": {
105
105
  "@honkit/internal-test-utils": "^3.6.17",
106
+ "@relmify/jest-serializer-strip-ansi": "^1.0.2",
106
107
  "@types/nunjucks": "^3.1.3",
107
108
  "cross-env": "^7.0.3",
108
109
  "jest": "^26.6.3",
110
+ "jest-mock-process": "^1.5.1",
109
111
  "rimraf": "^3.0.2",
110
112
  "typescript": "^4.1.3"
111
113
  },
112
- "gitHead": "89e4ff9d86596d7c650c5e83e2d768435d6eef20"
114
+ "gitHead": "70c74fc5be1dc12e88d138f37708dabac212d4d6"
113
115
  }