highmark-cli 1.1.19 → 1.2.1

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
@@ -59,6 +59,10 @@ Commands:
59
59
 
60
60
  version Show the version
61
61
 
62
+ server Run a server to view the output file
63
+
64
+ initialise Create a configuration file
65
+
62
66
  [publish] Publish the input Markdown file to the output HTML file
63
67
 
64
68
  Options:
@@ -71,17 +75,17 @@ Options:
71
75
 
72
76
  --watch|-w Watch for changes to the client file and in the output directory
73
77
 
74
- --quietly|-q Run with almost no console logging
78
+ --server|-s Run a server to view the output file
75
79
 
76
- --copy-fonts|-f Copy the fonts to a fonts folder next to the output file
80
+ --quietly|-q Run with almost no console logging
77
81
 
78
- --start-server|-s Start a server to view the output file
82
+ --no-client|-n Do not include references to the client files in the output file
79
83
 
80
- --input-file-path|-i The input file path, the default being 'default.md'
84
+ --copy-fonts|-f Copy the fonts to a fonts folder next to the output file
81
85
 
82
- --copy-client-files|-c Copy the bundled client files next to the output file
86
+ --input-file-name|-i The input file name, the default being 'default.md'
83
87
 
84
- --output-directory-path|-o The output directory path. The default is the current directory
88
+ --copy-client-files|-c Copy the client files next to the output file
85
89
  ```
86
90
 
87
91
  ## Contact
@@ -8,6 +8,7 @@ const { HELP_OPTION,
8
8
  SERVER_OPTION,
9
9
  VERSION_OPTION,
10
10
  QUIETLY_OPTION,
11
+ NO_CLIENT_OPTION,
11
12
  COPY_FONTS_OPTION,
12
13
  INPUT_FILE_NAME_OPTION,
13
14
  COPY_CLIENT_FILES_OPTION } = options;
@@ -18,6 +19,7 @@ const h = HELP_OPTION,
18
19
  s = SERVER_OPTION,
19
20
  v = VERSION_OPTION,
20
21
  q = QUIETLY_OPTION,
22
+ n = NO_CLIENT_OPTION,
21
23
  f = COPY_FONTS_OPTION,
22
24
  i = INPUT_FILE_NAME_OPTION,
23
25
  c = COPY_CLIENT_FILES_OPTION;
@@ -28,6 +30,7 @@ module.exports = {
28
30
  w,
29
31
  v,
30
32
  q,
33
+ n,
31
34
  f,
32
35
  s,
33
36
  i,
@@ -31,11 +31,13 @@ Options:
31
31
 
32
32
  --quietly|-q Run with almost no console logging
33
33
 
34
+ --no-client|-n Do not include references to the client files in the output file
35
+
34
36
  --copy-fonts|-f Copy the fonts to a fonts folder next to the output file
35
37
 
36
38
  --input-file-name|-i The input file name, the default being 'default.md'
37
39
 
38
- --copy-client-files|-c Copy the bundled client files next to the output file
40
+ --copy-client-files|-c Copy the client files next to the output file
39
41
 
40
42
  Further information:
41
43
 
@@ -10,7 +10,7 @@ const watchOperation = require("../operation/watch"),
10
10
  const { executeOperations } = require("../utilities/operation"),
11
11
  { SUCCESSFUL_PUBLISH_MESSAGE, FAILED_PUBLISH_MESSAGE } = require("../messages");
12
12
 
13
- function publishAction(port, watch, quietly, copyFonts, inputFileName, copyClientFiles, projectDirectoryName) {
13
+ function publishAction(port, watch, quietly, noClient, copyFonts, inputFileName, copyClientFiles, projectDirectoryName) {
14
14
  const operations = [
15
15
  markdownHTMLOperation,
16
16
  markdownStylesCSSOperation,
@@ -23,6 +23,7 @@ function publishAction(port, watch, quietly, copyFonts, inputFileName, copyClien
23
23
  port,
24
24
  watch,
25
25
  quietly,
26
+ noClient,
26
27
  copyFonts,
27
28
  inputFileName,
28
29
  copyClientFiles,
@@ -4,17 +4,6 @@ const { VERSION_1_1 } = require("../versions");
4
4
 
5
5
  const { DEFAULT_CONTENTS_DEPTH } = require("../defaults");
6
6
 
7
- function createConfiguration() {
8
- const version = VERSION_1_1,
9
- contentsDepth = DEFAULT_CONTENTS_DEPTH,
10
- configuration = {
11
- version,
12
- contentsDepth
13
- };
14
-
15
- return configuration;
16
- }
17
-
18
7
  function migrateToVersion1_1(json) {
19
8
  const version = VERSION_1_1,
20
9
  contentsDepth = DEFAULT_CONTENTS_DEPTH;
@@ -27,6 +16,5 @@ function migrateToVersion1_1(json) {
27
16
  return json;
28
17
  }
29
18
  module.exports = {
30
- createConfiguration,
31
19
  migrateToVersion1_1
32
20
  };
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+
3
+ const { VERSION_1_2 } = require("../versions");
4
+
5
+ const { DEFAULT_CONTENTS_DEPTH, DEFAULT_LINES_PER_PAGE, DEFAULT_CHARACTERS_PER_LINE } = require("../defaults");
6
+
7
+ function createConfiguration() {
8
+ const version = VERSION_1_2,
9
+ linesPerPage = DEFAULT_LINES_PER_PAGE,
10
+ contentsDepth = DEFAULT_CONTENTS_DEPTH,
11
+ charactersPerLine = DEFAULT_CHARACTERS_PER_LINE,
12
+ configuration = {
13
+ version,
14
+ linesPerPage,
15
+ contentsDepth,
16
+ charactersPerLine
17
+ };
18
+
19
+ return configuration;
20
+ }
21
+
22
+ function migrateToVersion1_2(json) {
23
+ const version = VERSION_1_2,
24
+ linesPerPage = DEFAULT_LINES_PER_PAGE,
25
+ charactersPerLine = DEFAULT_CHARACTERS_PER_LINE;
26
+
27
+ json = Object.assign({}, json, {
28
+ version,
29
+ linesPerPage,
30
+ charactersPerLine
31
+ });
32
+
33
+ return json;
34
+ }
35
+ module.exports = {
36
+ createConfiguration,
37
+ migrateToVersion1_2
38
+ };
@@ -3,8 +3,9 @@
3
3
  const { versionUtilities, configurationUtilities } = require("necessary");
4
4
 
5
5
  const { HIGHMARK } = require("./constants"),
6
- { VERSION_1_0, VERSION_1_1 } = require("./versions"),
7
- { createConfiguration, migrateToVersion1_1 } = require("./configuration/version_1_1"),
6
+ { VERSION_1_0, VERSION_1_1, VERSION_1_2 } = require("./versions"),
7
+ { migrateToVersion1_1 } = require("./configuration/version_1_1"),
8
+ { createConfiguration, migrateToVersion1_2 } = require("./configuration/version_1_2"),
8
9
  { CONFIGURATION_FILE_DOES_NOT_EXIST_MESSAGE } = require("./messages");
9
10
 
10
11
  const { rc } = configurationUtilities,
@@ -15,6 +16,13 @@ const rcBaseExtension = HIGHMARK; ///
15
16
 
16
17
  setRCBaseExtension(rcBaseExtension);
17
18
 
19
+ function getLinesPerPage() {
20
+ const configuration = readConfigurationFile(),
21
+ { linesPerPage } = configuration;
22
+
23
+ return linesPerPage;
24
+ }
25
+
18
26
  function getContentsDepth() {
19
27
  const configuration = readConfigurationFile(),
20
28
  { contentsDepth } = configuration;
@@ -22,6 +30,13 @@ function getContentsDepth() {
22
30
  return contentsDepth;
23
31
  }
24
32
 
33
+ function getCharactersPerLine() {
34
+ const configuration = readConfigurationFile(),
35
+ { charactersPerLine } = configuration;
36
+
37
+ return charactersPerLine;
38
+ }
39
+
25
40
  function createConfigurationFile() {
26
41
  const configuration = createConfiguration(),
27
42
  json = configuration; ///
@@ -35,9 +50,10 @@ function migrateConfigurationFile() {
35
50
  let json = readRCFile();
36
51
 
37
52
  const migrationMap = {
38
- [VERSION_1_0]: migrateToVersion1_1
53
+ [VERSION_1_0]: migrateToVersion1_1,
54
+ [VERSION_1_1]: migrateToVersion1_2
39
55
  },
40
- latestVersion = VERSION_1_1;
56
+ latestVersion = VERSION_1_2;
41
57
 
42
58
  json = migrate(json, migrationMap, latestVersion);
43
59
 
@@ -62,7 +78,9 @@ function assertConfigurationFileExists() {
62
78
  }
63
79
 
64
80
  module.exports = {
81
+ getLinesPerPage,
65
82
  getContentsDepth,
83
+ getCharactersPerLine,
66
84
  createConfigurationFile,
67
85
  migrateConfigurationFile,
68
86
  checkConfigurationFileExists,
package/bin/defaults.js CHANGED
@@ -6,10 +6,13 @@ const DEFAULT_HELP = false,
6
6
  DEFAULT_SERVER = false,
7
7
  DEFAULT_QUIETLY = false,
8
8
  DEFAULT_VERSION = false,
9
+ DEFAULT_NO_CLIENT = false,
9
10
  DEFAULT_COPY_FONTS = false,
11
+ DEFAULT_LINES_PER_PAGE = 50,
10
12
  DEFAULT_CONTENTS_DEPTH = 2,
11
13
  DEFAULT_INPUT_FILE_NAME = "default.md",
12
- DEFAULT_COPY_CLIENT_FILES = false;
14
+ DEFAULT_COPY_CLIENT_FILES = false,
15
+ DEFAULT_CHARACTERS_PER_LINE = 90;
13
16
 
14
17
  module.exports = {
15
18
  DEFAULT_HELP,
@@ -18,8 +21,11 @@ module.exports = {
18
21
  DEFAULT_SERVER,
19
22
  DEFAULT_QUIETLY,
20
23
  DEFAULT_VERSION,
24
+ DEFAULT_NO_CLIENT,
21
25
  DEFAULT_COPY_FONTS,
26
+ DEFAULT_LINES_PER_PAGE,
22
27
  DEFAULT_CONTENTS_DEPTH,
23
28
  DEFAULT_INPUT_FILE_NAME,
24
- DEFAULT_COPY_CLIENT_FILES
29
+ DEFAULT_COPY_CLIENT_FILES,
30
+ DEFAULT_CHARACTERS_PER_LINE
25
31
  };
package/bin/main.js CHANGED
@@ -11,6 +11,7 @@ const { NO_COMMAND_GIVEN_MESSAGE, COMMAND_NOT_RECOGNISED_MESSAGE } = require("./
11
11
  { DEFAULT_PORT,
12
12
  DEFAULT_WATCH,
13
13
  DEFAULT_QUIETLY,
14
+ DEFAULT_NO_CLIENT,
14
15
  DEFAULT_COPY_FONTS,
15
16
  DEFAULT_INPUT_FILE_NAME,
16
17
  DEFAULT_COPY_CLIENT_FILES } = require("./defaults");
@@ -19,6 +20,7 @@ function main(command, argument, options) {
19
20
  const { port = DEFAULT_PORT,
20
21
  watch = DEFAULT_WATCH,
21
22
  quietly = DEFAULT_QUIETLY,
23
+ noClient = DEFAULT_NO_CLIENT,
22
24
  copyFonts = DEFAULT_COPY_FONTS,
23
25
  inputFileName = DEFAULT_INPUT_FILE_NAME,
24
26
  copyClientFiles = DEFAULT_COPY_CLIENT_FILES } = options;
@@ -53,7 +55,7 @@ function main(command, argument, options) {
53
55
  case PUBLISH_COMMAND: {
54
56
  const projectDirectoryName = argument; ///
55
57
 
56
- publishAction(port, watch, quietly, copyFonts, inputFileName, copyClientFiles, projectDirectoryName);
58
+ publishAction(port, watch, quietly, noClient, copyFonts, inputFileName, copyClientFiles, projectDirectoryName);
57
59
 
58
60
  break;
59
61
  }
@@ -9,8 +9,8 @@ const { concatenatePaths } = pathUtilities,
9
9
  { INDEX_HTML_FILE_NAME } = constants;
10
10
 
11
11
  function createClientHTMLOperation(proceed, abort, context) {
12
- const { markdownHTML, markdownStylesCSS, projectDirectoryName } = context,
13
- html = createHTML(markdownHTML, markdownStylesCSS),
12
+ const { noClient, markdownHTML, markdownStylesCSS, projectDirectoryName } = context,
13
+ html = createHTML(markdownHTML, markdownStylesCSS, noClient),
14
14
  content = html, ///
15
15
  filePath = concatenatePaths(projectDirectoryName, INDEX_HTML_FILE_NAME);
16
16
 
@@ -1,17 +1,17 @@
1
1
  "use strict";
2
2
 
3
3
  const { pathUtilities } = require("necessary");
4
- const { markdownUtilities } = require("highmark-markdown");
4
+ const { processingUtilities } = require("highmark-markdown");
5
5
 
6
6
  const importer = require("../importer");
7
7
 
8
8
  const { readFile } = require("../utilities/fileSystem"),
9
- { getContentsDepth } = require("../configuration"),
10
9
  { classNameFromFilePath } = require("../utilities/division"),
11
10
  { nodeFromTokens, tokensFromContent } = require("../utilities/markdown"),
12
- { UNABLE_TO_CONVERT_MARKDOWN_TO_HTML_MESSAGE } = require("../messages");
11
+ { UNABLE_TO_CONVERT_MARKDOWN_TO_HTML_MESSAGE } = require("../messages"),
12
+ { getLinesPerPage, getContentsDepth, getCharactersPerLine } = require("../configuration");
13
13
 
14
- const { postprocess } = markdownUtilities,
14
+ const { postprocess } = processingUtilities,
15
15
  { concatenatePaths } = pathUtilities;
16
16
 
17
17
  function markdownHTMLOperation(proceed, abort, context) {
@@ -44,25 +44,23 @@ function markdownHTMLOperation(proceed, abort, context) {
44
44
  return;
45
45
  }
46
46
 
47
- const contentsDepth = getContentsDepth(),
47
+ const linesPerPage = getLinesPerPage(),
48
+ contentsDepth = getContentsDepth(),
49
+ charactersPerLine = getCharactersPerLine(),
48
50
  divisionClassName = className, ///
49
51
  divisionMarkdownNode = node; ///
50
52
 
51
53
  Object.assign(context, {
52
54
  tokens,
53
55
  importer,
56
+ linesPerPage,
54
57
  contentsDepth,
58
+ charactersPerLine,
55
59
  divisionClassName
56
60
  });
57
61
 
58
62
  const divisionMarkdownNodes = postprocess(divisionMarkdownNode, context),
59
- markdownHTML = divisionMarkdownNodes.reduce((markdownHTML, divisionMarkdownNode, index) => {
60
- const pageNumber = index + 1;
61
-
62
- Object.assign(context, {
63
- pageNumber
64
- });
65
-
63
+ markdownHTML = divisionMarkdownNodes.reduce((markdownHTML, divisionMarkdownNode) => {
66
64
  const html = divisionMarkdownNode.asHTML(context);
67
65
 
68
66
  markdownHTML = (markdownHTML === null) ?
@@ -42,7 +42,7 @@ function markdownStylesCSSOperation(proceed, abort, context) {
42
42
  let markdownStylesCSS = defaultCSS; ///
43
43
 
44
44
  markdownStyleFilePaths.forEach((markdownStyleFilePath) => {
45
- const selectorString = selectorStringFromMarkdownStyleFilePathAndCopyClient(markdownStyleFilePath, copyClientFiles),
45
+ const selectorString = selectorStringFromMarkdownStyleFilePathAndCopyClientFiles(markdownStyleFilePath, copyClientFiles),
46
46
  markdownStyle = markdownStyleFromMarkdownStyleFilePath(markdownStyleFilePath),
47
47
  css = cssFromMarkdownStyleMediaTypeNameAndSelectorString(markdownStyle, mediaTypeName, selectorString, markdownStylesCSS); ///
48
48
 
@@ -66,7 +66,7 @@ function markdownStyleFromMarkdownStyleFilePath(markdownStyleFilePath) {
66
66
  return markdownStyle;
67
67
  }
68
68
 
69
- function selectorStringFromMarkdownStyleFilePathAndCopyClient(markdownStyleFilePath, copyClientFiles) {
69
+ function selectorStringFromMarkdownStyleFilePathAndCopyClientFiles(markdownStyleFilePath, copyClientFiles) {
70
70
  let selectorString = copyClientFiles ?
71
71
  CLIENT_DIVS_SELECTOR_STRING :
72
72
  DIVS_SELECTOR_STRING;
package/bin/options.js CHANGED
@@ -6,6 +6,7 @@ const HELP_OPTION = "help",
6
6
  SERVER_OPTION = "server",
7
7
  VERSION_OPTION = "version",
8
8
  QUIETLY_OPTION = "quietly",
9
+ NO_CLIENT_OPTION = "no-client",
9
10
  COPY_FONTS_OPTION = "copy-fonts",
10
11
  INPUT_FILE_NAME_OPTION = "input-file-name",
11
12
  COPY_CLIENT_FILES_OPTION = "copy-client-files";
@@ -17,6 +18,7 @@ module.exports = {
17
18
  SERVER_OPTION,
18
19
  VERSION_OPTION,
19
20
  QUIETLY_OPTION,
21
+ NO_CLIENT_OPTION,
20
22
  COPY_FONTS_OPTION,
21
23
  INPUT_FILE_NAME_OPTION,
22
24
  COPY_CLIENT_FILES_OPTION
package/bin/versions.js CHANGED
@@ -1,9 +1,11 @@
1
1
  "use strict";
2
2
 
3
3
  const VERSION_1_0 = "1.0",
4
- VERSION_1_1 = "1.1";
4
+ VERSION_1_1 = "1.1",
5
+ VERSION_1_2 = "1.2";
5
6
 
6
7
  module.exports = {
7
8
  VERSION_1_0,
8
- VERSION_1_1
9
+ VERSION_1_1,
10
+ VERSION_1_2
9
11
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "highmark-cli",
3
3
  "author": "James Smith",
4
- "version": "1.1.19",
4
+ "version": "1.2.1",
5
5
  "license": "MIT, Anti-996",
6
6
  "homepage": "https://github.com/djalbat/highmark-cli",
7
7
  "description": "Highmark's LIC tool.",
@@ -12,8 +12,8 @@
12
12
  "dependencies": {
13
13
  "argumentative": "^2.0.28",
14
14
  "express": "^4.19.2",
15
- "highmark-client": "^0.0.97",
16
- "highmark-markdown": "^0.0.401",
15
+ "highmark-client": "^0.0.98",
16
+ "highmark-markdown": "^0.0.406",
17
17
  "lively-cli": "^2.0.65",
18
18
  "necessary": "^14.0.1",
19
19
  "occam-entities": "^1.0.106"