highmark-cli 1.3.187 → 1.3.188

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.
Files changed (106) hide show
  1. package/highmark.js +3 -3
  2. package/lib/abbreviations.js +17 -0
  3. package/lib/action/help.js +6 -0
  4. package/lib/action/initialise.js +17 -0
  5. package/lib/action/publish.js +35 -0
  6. package/lib/action/server.js +22 -0
  7. package/lib/action/setOptions.js +26 -0
  8. package/lib/action/version.js +10 -0
  9. package/lib/changeDirectory.js +24 -0
  10. package/lib/commands.js +9 -0
  11. package/lib/configuration/version_1_0.js +3 -0
  12. package/lib/configuration/version_1_1.js +13 -0
  13. package/lib/configuration/version_1_2.js +14 -0
  14. package/lib/configuration/version_1_3.js +31 -0
  15. package/lib/configuration.js +114 -0
  16. package/lib/constants.js +18 -0
  17. package/lib/defaultIndexOptions.js +11 -0
  18. package/lib/defaults.js +15 -0
  19. package/lib/descriptions.js +6 -0
  20. package/lib/importer.js +23 -0
  21. package/lib/jsonTypes.js +7 -0
  22. package/lib/main.js +62 -0
  23. package/lib/messages.js +25 -0
  24. package/lib/operation/copyClientFiles.js +12 -0
  25. package/lib/operation/copyFonts.js +17 -0
  26. package/lib/operation/createClientHTML.js +12 -0
  27. package/lib/operation/indexOptions.js +42 -0
  28. package/lib/operation/markdownHTML.js +48 -0
  29. package/lib/operation/markdownStylesCSS.js +42 -0
  30. package/lib/operation/prompt/charactersPerLine.js +29 -0
  31. package/lib/operation/prompt/contentsDepth.js +29 -0
  32. package/lib/operation/prompt/linesPerPage.js +31 -0
  33. package/lib/operation/server.js +26 -0
  34. package/lib/operation/setOptions.js +13 -0
  35. package/lib/operation/watch.js +16 -0
  36. package/lib/options.js +12 -0
  37. package/lib/prepare.js +38 -0
  38. package/lib/utilities/division.js +10 -0
  39. package/lib/utilities/filePath.js +11 -0
  40. package/lib/utilities/fileSystem.js +90 -0
  41. package/lib/utilities/json.js +108 -0
  42. package/lib/utilities/markdown.js +19 -0
  43. package/lib/utilities/operation.js +37 -0
  44. package/lib/utilities/path.js +7 -0
  45. package/lib/utilities/type.js +54 -0
  46. package/lib/utilities/validate.js +12 -0
  47. package/lib/versions.js +7 -0
  48. package/package.json +18 -2
  49. package/{bin → src}/abbreviations.js +12 -12
  50. package/{bin → src}/action/help.js +1 -3
  51. package/{bin → src}/action/initialise.js +3 -5
  52. package/src/action/publish.js +42 -0
  53. package/{bin → src}/action/server.js +5 -7
  54. package/{bin → src}/action/setOptions.js +8 -10
  55. package/src/action/version.js +13 -0
  56. package/{bin → src}/changeDirectory.js +4 -6
  57. package/src/commands.js +8 -0
  58. package/src/configuration/version_1_1.js +17 -0
  59. package/{bin → src}/configuration/version_1_2.js +3 -6
  60. package/{bin → src}/configuration/version_1_3.js +4 -8
  61. package/{bin → src}/configuration.js +14 -23
  62. package/src/constants.js +17 -0
  63. package/{bin → src}/defaultIndexOptions.js +1 -1
  64. package/src/defaults.js +14 -0
  65. package/src/descriptions.js +5 -0
  66. package/{bin → src}/importer.js +5 -7
  67. package/src/jsonTypes.js +6 -0
  68. package/{bin → src}/main.js +17 -19
  69. package/src/messages.js +24 -0
  70. package/{bin → src}/operation/copyClientFiles.js +2 -4
  71. package/{bin → src}/operation/copyFonts.js +4 -6
  72. package/{bin → src}/operation/createClientHTML.js +4 -6
  73. package/{bin → src}/operation/indexOptions.js +5 -7
  74. package/{bin → src}/operation/markdownHTML.js +9 -11
  75. package/{bin → src}/operation/markdownStylesCSS.js +7 -9
  76. package/{bin → src}/operation/prompt/charactersPerLine.js +5 -7
  77. package/{bin → src}/operation/prompt/contentsDepth.js +5 -7
  78. package/{bin → src}/operation/prompt/linesPerPage.js +7 -9
  79. package/{bin → src}/operation/server.js +4 -6
  80. package/{bin → src}/operation/setOptions.js +2 -4
  81. package/{bin → src}/operation/watch.js +5 -7
  82. package/src/options.js +11 -0
  83. package/{bin → src}/prepare.js +9 -11
  84. package/{bin → src}/utilities/division.js +3 -7
  85. package/{bin → src}/utilities/filePath.js +2 -7
  86. package/{bin → src}/utilities/fileSystem.js +9 -17
  87. package/{bin → src}/utilities/json.js +5 -10
  88. package/{bin → src}/utilities/markdown.js +4 -9
  89. package/{bin → src}/utilities/operation.js +2 -6
  90. package/{bin → src}/utilities/path.js +1 -5
  91. package/{bin → src}/utilities/type.js +3 -7
  92. package/src/utilities/validate.js +7 -0
  93. package/src/versions.js +6 -0
  94. package/bin/action/publish.js +0 -44
  95. package/bin/action/version.js +0 -15
  96. package/bin/commands.js +0 -17
  97. package/bin/configuration/version_1_1.js +0 -20
  98. package/bin/constants.js +0 -35
  99. package/bin/defaults.js +0 -29
  100. package/bin/descriptions.js +0 -11
  101. package/bin/jsonTypes.js +0 -13
  102. package/bin/messages.js +0 -51
  103. package/bin/options.js +0 -23
  104. package/bin/utilities/validate.js +0 -13
  105. package/bin/versions.js +0 -13
  106. /package/{bin → src}/configuration/version_1_0.js +0 -0
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ import { VERSION_1_1 } from "../versions";
4
+
5
+ import { DEFAULT_CONTENTS_DEPTH } from "../defaults";
6
+
7
+ export function migrateToVersion1_1(json) {
8
+ const version = VERSION_1_1,
9
+ contentsDepth = DEFAULT_CONTENTS_DEPTH;
10
+
11
+ json = Object.assign({}, json, {
12
+ version,
13
+ contentsDepth
14
+ });
15
+
16
+ return json;
17
+ }
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
 
