highmark-cli 0.0.175 → 0.0.178

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.
@@ -4,9 +4,8 @@ const htmlOperation = require("../operation/html"),
4
4
  watchOperation = require("../operation/watch"),
5
5
  serverOperation = require("../operation/server"),
6
6
  copyFontsOperation = require("../operation/copyFonts"),
7
- copyClientOperation = require("../operation/copyClient"),
8
7
  markdownHTMLOperation = require("../operation/markdownHTML"),
9
- copyCheckmarkOperation = require("../operation/copyCheckmark"),
8
+ copyClientFilesOperation = require("../operation/copyClientFiles"),
10
9
  markdownStylesCSSOperation = require("../operation/markdownStylesCSS");
11
10
 
12
11
  const { executeOperations } = require("../utilities/operation"),
@@ -14,10 +13,9 @@ const { executeOperations } = require("../utilities/operation"),
14
13
 
15
14
  function publishAction(port, watch, server, quietly, copyFonts, inputFilePath, copyClientFiles, outputDirectoryPath) {
16
15
  const operations = [
17
- markdownStylesCSSOperation,
18
16
  markdownHTMLOperation,
19
- copyCheckmarkOperation,
20
- copyClientOperation,
17
+ markdownStylesCSSOperation,
18
+ copyClientFilesOperation,
21
19
  copyFontsOperation,
22
20
  htmlOperation,
23
21
  serverOperation,
package/bin/constants.js CHANGED
@@ -3,31 +3,24 @@
3
3
  const FONT = "font",
4
4
  ERROR = "error",
5
5
  PERIOD = ".",
6
- DEFER_DELAY = 100,
7
- EMPTY_STRING = "",
8
6
  HIGHMARK_CLI = "Highmark-CLI",
9
- CLIENT_FILE_NAME = "client.js",
7
+ INDEX_HTML_FILE_NAME = "index.html",
10
8
  LIVE_RELOAD_PATH = "/live-reload",
11
- CHECKMARK_FILE_NAME = "checkmark.svg",
12
- CLIENT_SELECTOR_STRING = "body > div.view > div.overlay > div",
13
- RAW_HTML_SELECTOR_STRING = "body > div",
9
+ DIVS_SELECTOR_STRING = "body > div",
14
10
  INDEX_TEMPLATE_FILE_PATH = "template/index.html",
15
11
  CLIENT_TEMPLATE_FILE_PATH = "template/client.html",
12
+ CLIENT_DIVS_SELECTOR_STRING = "body > div.view > div.overlay > div",
16
13
  DEFAULT_DIVISION_IDENTIFIER = "default";
17
14
 
18
15
  module.exports = {
19
16
  FONT,
20
17
  ERROR,
21
18
  PERIOD,
22
- DEFER_DELAY,
23
- EMPTY_STRING,
24
19
  HIGHMARK_CLI,
25
- CLIENT_FILE_NAME,
26
20
  LIVE_RELOAD_PATH,
27
- CHECKMARK_FILE_NAME,
28
- CLIENT_SELECTOR_STRING,
29
- RAW_HTML_SELECTOR_STRING,
21
+ DIVS_SELECTOR_STRING,
30
22
  INDEX_TEMPLATE_FILE_PATH,
31
23
  CLIENT_TEMPLATE_FILE_PATH,
24
+ CLIENT_DIVS_SELECTOR_STRING,
32
25
  DEFAULT_DIVISION_IDENTIFIER
33
26
  };
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ const { copyClientFiles: copyClientFilesAsync } = require("highmark-client");
4
+
5
+ function copyClientFilesOperation(proceed, abort, context) {
6
+ const { copyClientFiles } = context;
7
+
8
+ if (copyClientFiles) {
9
+ const { markdownHTML, markdownStylesCSS, outputDirectoryPath } = context,
10
+ targetDirectoryPath = outputDirectoryPath; ///
11
+
12
+ copyClientFilesAsync(markdownHTML, markdownStylesCSS, targetDirectoryPath);
13
+ }
14
+
15
+ proceed();
16
+ }
17
+
18
+ module.exports = copyClientFilesOperation;
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
 
3
- const { copyFonts: copyFontsAsync } = require("highmark-client");
3
+ const { pathUtilities } = require("necessary"),
4
+ { copyFonts: copyFontsAsync } = require("highmark-client");
4
5
 
5
- const { FONT } = require("../constants"),
6
- { directoryPathFromFilePath } = require("../utilities/path");
6
+ const { FONT } = require("../constants");
7
7
 
8
8
  const { concatenatePaths } = pathUtilities;
9
9
 
@@ -16,8 +16,7 @@ function copyFontsOperation(proceed, abort, context) {
16
16
  return;
17
17
  }
18
18
 
19
- const { outputFilePath } = context,
20
- outputDirectoryPath = directoryPathFromFilePath(outputFilePath),
19
+ const { outputDirectoryPath } = context,
21
20
  fontDirectoryPath = concatenatePaths(outputDirectoryPath, FONT);
22
21
 
23
22
  copyFontsAsync(fontDirectoryPath);
@@ -7,14 +7,14 @@ const { mediaTypeNames } = require("highmark-markdown"),
7
7
  const { classNameFromFilePath } = require("../utilities/division"),
8
8
  { readFile, readDirectory } = require("../utilities/fileSystem"),
9
9
  { directoryPathFromFilePath } = require("../utilities/path"),
10
- { CLIENT_SELECTOR_STRING, RAW_HTML_SELECTOR_STRING } = require("../constants");
10
+ { DIVS_SELECTOR_STRING, CLIENT_DIVS_SELECTOR_STRING } = require("../constants");
11
11
 
12
12
  const { WEB_MEDIA_TYPE_NAME } = mediaTypeNames,
13
13
  { cssFromMarkdownStyleMediaTypeNameAndSelectorString } = cssUtilities,
14
14
  { isFilePathMarkdownStyleFilePath, isFilePathDefaultMarkdownStyleFilePath } = filePathUtilities;
15
15
 
16
16
  function markdownStylesCSSOperation(proceed, abort, context) {
17
- const { copyClient, inputFilePath } = context,
17
+ const { inputFilePath, copyClientFiles } = context,
18
18
  inputDirectoryPath = directoryPathFromFilePath(inputFilePath),
19
19
  markdownStyleFilePaths = [];
20
20
 
@@ -31,9 +31,9 @@ function markdownStylesCSSOperation(proceed, abort, context) {
31
31
  }
32
32
  });
33
33
 
34
- const selectorString = copyClient ?
35
- CLIENT_SELECTOR_STRING :
36
- RAW_HTML_SELECTOR_STRING,
34
+ const selectorString = copyClientFiles ?
35
+ CLIENT_DIVS_SELECTOR_STRING :
36
+ DIVS_SELECTOR_STRING,
37
37
  markdownStyle = defaultMarkdownStyle, ///
38
38
  mediaTypeName = WEB_MEDIA_TYPE_NAME,
39
39
  defaultCSS = cssFromMarkdownStyleMediaTypeNameAndSelectorString(markdownStyle, mediaTypeName, selectorString);
@@ -41,7 +41,7 @@ function markdownStylesCSSOperation(proceed, abort, context) {
41
41
  let markdownStylesCSS = defaultCSS; ///
42
42
 
43
43
  markdownStyleFilePaths.forEach((markdownStyleFilePath) => {
44
- const selectorString = selectorStringFromMarkdownStyleFilePathAndCopyClient(markdownStyleFilePath, copyClient),
44
+ const selectorString = selectorStringFromMarkdownStyleFilePathAndCopyClient(markdownStyleFilePath, copyClientFiles),
45
45
  markdownStyle = markdownStyleFromMarkdownStyleFilePath(markdownStyleFilePath),
46
46
  css = cssFromMarkdownStyleMediaTypeNameAndSelectorString(markdownStyle, mediaTypeName, selectorString, markdownStylesCSS); ///
47
47
 
@@ -65,10 +65,10 @@ function markdownStyleFromMarkdownStyleFilePath(markdownStyleFilePath) {
65
65
  return markdownStyle;
66
66
  }
67
67
 
68
- function selectorStringFromMarkdownStyleFilePathAndCopyClient(markdownStyleFilePath, copyClient) {
69
- let selectorString = copyClient ?
70
- CLIENT_SELECTOR_STRING :
71
- RAW_HTML_SELECTOR_STRING;
68
+ function selectorStringFromMarkdownStyleFilePathAndCopyClient(markdownStyleFilePath, copyClientFiles) {
69
+ let selectorString = copyClientFiles ?
70
+ CLIENT_DIVS_SELECTOR_STRING :
71
+ DIVS_SELECTOR_STRING;
72
72
 
73
73
  const filePath = markdownStyleFilePath, ///
74
74
  className = classNameFromFilePath(filePath);
@@ -3,7 +3,6 @@
3
3
  const express = require("express");
4
4
 
5
5
  const { ERROR } = require("../constants"),
6
- { directoryPathFromFilePath } = require("../utilities/path"),
7
6
  { UNABLE_TO_START_SERVER_MESSAGE } = require("../messages");
8
7
 
9
8
  function serverOperation(proceed, abort, context) {
@@ -21,8 +20,7 @@ function serverOperation(proceed, abort, context) {
21
20
  server
22
21
  });
23
22
 
24
- const { port, outputFilePath } = context,
25
- outputDirectoryPath = directoryPathFromFilePath(outputFilePath),
23
+ const { port, outputDirectoryPath } = context,
26
24
  staticRouter = express.static(outputDirectoryPath);
27
25
 
28
26
  server.use(staticRouter);
@@ -2,8 +2,7 @@
2
2
 
3
3
  const { createLiveReloadHandler } = require("lively-cli");
4
4
 
5
- const { LIVE_RELOAD_PATH } = require("../constants"),
6
- { directoryPathFromFilePath } = require("../utilities/path");
5
+ const { LIVE_RELOAD_PATH } = require("../constants");
7
6
 
8
7
  function watchOperation(proceed, abort, context) {
9
8
  const { watch } = context;
@@ -22,8 +21,7 @@ function watchOperation(proceed, abort, context) {
22
21
  return;
23
22
  }
24
23
 
25
- const { quietly, outputFilePath } = context,
26
- outputDirectoryPath = directoryPathFromFilePath(outputFilePath),
24
+ const { quietly, outputDirectoryPath } = context,
27
25
  watchPattern = outputDirectoryPath, ///
28
26
  liveReloadHandler = createLiveReloadHandler(watchPattern, quietly);
29
27
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "highmark-cli",
3
3
  "author": "James Smith",
4
- "version": "0.0.175",
4
+ "version": "0.0.178",
5
5
  "license": "MIT, Anti-996",
6
6
  "homepage": "https://github.com/djalbat/highmark-cli",
7
7
  "description": "Extensible, styleable Markdown.",
@@ -12,7 +12,7 @@
12
12
  "dependencies": {
13
13
  "argumentative": "^2.0.28",
14
14
  "express": "^4.19.2",
15
- "highmark-client": "^0.0.8",
15
+ "highmark-client": "^0.0.13",
16
16
  "highmark-fonts": "^1.0.43",
17
17
  "highmark-markdown": "^0.0.245",
18
18
  "lively-cli": "^2.0.59",
@@ -1,32 +0,0 @@
1
- "use strict";
2
-
3
- const { pathUtilities, packageUtilities } = require("necessary");
4
-
5
- const { copyFile } = require("../utilities/fileSystem"),
6
- { CHECKMARK_FILE_NAME } = require("../constants"),
7
- { directoryPathFromFilePath } = require("../utilities/path");
8
-
9
- const { getPackagePath } = packageUtilities,
10
- { concatenatePaths } = pathUtilities;
11
-
12
- function copyCheckmarkOperation(proceed, abort, context) {
13
- const { copyClient } = context;
14
-
15
- if (!copyClient) {
16
- proceed();
17
-
18
- return;
19
- }
20
-
21
- const { outputFilePath } = context,
22
- packagePath = getPackagePath(),
23
- outputDirectoryPath = directoryPathFromFilePath(outputFilePath),
24
- sourceFilePath = concatenatePaths(packagePath, CHECKMARK_FILE_NAME), ///
25
- targetFilePath = concatenatePaths(outputDirectoryPath, CHECKMARK_FILE_NAME); ///
26
-
27
- copyFile(sourceFilePath, targetFilePath);
28
-
29
- proceed();
30
- }
31
-
32
- module.exports = copyCheckmarkOperation;
@@ -1,51 +0,0 @@
1
- "use strict";
2
-
3
- const { watch: watchFile } = require("lively-cli");
4
-
5
- const { DEFER_DELAY } = require("../constants"),
6
- { copyClientFile: copyClientFileEx, getClientSourceFilePath } = require("../utilities/client");
7
-
8
- function copyClientOperation(proceed, abort, context) {
9
- const { copyClient } = context;
10
-
11
- if (!copyClient) {
12
- proceed();
13
-
14
- return;
15
- }
16
-
17
- copyClientFile();
18
-
19
- let { server } = context;
20
-
21
- if (!server) {
22
- proceed();
23
-
24
- return;
25
- }
26
-
27
- const { quietly } = context,
28
- clientSSourceFilePath = getClientSourceFilePath(context),
29
- watchPattern = clientSSourceFilePath, ///
30
- registerHandler = watchFile(watchPattern, quietly);
31
-
32
- registerHandler(copyClientFile);
33
-
34
- proceed();
35
-
36
- function copyClientFile() {
37
- copyClientFileEx(context);
38
-
39
- defer(() => {
40
- registerHandler(copyClientFile);
41
- });
42
- }
43
- }
44
-
45
- module.exports = copyClientOperation;
46
-
47
- function defer(func) {
48
- const delay = DEFER_DELAY;
49
-
50
- setTimeout(func, delay);
51
- }