highmark-cli 0.0.99 → 0.0.101

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/bin/constants.js CHANGED
@@ -6,6 +6,7 @@ const FONT = "font",
6
6
  EMPTY_STRING = "",
7
7
  DOUBLE_SPACE = " ",
8
8
  HIGHMARK_CLI = "Highmark-CLI",
9
+ TEMPLATE_FILE_PATH = "template/default.html",
9
10
  DEFAULT_SELECTOR_STRING = "div",
10
11
  DEFAULT_DIVISION_IDENTIFIER = "default";
11
12
 
@@ -16,6 +17,7 @@ module.exports = {
16
17
  EMPTY_STRING,
17
18
  DOUBLE_SPACE,
18
19
  HIGHMARK_CLI,
20
+ TEMPLATE_FILE_PATH,
19
21
  DEFAULT_SELECTOR_STRING,
20
22
  DEFAULT_DIVISION_IDENTIFIER
21
23
  };
package/bin/defaults.js CHANGED
@@ -5,7 +5,7 @@ const DEFAULT_PORT = 8888,
5
5
  DEFAULT_COPY_FONTS = false,
6
6
  DEFAULT_INPUT_FILE_PATH = "default.md",
7
7
  DEFAULT_OUTPUT_FILE_PATH = "index.html",
8
- DEFAULT_TEMPLATE_FILE_PATH = "template/default.html";
8
+ DEFAULT_TEMPLATE_FILE_PATH = null;
9
9
 
10
10
  module.exports = {
11
11
  DEFAULT_PORT,
@@ -1,13 +1,19 @@
1
1
  "use strict";
2
2
 
3
- const { computerModernStyle: computerModernStyleCSS } = require("highmark-fonts");
3
+ const { pathUtilities, packageUtilities } = require("necessary"),
4
+ { computerModernStyle: computerModernStyleCSS } = require("highmark-fonts");
4
5
 
5
- const { EMPTY_STRING } = require("../constants"),
6
- { writeFile, parseTemplateFile } = require("../utilities/fileSystem");
6
+ const { directoryPathFromFilePath } = require("../utilities/path"),
7
+ { writeFile, parseTemplateFile } = require("../utilities/fileSystem"),
8
+ { EMPTY_STRING, TEMPLATE_FILE_PATH } = require("../constants");
9
+
10
+ const { getPackagePath } = packageUtilities,
11
+ { concatenatePaths } = pathUtilities;
7
12
 
8
13
  function htmlOperation(proceed, abort, context) {
9
- const { title, markdownHTML, outputFilePath, markdownStylesCSS, templateFilePath } = context,
14
+ const { title, markdownHTML, outputFilePath, markdownStylesCSS } = context,
10
15
  titleHTML = titleHTMLFromTitle(title),
16
+ templateFilePath = getTemplateFilePath(context),
11
17
  args = {
12
18
  titleHTML,
13
19
  markdownHTML,
@@ -30,3 +36,22 @@ function titleHTMLFromTitle(title) {
30
36
 
31
37
  return titleHTML;
32
38
  }
39
+
40
+ function getTemplateFilePath(context) {
41
+ let templateFilePath;
42
+
43
+ ({templateFilePath} = context);
44
+
45
+ if (templateFilePath === null) {
46
+ const packagePath = getPackagePath();
47
+
48
+ templateFilePath = concatenatePaths(packagePath, TEMPLATE_FILE_PATH);
49
+ } else {
50
+ const { inputFilePath } = context,
51
+ inputDirectoryPath = directoryPathFromFilePath(inputFilePath);
52
+
53
+ templateFilePath = concatenatePaths(inputDirectoryPath, templateFilePath); ///
54
+ }
55
+
56
+ return templateFilePath;
57
+ }
@@ -18,12 +18,13 @@ function serverOperation(proceed, abort, context) {
18
18
  return;
19
19
  }
20
20
 
21
- server = express(); ///
22
-
23
21
  const { port, outputFilePath } = context,
24
22
  outputDirectoryPath = directoryPathFromFilePath(outputFilePath),
25
- liveReloadHandler = createLiveReloadHandler(outputFilePath),
26
- staticRouter = express.static(outputDirectoryPath);
23
+ watchPattern = `./${outputFilePath}`,
24
+ staticRouter = express.static(outputDirectoryPath),
25
+ liveReloadHandler = createLiveReloadHandler(watchPattern);
26
+
27
+ server = express(); ///
27
28
 
28
29
  server.use(staticRouter);
29
30
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "highmark-cli",
3
3
  "author": "James Smith",
4
- "version": "0.0.99",
4
+ "version": "0.0.101",
5
5
  "license": "MIT, Anti-996",
6
6
  "homepage": "https://github.com/djalbat/highmark-cli",
7
7
  "description": "Extensible, styleable Markdown.",
@@ -13,11 +13,11 @@
13
13
  "argumentative": "^2.0.28",
14
14
  "express": "^4.19.2",
15
15
  "highmark-fonts": "^1.0.36",
16
- "highmark-markdown": "^0.0.154",
17
- "highmark-markdown-style": "^0.0.190",
16
+ "highmark-markdown": "^0.0.155",
17
+ "highmark-markdown-style": "^0.0.191",
18
18
  "lively-cli": "^2.0.55",
19
19
  "necessary": "^13.6.1",
20
- "occam-entities": "^1.0.85"
20
+ "occam-entities": "^1.0.86"
21
21
  },
22
22
  "scripts": {},
23
23
  "bin": {
@@ -1,6 +1,6 @@
1
1
  <!DOCTYPE html>
2
2
  <html>
3
- <head>
3
+ <head>
4
4
 
5
5
  ${titleHTML}
6
6
 
@@ -49,10 +49,27 @@
49
49
  ${markdownStylesCSS}
50
50
 
51
51
  </style>
52
- </head>
53
- <body>
52
+ </head>
53
+ <body>
54
54
 
55
55
  ${markdownHTML}
56
56
 
57
- </body>
57
+ <script>
58
+
59
+ var xmlHttpRequest = new XMLHttpRequest();
60
+
61
+ xmlHttpRequest.onreadystatechange = function() {
62
+ if (xmlHttpRequest.readyState == 4) {
63
+ if (xmlHttpRequest.status == 200) {
64
+ location.reload();
65
+ }
66
+ }
67
+ };
68
+
69
+ xmlHttpRequest.open("GET", "/live-reload");
70
+
71
+ xmlHttpRequest.send();
72
+
73
+ </script>
74
+ </body>
58
75
  </html>