3
- const { VERSION_1_2 } = require("../versions");
3
+ import { VERSION_1_2 } from "../versions";
4
4
 
5
- const { DEFAULT_LINES_PER_PAGE, DEFAULT_CHARACTERS_PER_LINE } = require("../defaults");
5
+ import { DEFAULT_LINES_PER_PAGE, DEFAULT_CHARACTERS_PER_LINE } from "../defaults";
6
6
 
7
- function migrateToVersion1_2(json) {
7
+ export function migrateToVersion1_2(json) {
8
8
  const version = VERSION_1_2,
9
9
  linesPerPage = DEFAULT_LINES_PER_PAGE,
10
10
  charactersPerLine = DEFAULT_CHARACTERS_PER_LINE;
@@ -17,6 +17,3 @@ function migrateToVersion1_2(json) {
17
17
 
18
18
  return json;
19
19
  }
20
- module.exports = {
21
- migrateToVersion1_2
22
- };
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
 
3
- const { VERSION_1_3 } = require("../versions");
3
+ import { VERSION_1_3 } from "../versions";
4
4
 
5
- const { DEFAULT_CONTENTS_DEPTH, DEFAULT_LINES_PER_PAGE, DEFAULT_CHARACTERS_PER_LINE } = require("../defaults");
5
+ import { DEFAULT_CONTENTS_DEPTH, DEFAULT_LINES_PER_PAGE, DEFAULT_CHARACTERS_PER_LINE } from "../defaults";
6
6
 
7
- function createConfiguration() {
7
+ export function createConfiguration() {
8
8
  const version = VERSION_1_3,
9
9
  linesPerPage = DEFAULT_LINES_PER_PAGE,
10
10
  contentsDepth = DEFAULT_CONTENTS_DEPTH,
@@ -22,7 +22,7 @@ function createConfiguration() {
22
22
  return configuration;
23
23
  }
24
24
 
25
- function migrateToVersion1_3(json) {
25
+ export function migrateToVersion1_3(json) {
26
26
  const { linesPerPage,
27
27
  contentsDepth,
28
28
  charactersPerLine } = json,
@@ -44,7 +44,3 @@ function migrateToVersion1_3(json) {
44
44
 
45
45
  return json;
46
46
  }
47
- module.exports = {
48
- createConfiguration,
49
- migrateToVersion1_3
50
- };
@@ -1,14 +1,14 @@
1
1
  "use strict";
2
2
 
3
- const { versionUtilities, configurationUtilities } = require("necessary");
3
+ import { versionUtilities, configurationUtilities } from "necessary";
4
4
 
5
- const { HIGHMARK } = require("./constants"),
6
- { migrateToVersion1_1 } = require("./configuration/version_1_1"),
7
- { migrateToVersion1_2 } = require("./configuration/version_1_2"),
8
- { serialiseJSON, unserialiseJSON } = require("./utilities/json"),
9
- { createConfiguration, migrateToVersion1_3 } = require("./configuration/version_1_3"),
10
- { CONFIGURATION_FILE_DOES_NOT_EXIST_MESSAGE } = require("./messages"),
11
- { VERSION_1_0, VERSION_1_1, VERSION_1_2, VERSION_1_3 } = require("./versions");
5
+ import { HIGHMARK } from "./constants";
6
+ import { migrateToVersion1_1 } from "./configuration/version_1_1";
7
+ import { migrateToVersion1_2 } from "./configuration/version_1_2";
8
+ import { serialiseJSON, unserialiseJSON } from "./utilities/json";
9
+ import { createConfiguration, migrateToVersion1_3 } from "./configuration/version_1_3";
10
+ import { CONFIGURATION_FILE_DOES_NOT_EXIST_MESSAGE } from "./messages";
11
+ import { VERSION_1_0, VERSION_1_1, VERSION_1_2, VERSION_1_3 } from "./versions";
12
12
 
13
13
  const { rc } = configurationUtilities,
14
14
  { migrate } = versionUtilities,
@@ -18,20 +18,20 @@ const rcBaseExtension = HIGHMARK; ///
18
18
 
19
19
  setRCBaseExtension(rcBaseExtension);
20
20
 
21
- function updateOptions(options) {
21
+ export function updateOptions(options) {
22
22
  updateConfigurationFile({
23
23
  options
24
24
  });
25
25
  }
26
26
 
27
- function retrieveOptions() {
27
+ export function retrieveOptions() {
28
28
  const configuration = readConfigurationFile(),
29
29
  { options } = configuration;
30
30
 
31
31
  return options;
32
32
  }
33
33
 
34
- function createConfigurationFile() {
34
+ export function createConfigurationFile() {
35
35
  const configuration = createConfiguration();
36
36
 
37
37
  let json = configuration; ///
@@ -41,7 +41,7 @@ function createConfigurationFile() {
41
41
  writeRCFile(json);
42
42
  }
43
43
 
44
- function migrateConfigurationFile() {
44
+ export function migrateConfigurationFile() {
45
45
  assertConfigurationFileExists();
46
46
 
47
47
  let json = readRCFile();
@@ -62,14 +62,14 @@ function migrateConfigurationFile() {
62
62
  writeRCFile(json);
63
63
  }
64
64
 
65
- function checkConfigurationFileExists() {
65
+ export function checkConfigurationFileExists() {
66
66
  const rcFileExists = checkRCFileExists(),
67
67
  configurationFileExists = rcFileExists; ///
68
68
 
69
69
  return configurationFileExists;
70
70
  }
71
71
 
72
- function assertConfigurationFileExists() {
72
+ export function assertConfigurationFileExists() {
73
73
  const configurationFileExists = checkConfigurationFileExists();
74
74
 
75
75
  if (!configurationFileExists) {
@@ -79,15 +79,6 @@ function assertConfigurationFileExists() {
79
79
  }
80
80
  }
81
81
 
82
- module.exports = {
83
- updateOptions,
84
- retrieveOptions,
85
- createConfigurationFile,
86
- migrateConfigurationFile,
87
- checkConfigurationFileExists,
88
- assertConfigurationFileExists
89
- };
90
-
91
82
  function readConfigurationFile() {
92
83
  assertConfigurationFileExists();
93
84
 
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ export const ERROR = "error";
4
+ export const STRING = "string";
5
+ export const NUMBER = "number";
6
+ export const BOOLEAN = "boolean";
7
+ export const HIGHMARK = "highmark";
8
+ export const INFINITY = "Infinity";
9
+ export const DOUBLE_DOTS = "..";
10
+ export const EMPTY_STRING = "";
11
+ export const DOUBLE_SPACE = " ";
12
+ export const HIGHMARK_CLI = "Highmark-CLI";
13
+ export const LIVE_RELOAD_PATH = "/live-reload";
14
+ export const FONT_DIRECTORY_NAME = "font";
15
+ export const DIVS_SELECTOR_STRING = "body > div";
16
+ export const INDEX_JSON_FILE_NAME = "index.json";
17
+ export const DEFAULT_DIVISION_IDENTIFIER = "default";
@@ -8,4 +8,4 @@ const defaultIndexOptions = {
8
8
  "ignoredWords": []
9
9
  };
10
10
 
11
- module.exports = defaultIndexOptions;
11
+ export default defaultIndexOptions;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ export const DEFAULT_HELP = false;
4
+ export const DEFAULT_PORT = 8888;
5
+ export const DEFAULT_FONTS = false;
6
+ export const DEFAULT_WATCH = false;
7
+ export const DEFAULT_CLIENT = false;
8
+ export const DEFAULT_SERVER = false;
9
+ export const DEFAULT_QUIETLY = false;
10
+ export const DEFAULT_VERSION = false;
11
+ export const DEFAULT_LINES_PER_PAGE = Infinity;
12
+ export const DEFAULT_CONTENTS_DEPTH = 2;
13
+ export const DEFAULT_INPUT_FILE_NAME = "default.md";
14
+ export const DEFAULT_CHARACTERS_PER_LINE = 75;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ export const LINES_PER_PAGE_DESCRIPTION = "Lines per page (leave blank for default of Infinity): ";
4
+ export const CONTENTS_DEPTH_DESCRIPTION = "Contents depth (from 1 to 4): ";
5
+ export const CHARACTERS_PER_LINE_DESCRIPTION = "Characters per line: ";
@@ -1,14 +1,14 @@
1
1
  "use strict";
2
2
 
3
- const { pathUtilities } = require("necessary");
3
+ import { pathUtilities } from "necessary";
4
4
 
5
- const { readFile } = require("./utilities/fileSystem"),
6
- { classNameFromFilePath } = require("./utilities/division"),
7
- { nodeFromTokens, tokensFromContent } = require("./utilities/markdown");
5
+ import { readFile } from "./utilities/fileSystem";
6
+ import { classNameFromFilePath } from "./utilities/division";
7
+ import { nodeFromTokens, tokensFromContent } from "./utilities/markdown";
8
8
 
9
9
  const { concatenatePaths } = pathUtilities;
10
10
 
11
- function importer(filePath, context) {
11
+ export default function importer(filePath, context) {
12
12
  const { projectDirectoryName } = context;
13
13
 
14
14
  filePath = concatenatePaths(projectDirectoryName, filePath); ///
@@ -32,5 +32,3 @@ function importer(filePath, context) {
32
32
  }
33
33
  }
34
34
  }
35
-
36
- module.exports = importer;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ export const NULL_JSON_TYPE = "null";
4
+ export const ARRAY_JSON_TYPE = "array";
5
+ export const OBJECT_JSON_TYPE = "object";
6
+ export const PRIMITIVE_JSON_TYPE = "primitive";
@@ -1,22 +1,22 @@
1
1
  "use strict";
2
2
 
3
- const helpAction = require("./action/help"),
4
- serverAction = require("./action/server"),
5
- versionAction = require("./action/version"),
6
- publishAction = require("./action/publish"),
7
- initialiseAction = require("./action/initialise"),
8
- setOptionsAction = require("./action/setOptions");
9
-
10
- const { NO_ARGUMENT_GIVEN_MESSAGE, COMMAND_NOT_RECOGNISED_MESSAGE } = require("./messages"),
11
- { HELP_COMMAND, SERVER_COMMAND, VERSION_COMMAND, PUBLISH_COMMAND, INITIALISE_COMMAND, SET_OPTIONS_COMMAND } = require("./commands"),
12
- { DEFAULT_PORT,
13
- DEFAULT_FONTS,
14
- DEFAULT_WATCH,
15
- DEFAULT_CLIENT,
16
- DEFAULT_QUIETLY,
17
- DEFAULT_INPUT_FILE_NAME } = require("./defaults");
18
-
19
- function main(command, argument, options) {
3
+ import helpAction from "./action/help";
4
+ import serverAction from "./action/server";
5
+ import versionAction from "./action/version";
6
+ import publishAction from "./action/publish";
7
+ import initialiseAction from "./action/initialise";
8
+ import setOptionsAction from "./action/setOptions";
9
+
10
+ import { NO_ARGUMENT_GIVEN_MESSAGE, COMMAND_NOT_RECOGNISED_MESSAGE } from "./messages";
11
+ import { HELP_COMMAND, SERVER_COMMAND, VERSION_COMMAND, PUBLISH_COMMAND, INITIALISE_COMMAND, SET_OPTIONS_COMMAND } from "./commands";
12
+ import { DEFAULT_PORT,
13
+ DEFAULT_FONTS,
14
+ DEFAULT_WATCH,
15
+ DEFAULT_CLIENT,
16
+ DEFAULT_QUIETLY,
17
+ DEFAULT_INPUT_FILE_NAME } from "./defaults";
18
+
19
+ export default function main(command, argument, options) {
20
20
  const { port = DEFAULT_PORT,
21
21
  fonts = DEFAULT_FONTS,
22
22
  watch = DEFAULT_WATCH,
@@ -80,5 +80,3 @@ function main(command, argument, options) {
80
80
  }
81
81
  }
82
82
  }
83
-
84
- module.exports = main;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ export const NO_ARGUMENT_GIVEN_MESSAGE = "No argument has been given.";
4
+ export const COMMAND_NOT_RECOGNISED_MESSAGE = "The command is not recognised.";
5
+ export const INVALID_LINES_PER_PAGE_MESSAGE = "The lines per page must either be a number or left blank for the default of Infinity; which effectively suppresses pagination.";
6
+ export const INVALID_CONTENTS_DEPTH_MESSAGE = "The contents depth must be a number between 1 and 4 inclusive; with 1 being primary headings only; 4 down to quaternary headings.";
7
+ export const INVALID_CHARACTERS_PER_LINE_MESSAGE = "The characters per line must a number.";
8
+ export const FAILED_SERVER_MESSAGE = "Failed to serve.";
9
+ export const FAILED_PUBLISH_MESSAGE = "Failed to publish.";
10
+ export const FAILED_INITIALISE_MESSAGE = "Failed to create a configuration file because one is already present.";
11
+ export const FAILED_SET_OPTIONS_MESSAGE = "Failed to set the options.";
12
+ export const SUCCESSFUL_SERVER_MESSAGE = "Served successfully.";
13
+ export const SUCCESSFUL_PUBLISH_MESSAGE = "Published successfully.";
14
+ export const SUCCESSFUL_INITIALISE_MESSAGE = "The configuration file has been created successfully.";
15
+ export const SUCCESSFUL_SET_OPTIONS_MESSAGE = "The options have been set successfully.";
16
+ export const UNABLE_TO_COPY_FILE_MESSAGE = "Unable to copy the file.";
17
+ export const UNABLE_TO_READ_FILE_MESSAGE = "Unable to read the file.";
18
+ export const UNABLE_TO_WRITE_FILE_MESSAGE = "Unable to write the file.";
19
+ export const UNABLE_TO_START_SERVER_MESSAGE = "Unable to start the server";
20
+ export const UNABLE_TO_READ_DIRECTORY_MESSAGE = "Unable to read the directory.";
21
+ export const UNABLE_TO_CREATE_DIRECTORY_MESSAGE = "Unable to create the directory.";
22
+ export const UNABLE_TO_PARSE_MARKDOWN_FILE_MESSAGE = "Unable to parse the markdown file.";
23
+ export const CONFIGURATION_FILE_DOES_NOT_EXIST_MESSAGE = "There is no configuration file. Run 'highmark initialise' to create one.";
24
+ export const UNABLE_TO_CONVERT_MARKDOWN_TO_HTML_MESSAGE = "Unable to convert Markdown to HTML.";
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
 
3
- const { copyFiles: copyClientFiles } = require("highmark-client");
3
+ import { copyFiles as copyClientFiles } from "highmark-client";
4
4
 
5
- function copyClientFilesOperation(proceed, abort, context) {
5
+ export default function copyClientFilesOperation(proceed, abort, context) {
6
6
  const { client } = context;
7
7
 
8
8
  if (client) {
@@ -14,5 +14,3 @@ function copyClientFilesOperation(proceed, abort, context) {
14
14
 
15
15
  proceed();
16
16
  }
17
-
18
- module.exports = copyClientFilesOperation;
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
 
3
- const { copyFonts } = require("highmark-client"),
4
- { pathUtilities } = require("necessary");
3
+ import { copyFonts } from "highmark-client";
4
+ import { pathUtilities } from "necessary";
5
5
 
6
- const { FONT_DIRECTORY_NAME } = require("../constants");
6
+ import { FONT_DIRECTORY_NAME } from "../constants";
7
7
 
8
8
  const { concatenatePaths } = pathUtilities;
9
9
 
10
- function copyFontsOperation(proceed, abort, context) {
10
+ export default function copyFontsOperation(proceed, abort, context) {
11
11
  const { fonts } = context;
12
12
 
13
13
  if (!fonts) {
@@ -23,5 +23,3 @@ function copyFontsOperation(proceed, abort, context) {
23
23
 
24
24
  proceed();
25
25
  }
26
-
27
- module.exports = copyFontsOperation;
@@ -1,14 +1,14 @@
1
1
  "use strict";
2
2
 
3
- const { pathUtilities } = require("necessary"),
4
- { constants, createHTML } = require("highmark-client");
3
+ import { pathUtilities } from "necessary";
4
+ import { constants, createHTML } from "highmark-client";
5
5
 
6
- const { writeFile } = require("../utilities/fileSystem");
6
+ import { writeFile } from "../utilities/fileSystem";
7
7
 
8
8
  const { concatenatePaths } = pathUtilities,
9
9
  { INDEX_HTML_FILE_NAME } = constants;
10
10
 
11
- function createClientHTMLOperation(proceed, abort, context) {
11
+ export default function createClientHTMLOperation(proceed, abort, context) {
12
12
  const { client, markdownHTML, markdownStylesCSS, projectDirectoryName } = context,
13
13
  html = createHTML(markdownHTML, markdownStylesCSS, client),
14
14
  content = html, ///
@@ -18,5 +18,3 @@ function createClientHTMLOperation(proceed, abort, context) {
18
18
 
19
19
  proceed();
20
20
  }
21
-
22
- module.exports = createClientHTMLOperation;
@@ -1,15 +1,15 @@
1
1
  "use strict";
2
2
 
3
- const { pathUtilities } = require("necessary");
3
+ import { pathUtilities } from "necessary";
4
4
 
5
- const defaultIndexOptions = require("../defaultIndexOptions");
5
+ import defaultIndexOptions from "../defaultIndexOptions";
6
6
 
7
- const { readFile, writeFile } = require("../utilities/fileSystem"),
8
- { DOUBLE_SPACE, INDEX_JSON_FILE_NAME } = require("../constants");
7
+ import { readFile, writeFile } from "../utilities/fileSystem";
8
+ import { DOUBLE_SPACE, INDEX_JSON_FILE_NAME } from "../constants";
9
9
 
10
10
  const { concatenatePaths } = pathUtilities;
11
11
 
12
- function indexOptionsOperation(proceed, abort, context) {
12
+ export default function indexOptionsOperation(proceed, abort, context) {
13
13
  const { projectDirectoryName } = context;
14
14
 
15
15
  let content,
@@ -65,5 +65,3 @@ function indexOptionsOperation(proceed, abort, context) {
65
65
 
66
66
  proceed();
67
67
  }
68
-
69
- module.exports = indexOptionsOperation;
@@ -1,20 +1,20 @@
1
1
  "use strict";
2
2
 
3
- const { pathUtilities } = require("necessary"),
4
- { processingUtilities } = require("highmark-markdown");
3
+ import { pathUtilities } from "necessary";
4
+ import { processingUtilities } from "highmark-markdown";
5
5
 
6
- const importer = require("../importer");
6
+ import importer from "../importer";
7
7
 
8
- const { readFile } = require("../utilities/fileSystem"),
9
- { retrieveOptions } = require("../configuration"),
10
- { classNameFromFilePath } = require("../utilities/division"),
11
- { nodeFromTokens, tokensFromContent } = require("../utilities/markdown"),
12
- { UNABLE_TO_CONVERT_MARKDOWN_TO_HTML_MESSAGE } = require("../messages");
8
+ import { readFile } from "../utilities/fileSystem";
9
+ import { retrieveOptions } from "../configuration";
10
+ import { classNameFromFilePath } from "../utilities/division";
11
+ import { nodeFromTokens, tokensFromContent } from "../utilities/markdown";
12
+ import { UNABLE_TO_CONVERT_MARKDOWN_TO_HTML_MESSAGE } from "../messages";
13
13
 
14
14
  const { postprocess } = processingUtilities,
15
15
  { concatenatePaths } = pathUtilities;
16
16
 
17
- function markdownHTMLOperation(proceed, abort, context) {
17
+ export default function markdownHTMLOperation(proceed, abort, context) {
18
18
  const { inputFileName, projectDirectoryName } = context,
19
19
  inputFilePath = concatenatePaths(projectDirectoryName, inputFileName),
20
20
  filePath = inputFilePath, ///
@@ -79,5 +79,3 @@ function markdownHTMLOperation(proceed, abort, context) {
79
79
 
80
80
  proceed();
81
81
  }
82
-
83
- module.exports = markdownHTMLOperation;
@@ -1,17 +1,17 @@
1
1
  "use strict";
2
2
 
3
- const { constants } = require("highmark-client"),
4
- { cssUtilities, defaultMarkdownStyle } = require("highmark-markdown")
3
+ import { constants } from "highmark-client";
4
+ import { cssUtilities, defaultMarkdownStyle } from "highmark-markdown";
5
5
 
6
- const { DIVS_SELECTOR_STRING } = require("../constants"),
7
- { classNameFromFilePath } = require("../utilities/division"),
8
- { readFile, readDirectory } = require("../utilities/fileSystem"),
9
- { isFilePathMarkdownStyleFilePath, isFilePathDefaultMarkdownStyleFilePath } = require("../utilities/filePath");
6
+ import { DIVS_SELECTOR_STRING } from "../constants";
7
+ import { classNameFromFilePath } from "../utilities/division";
8
+ import { readFile, readDirectory } from "../utilities/fileSystem";
9
+ import { isFilePathMarkdownStyleFilePath, isFilePathDefaultMarkdownStyleFilePath } from "../utilities/filePath";
10
10
 
11
11
  const { DIVS_SELECTOR_STRING: CLIENT_DIVS_SELECTOR_STRING } = constants,
12
12
  { cssFromMarkdownStyleAndSelectorString } = cssUtilities;
13
13
 
14
- function markdownStylesCSSOperation(proceed, abort, context) {
14
+ export default function markdownStylesCSSOperation(proceed, abort, context) {
15
15
  const { client, projectDirectoryName } = context,
16
16
  projectDirectoryPath = projectDirectoryName, ///
17
17
  markdownStyleFilePaths = [];
@@ -52,8 +52,6 @@ function markdownStylesCSSOperation(proceed, abort, context) {
52
52
  proceed();
53
53
  }
54
54
 
55
- module.exports = markdownStylesCSSOperation;
56
-
57
55
  function markdownStyleFromMarkdownStyleFilePath(markdownStyleFilePath) {
58
56
  const filePath = markdownStyleFilePath, ///
59
57
  content = readFile(filePath),
@@ -1,14 +1,14 @@
1
1
  "use strict";
2
2
 
3
- const { shellUtilities } = require("necessary");
3
+ import { shellUtilities } from "necessary";
4
4
 
5
- const { validateCharactersPerLine } = require("../../utilities/validate"),
6
- { CHARACTERS_PER_LINE_DESCRIPTION } = require("../../descriptions"),
7
- { INVALID_CHARACTERS_PER_LINE_MESSAGE } = require("../../messages");
5
+ import { validateCharactersPerLine } from "../../utilities/validate";
6
+ import { CHARACTERS_PER_LINE_DESCRIPTION } from "../../descriptions";
7
+ import { INVALID_CHARACTERS_PER_LINE_MESSAGE } from "../../messages";
8
8
 
9
9
  const { prompt } = shellUtilities;
10
10
 
11
- function contentsDepthPromptOperation(proceed, abort, context) {
11
+ export default function contentsDepthPromptOperation(proceed, abort, context) {
12
12
  const { charactersPerLine } = context,
13
13
  description = CHARACTERS_PER_LINE_DESCRIPTION,
14
14
  errorMessage = INVALID_CHARACTERS_PER_LINE_MESSAGE,
@@ -41,5 +41,3 @@ function contentsDepthPromptOperation(proceed, abort, context) {
41
41
  abort();
42
42
  });
43
43
  }
44
-
45
- module.exports = contentsDepthPromptOperation;
@@ -1,14 +1,14 @@
1
1
  "use strict";
2
2
 
3
- const { shellUtilities } = require("necessary");
3
+ import { shellUtilities } from "necessary";
4
4
 
5
- const { validateContentsDepth } = require("../../utilities/validate"),
6
- { CONTENTS_DEPTH_DESCRIPTION } = require("../../descriptions"),
7
- { INVALID_CONTENTS_DEPTH_MESSAGE } = require("../../messages");
5
+ import { validateContentsDepth } from "../../utilities/validate";
6
+ import { CONTENTS_DEPTH_DESCRIPTION } from "../../descriptions";
7
+ import { INVALID_CONTENTS_DEPTH_MESSAGE } from "../../messages";
8
8
 
9
9
  const { prompt } = shellUtilities;
10
10
 
11
- function contentsDepthPromptOperation(proceed, abort, context) {
11
+ export default function contentsDepthPromptOperation(proceed, abort, context) {
12
12
  const { contentsDepth } = context,
13
13
  description = CONTENTS_DEPTH_DESCRIPTION,
14
14
  errorMessage = INVALID_CONTENTS_DEPTH_MESSAGE,
@@ -41,5 +41,3 @@ function contentsDepthPromptOperation(proceed, abort, context) {
41
41
  abort();
42
42
  });
43
43
  }
44
-
45
- module.exports = contentsDepthPromptOperation;
@@ -1,16 +1,16 @@
1
1
  "use strict";
2
2
 
3
- const { shellUtilities } = require("necessary");
3
+ import { shellUtilities } from "necessary";
4
4
 
5
- const { validateLinesPerPage } = require("../../utilities/validate"),
6
- { EMPTY_STRING } = require("../../constants"),
7
- { DEFAULT_LINES_PER_PAGE } = require("../../defaults"),
8
- { LINES_PER_PAGE_DESCRIPTION } = require("../../descriptions"),
9
- { INVALID_LINES_PER_PAGE_MESSAGE } = require("../../messages");
5
+ import { validateLinesPerPage } from "../../utilities/validate";
6
+ import { EMPTY_STRING } from "../../constants";
7
+ import { DEFAULT_LINES_PER_PAGE } from "../../defaults";
8
+ import { LINES_PER_PAGE_DESCRIPTION } from "../../descriptions";
9
+ import { INVALID_LINES_PER_PAGE_MESSAGE } from "../../messages";
10
10
 
11
11
  const { prompt } = shellUtilities;
12
12
 
13
- function linesPerPagePromptOperation(proceed, abort, context) {
13
+ export default function linesPerPagePromptOperation(proceed, abort, context) {
14
14
  const { linesPerPage } = context,
15
15
  description = LINES_PER_PAGE_DESCRIPTION,
16
16
  errorMessage = INVALID_LINES_PER_PAGE_MESSAGE,
@@ -47,5 +47,3 @@ function linesPerPagePromptOperation(proceed, abort, context) {
47
47
  abort();
48
48
  });
49
49
  }
50
-
51
- module.exports = linesPerPagePromptOperation;
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
 
3
- const express = require("express");
3
+ import express from "express";
4
4
 
5
- const { ERROR } = require("../constants"),
6
- { UNABLE_TO_START_SERVER_MESSAGE } = require("../messages");
5
+ import { ERROR } from "../constants";
6
+ import { UNABLE_TO_START_SERVER_MESSAGE } from "../messages";
7
7
 
8
- function serverOperation(proceed, abort, context) {
8
+ export default function serverOperation(proceed, abort, context) {
9
9
  const server = express(); ///
10
10
 
11
11
  Object.assign(context, {
@@ -37,5 +37,3 @@ function serverOperation(proceed, abort, context) {
37
37
  abort();
38
38
  });
39
39
  }
40
-
41
- module.exports = serverOperation;
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
 
3
- const { updateOptions } = require("../configuration");
3
+ import { updateOptions } from "../configuration";
4
4
 
5
- function setOptionsOperation(proceed, abort, context) {
5
+ export default function setOptionsOperation(proceed, abort, context) {
6
6
  const { linesPerPage, contentsDepth, charactersPerLine } = context,
7
7
  options = {
8
8
  linesPerPage,
@@ -14,5 +14,3 @@ function setOptionsOperation(proceed, abort, context) {
14
14
 
15
15
  proceed();
16
16
  }
17
-
18
- module.exports = setOptionsOperation;
@@ -1,15 +1,15 @@
1
1
  "use strict";
2
2
 
3
- const { constants } = require("highmark-client"),
4
- { pathUtilities } = require("necessary"),
5
- { createLiveReloadHandler } = require("lively-cli");
3
+ import { constants } from "highmark-client";
4
+ import { pathUtilities } from "necessary";
5
+ import { createLiveReloadHandler } from "lively-cli";
6
6
 
7
- const { LIVE_RELOAD_PATH } = require("../constants");
7
+ import { LIVE_RELOAD_PATH } from "../constants";
8
8
 
9
9
  const { concatenatePaths } = pathUtilities,
10
10
  { INDEX_HTML_FILE_NAME } = constants;
11
11
 
12
- function watchOperation(proceed, abort, context) {
12
+ export default function watchOperation(proceed, abort, context) {
13
13
  const { watch } = context;
14
14
 
15
15
  if (watch) {
@@ -23,5 +23,3 @@ function watchOperation(proceed, abort, context) {
23
23
 
24
24
  proceed();
25
25
  }
26
-
27
- module.exports = watchOperation;
package/src/options.js ADDED
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+
3
+ export const HELP_OPTION = "help";
4
+ export const PORT_OPTION = "port";
5
+ export const FONTS_OPTION = "fonts";
6
+ export const WATCH_OPTION = "watch";
7
+ export const CLIENT_OPTION = "client";
8
+ export const SERVER_OPTION = "server";
9
+ export const VERSION_OPTION = "version";
10
+ export const QUIETLY_OPTION = "quietly";
11
+ export const INPUT_FILE_NAME_OPTION = "input-file-name";