highmark-cli 0.0.259 → 0.0.261
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 +3 -1
- package/bin/abbreviations.js +7 -10
- package/bin/action/help.js +7 -5
- package/bin/action/initialise.js +26 -0
- package/bin/action/publish.js +5 -8
- package/bin/action/server.js +2 -3
- package/bin/commands.js +4 -2
- package/bin/configuration/version_1_0.js +4 -0
- package/bin/configure.js +20 -14
- package/bin/constants.js +0 -2
- package/bin/defaults.js +6 -8
- package/bin/main.js +20 -19
- package/bin/messages.js +4 -0
- package/bin/operation/copyClientFiles.js +3 -3
- package/bin/operation/copyFonts.js +2 -2
- package/bin/operation/createClientHTML.js +15 -0
- package/bin/operation/markdownHTML.js +6 -1
- package/bin/operation/markdownStylesCSS.js +6 -7
- package/bin/operation/server.js +2 -10
- package/bin/operation/watch.js +2 -10
- package/bin/options.js +6 -8
- package/bin/utilities/path.js +1 -25
- package/package.json +2 -2
- package/bin/operation/copyHTML.js +0 -23
package/README.md
CHANGED
|
@@ -51,7 +51,7 @@ Depending on your setup you may need to prepend `sudo` to the above.
|
|
|
51
51
|
These are the commands and options:
|
|
52
52
|
|
|
53
53
|
```
|
|
54
|
-
highmark [<command>] [<argument>]
|
|
54
|
+
highmark [<options>] [<command>] [<argument>]
|
|
55
55
|
|
|
56
56
|
Commands:
|
|
57
57
|
|
|
@@ -71,6 +71,8 @@ Options:
|
|
|
71
71
|
|
|
72
72
|
--watch|-w Watch for changes to the client file and in the output directory
|
|
73
73
|
|
|
74
|
+
--quietly|-q Run with almost no console logging
|
|
75
|
+
|
|
74
76
|
--copy-fonts|-f Copy the fonts to a fonts folder next to the output file
|
|
75
77
|
|
|
76
78
|
--start-server|-s Start a server to view the output file
|
package/bin/abbreviations.js
CHANGED
|
@@ -5,24 +5,22 @@ const options = require("./options");
|
|
|
5
5
|
const { HELP_OPTION,
|
|
6
6
|
PORT_OPTION,
|
|
7
7
|
WATCH_OPTION,
|
|
8
|
+
SERVER_OPTION,
|
|
8
9
|
VERSION_OPTION,
|
|
9
10
|
QUIETLY_OPTION,
|
|
10
11
|
COPY_FONTS_OPTION,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
COPY_CLIENT_FILES_OPTION,
|
|
14
|
-
OUTPUT_DIRECTORY_PATH_OPTION } = options;
|
|
12
|
+
INPUT_FILE_NAME_OPTION,
|
|
13
|
+
COPY_CLIENT_FILES_OPTION } = options;
|
|
15
14
|
|
|
16
15
|
const h = HELP_OPTION,
|
|
17
16
|
p = PORT_OPTION,
|
|
18
17
|
w = WATCH_OPTION,
|
|
18
|
+
s = SERVER_OPTION,
|
|
19
19
|
v = VERSION_OPTION,
|
|
20
20
|
q = QUIETLY_OPTION,
|
|
21
21
|
f = COPY_FONTS_OPTION,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
c = COPY_CLIENT_FILES_OPTION,
|
|
25
|
-
o = OUTPUT_DIRECTORY_PATH_OPTION;
|
|
22
|
+
i = INPUT_FILE_NAME_OPTION,
|
|
23
|
+
c = COPY_CLIENT_FILES_OPTION;
|
|
26
24
|
|
|
27
25
|
module.exports = {
|
|
28
26
|
h,
|
|
@@ -33,6 +31,5 @@ module.exports = {
|
|
|
33
31
|
f,
|
|
34
32
|
s,
|
|
35
33
|
i,
|
|
36
|
-
c
|
|
37
|
-
o
|
|
34
|
+
c
|
|
38
35
|
};
|
package/bin/action/help.js
CHANGED
|
@@ -11,6 +11,10 @@ Commands:
|
|
|
11
11
|
|
|
12
12
|
version Show the version
|
|
13
13
|
|
|
14
|
+
server Run a server to view the output file
|
|
15
|
+
|
|
16
|
+
initialise Create a configuration file
|
|
17
|
+
|
|
14
18
|
[publish] Publish the input Markdown file to the output HTML file
|
|
15
19
|
|
|
16
20
|
Options:
|
|
@@ -23,18 +27,16 @@ Options:
|
|
|
23
27
|
|
|
24
28
|
--watch|-w Watch for changes to the client file and in the output directory
|
|
25
29
|
|
|
30
|
+
--server|-s Run a server to view the output file
|
|
31
|
+
|
|
26
32
|
--quietly|-q Run with almost no console logging
|
|
27
33
|
|
|
28
34
|
--copy-fonts|-f Copy the fonts to a fonts folder next to the output file
|
|
29
35
|
|
|
30
|
-
--
|
|
31
|
-
|
|
32
|
-
--input-file-path|-i The input file path, the default being 'default.md'
|
|
36
|
+
--input-file-name|-i The input file name, the default being 'default.md'
|
|
33
37
|
|
|
34
38
|
--copy-client-files|-c Copy the bundled client files next to the output file
|
|
35
39
|
|
|
36
|
-
--output-directory-path|-o The output directory path. The default is the current directory
|
|
37
|
-
|
|
38
40
|
Further information:
|
|
39
41
|
|
|
40
42
|
Please see the readme file on GitHub:
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const { checkConfigurationFileExists, createConfigurationFile } = require("../configuration"),
|
|
4
|
+
{ FAILED_INITIALISE_MESSAGE, SUCCESSFUL_INITIALISE_MESSAGE } = require("../messages");
|
|
5
|
+
|
|
6
|
+
function initialiseAction() {
|
|
7
|
+
let success;
|
|
8
|
+
|
|
9
|
+
const configurationFileExists = checkConfigurationFileExists();
|
|
10
|
+
|
|
11
|
+
if (configurationFileExists) {
|
|
12
|
+
success = false;
|
|
13
|
+
} else {
|
|
14
|
+
createConfigurationFile();
|
|
15
|
+
|
|
16
|
+
success = true;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const message = success ?
|
|
20
|
+
SUCCESSFUL_INITIALISE_MESSAGE :
|
|
21
|
+
FAILED_INITIALISE_MESSAGE;
|
|
22
|
+
|
|
23
|
+
console.log(message);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
module.exports = initialiseAction;
|
package/bin/action/publish.js
CHANGED
|
@@ -1,24 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
const watchOperation = require("../operation/watch"),
|
|
4
|
-
serverOperation = require("../operation/server"),
|
|
5
|
-
copyHTMLOperation = require("../operation/copyHTML"),
|
|
6
4
|
copyFontsOperation = require("../operation/copyFonts"),
|
|
7
5
|
markdownHTMLOperation = require("../operation/markdownHTML"),
|
|
6
|
+
copyClientHTMLOperation = require("../operation/copyClientHTML"),
|
|
8
7
|
copyClientFilesOperation = require("../operation/copyClientFiles"),
|
|
9
8
|
markdownStylesCSSOperation = require("../operation/markdownStylesCSS");
|
|
10
9
|
|
|
11
10
|
const { executeOperations } = require("../utilities/operation"),
|
|
12
11
|
{ SUCCESSFUL_PUBLISH_MESSAGE, FAILED_PUBLISH_MESSAGE } = require("../messages");
|
|
13
12
|
|
|
14
|
-
function publishAction(port, watch, quietly, copyFonts,
|
|
13
|
+
function publishAction(port, watch, quietly, copyFonts, inputFileName, copyClientFiles, projectDirectoryName) {
|
|
15
14
|
const operations = [
|
|
16
15
|
markdownHTMLOperation,
|
|
17
16
|
markdownStylesCSSOperation,
|
|
18
17
|
copyClientFilesOperation,
|
|
18
|
+
copyClientHTMLOperation,
|
|
19
19
|
copyFontsOperation,
|
|
20
|
-
copyHTMLOperation,
|
|
21
|
-
serverOperation,
|
|
22
20
|
watchOperation
|
|
23
21
|
],
|
|
24
22
|
context = {
|
|
@@ -26,10 +24,9 @@ function publishAction(port, watch, quietly, copyFonts, startServer, inputFilePa
|
|
|
26
24
|
watch,
|
|
27
25
|
quietly,
|
|
28
26
|
copyFonts,
|
|
29
|
-
|
|
30
|
-
inputFilePath,
|
|
27
|
+
inputFileName,
|
|
31
28
|
copyClientFiles,
|
|
32
|
-
|
|
29
|
+
projectDirectoryName
|
|
33
30
|
};
|
|
34
31
|
|
|
35
32
|
executeOperations(operations, (completed) => {
|
package/bin/action/server.js
CHANGED
|
@@ -6,7 +6,7 @@ const watchOperation = require("../operation/watch"),
|
|
|
6
6
|
const { executeOperations } = require("../utilities/operation"),
|
|
7
7
|
{ SUCCESSFUL_SERVER_MESSAGE, FAILED_SERVER_MESSAGE } = require("../messages");
|
|
8
8
|
|
|
9
|
-
function serverAction(port, watch, quietly,
|
|
9
|
+
function serverAction(port, watch, quietly, projectDirectoryName) {
|
|
10
10
|
const operations = [
|
|
11
11
|
serverOperation,
|
|
12
12
|
watchOperation
|
|
@@ -15,8 +15,7 @@ function serverAction(port, watch, quietly, startServer, outputDirectoryPath) {
|
|
|
15
15
|
port,
|
|
16
16
|
watch,
|
|
17
17
|
quietly,
|
|
18
|
-
|
|
19
|
-
outputDirectoryPath
|
|
18
|
+
projectDirectoryName
|
|
20
19
|
};
|
|
21
20
|
|
|
22
21
|
executeOperations(operations, (completed) => {
|
package/bin/commands.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
const HELP_COMMAND = "help",
|
|
4
|
+
SERVER_COMMAND = "server",
|
|
4
5
|
VERSION_COMMAND = "version",
|
|
5
6
|
PUBLISH_COMMAND = 'publish',
|
|
6
|
-
|
|
7
|
+
INITIALISE_COMMAND = 'initialise';
|
|
7
8
|
|
|
8
9
|
module.exports = {
|
|
9
10
|
HELP_COMMAND,
|
|
11
|
+
SERVER_COMMAND,
|
|
10
12
|
VERSION_COMMAND,
|
|
11
13
|
PUBLISH_COMMAND,
|
|
12
|
-
|
|
14
|
+
INITIALISE_COMMAND
|
|
13
15
|
};
|
package/bin/configure.js
CHANGED
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
const { pathUtilities } = require("necessary");
|
|
4
4
|
|
|
5
5
|
const { DOUBLE_DOTS } = require("./constants"),
|
|
6
|
-
{ DEFAULT_HELP, DEFAULT_VERSION } = require("./defaults"),
|
|
7
|
-
{
|
|
8
|
-
{
|
|
6
|
+
{ DEFAULT_HELP, DEFAULT_VERSION, DEFAULT_SERVER } = require("./defaults"),
|
|
7
|
+
{ migrateConfigurationFile, checkConfigurationFileExists } = require("./configuration"),
|
|
8
|
+
{ HELP_COMMAND, VERSION_COMMAND, PUBLISH_COMMAND, SERVER_COMMAND, INITIALISE_COMMAND } = require("./commands");
|
|
9
9
|
|
|
10
10
|
const { bottommostNameFromPath } = pathUtilities;
|
|
11
11
|
|
|
12
12
|
function configure(command, argument, options, main) {
|
|
13
13
|
let configurationFileExists;
|
|
14
14
|
|
|
15
|
-
const { help = DEFAULT_HELP, version = DEFAULT_VERSION } = options;
|
|
15
|
+
const { help = DEFAULT_HELP, version = DEFAULT_VERSION, server = DEFAULT_SERVER } = options;
|
|
16
16
|
|
|
17
17
|
if (false) {
|
|
18
18
|
///
|
|
@@ -20,6 +20,8 @@ function configure(command, argument, options, main) {
|
|
|
20
20
|
command = HELP_COMMAND;
|
|
21
21
|
} else if (version) {
|
|
22
22
|
command = VERSION_COMMAND;
|
|
23
|
+
}else if (server) {
|
|
24
|
+
command = SERVER_COMMAND;
|
|
23
25
|
}
|
|
24
26
|
|
|
25
27
|
if ((command === HELP_COMMAND) || (command === VERSION_COMMAND)) {
|
|
@@ -30,27 +32,31 @@ function configure(command, argument, options, main) {
|
|
|
30
32
|
|
|
31
33
|
configurationFileExists = checkConfigurationFileExists();
|
|
32
34
|
|
|
33
|
-
if (
|
|
34
|
-
|
|
35
|
-
const currentWorkingDirectoryPath = process.cwd(); ///
|
|
35
|
+
if (!configurationFileExists) {
|
|
36
|
+
const currentWorkingDirectoryPath = process.cwd(); ///
|
|
36
37
|
|
|
37
|
-
|
|
38
|
+
process.chdir(DOUBLE_DOTS);
|
|
38
39
|
|
|
39
|
-
|
|
40
|
+
const oldCurrentWorkingDirectoryPath = currentWorkingDirectoryPath; ///
|
|
40
41
|
|
|
41
|
-
|
|
42
|
+
configurationFileExists = checkConfigurationFileExists();
|
|
42
43
|
|
|
43
|
-
|
|
44
|
-
|
|
44
|
+
if (configurationFileExists) {
|
|
45
|
+
const bottommostOldCurrentWorkingDirectoryName = bottommostNameFromPath(oldCurrentWorkingDirectoryPath);
|
|
45
46
|
|
|
46
|
-
|
|
47
|
+
argument = bottommostOldCurrentWorkingDirectoryName; ///
|
|
47
48
|
|
|
49
|
+
if (command === null) {
|
|
48
50
|
command = PUBLISH_COMMAND; ///
|
|
49
51
|
}
|
|
52
|
+
} else {
|
|
53
|
+
process.chdir(oldCurrentWorkingDirectoryPath);
|
|
50
54
|
}
|
|
51
55
|
}
|
|
52
56
|
|
|
53
|
-
|
|
57
|
+
if (command !== INITIALISE_COMMAND) {
|
|
58
|
+
migrateConfigurationFile();
|
|
59
|
+
}
|
|
54
60
|
|
|
55
61
|
main(command, argument, options);
|
|
56
62
|
}
|
package/bin/constants.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
const FONT = "font",
|
|
4
4
|
ERROR = "error",
|
|
5
|
-
PERIOD = ".",
|
|
6
5
|
HIGHMARK = "highmark",
|
|
7
6
|
DOUBLE_DOTS = "..",
|
|
8
7
|
HIGHMARK_CLI = "Highmark-CLI",
|
|
@@ -13,7 +12,6 @@ const FONT = "font",
|
|
|
13
12
|
module.exports = {
|
|
14
13
|
FONT,
|
|
15
14
|
ERROR,
|
|
16
|
-
PERIOD,
|
|
17
15
|
HIGHMARK,
|
|
18
16
|
DOUBLE_DOTS,
|
|
19
17
|
HIGHMARK_CLI,
|
package/bin/defaults.js
CHANGED
|
@@ -3,23 +3,21 @@
|
|
|
3
3
|
const DEFAULT_HELP = false,
|
|
4
4
|
DEFAULT_PORT = 8888,
|
|
5
5
|
DEFAULT_WATCH = false,
|
|
6
|
+
DEFAULT_SERVER = false,
|
|
6
7
|
DEFAULT_QUIETLY = false,
|
|
7
8
|
DEFAULT_VERSION = false,
|
|
8
9
|
DEFAULT_COPY_FONTS = false,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
DEFAULT_COPY_CLIENT_FILES = false,
|
|
12
|
-
DEFAULT_OUTPUT_DIRECTORY_PATH = ".";
|
|
10
|
+
DEFAULT_INPUT_FILE_NAME = "default.md",
|
|
11
|
+
DEFAULT_COPY_CLIENT_FILES = false;
|
|
13
12
|
|
|
14
13
|
module.exports = {
|
|
15
14
|
DEFAULT_HELP,
|
|
16
15
|
DEFAULT_PORT,
|
|
17
16
|
DEFAULT_WATCH,
|
|
17
|
+
DEFAULT_SERVER,
|
|
18
18
|
DEFAULT_QUIETLY,
|
|
19
19
|
DEFAULT_VERSION,
|
|
20
20
|
DEFAULT_COPY_FONTS,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
DEFAULT_COPY_CLIENT_FILES,
|
|
24
|
-
DEFAULT_OUTPUT_DIRECTORY_PATH
|
|
21
|
+
DEFAULT_INPUT_FILE_NAME,
|
|
22
|
+
DEFAULT_COPY_CLIENT_FILES
|
|
25
23
|
};
|
package/bin/main.js
CHANGED
|
@@ -3,35 +3,30 @@
|
|
|
3
3
|
const helpAction = require("./action/help"),
|
|
4
4
|
serverAction = require("./action/server"),
|
|
5
5
|
versionAction = require("./action/version"),
|
|
6
|
-
publishAction = require("./action/publish")
|
|
6
|
+
publishAction = require("./action/publish"),
|
|
7
|
+
initialiseAction = require("./action/initialise");
|
|
7
8
|
|
|
8
9
|
const { NO_COMMAND_GIVEN_MESSAGE, COMMAND_NOT_RECOGNISED_MESSAGE } = require("./messages"),
|
|
9
|
-
{ HELP_COMMAND, VERSION_COMMAND, PUBLISH_COMMAND,
|
|
10
|
+
{ HELP_COMMAND, SERVER_COMMAND, VERSION_COMMAND, PUBLISH_COMMAND, INITIALISE_COMMAND } = require("./commands"),
|
|
10
11
|
{ DEFAULT_PORT,
|
|
11
12
|
DEFAULT_WATCH,
|
|
12
13
|
DEFAULT_QUIETLY,
|
|
13
14
|
DEFAULT_COPY_FONTS,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
DEFAULT_COPY_CLIENT_FILES,
|
|
17
|
-
DEFAULT_OUTPUT_DIRECTORY_PATH } = require("./defaults");
|
|
15
|
+
DEFAULT_INPUT_FILE_NAME,
|
|
16
|
+
DEFAULT_COPY_CLIENT_FILES } = require("./defaults");
|
|
18
17
|
|
|
19
18
|
function main(command, argument, options) {
|
|
20
19
|
const { port = DEFAULT_PORT,
|
|
21
20
|
watch = DEFAULT_WATCH,
|
|
22
21
|
quietly = DEFAULT_QUIETLY,
|
|
23
22
|
copyFonts = DEFAULT_COPY_FONTS,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
copyClientFiles = DEFAULT_COPY_CLIENT_FILES,
|
|
27
|
-
outputDirectoryPath = DEFAULT_OUTPUT_DIRECTORY_PATH } = options;
|
|
23
|
+
inputFileName = DEFAULT_INPUT_FILE_NAME,
|
|
24
|
+
copyClientFiles = DEFAULT_COPY_CLIENT_FILES } = options;
|
|
28
25
|
|
|
29
26
|
switch (command) {
|
|
30
27
|
case null: {
|
|
31
28
|
console.log(NO_COMMAND_GIVEN_MESSAGE);
|
|
32
29
|
|
|
33
|
-
process.exit(1);
|
|
34
|
-
|
|
35
30
|
break;
|
|
36
31
|
}
|
|
37
32
|
|
|
@@ -41,6 +36,14 @@ function main(command, argument, options) {
|
|
|
41
36
|
break;
|
|
42
37
|
}
|
|
43
38
|
|
|
39
|
+
case SERVER_COMMAND: {
|
|
40
|
+
const projectDirectoryName = argument; ///
|
|
41
|
+
|
|
42
|
+
serverAction(port, watch, quietly, projectDirectoryName);
|
|
43
|
+
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
46
|
+
|
|
44
47
|
case VERSION_COMMAND: {
|
|
45
48
|
versionAction();
|
|
46
49
|
|
|
@@ -48,15 +51,15 @@ function main(command, argument, options) {
|
|
|
48
51
|
}
|
|
49
52
|
|
|
50
53
|
case PUBLISH_COMMAND: {
|
|
51
|
-
|
|
54
|
+
const projectDirectoryName = argument; ///
|
|
55
|
+
|
|
56
|
+
publishAction(port, watch, quietly, copyFonts, inputFileName, copyClientFiles, projectDirectoryName);
|
|
52
57
|
|
|
53
58
|
break;
|
|
54
59
|
}
|
|
55
60
|
|
|
56
|
-
case
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
serverAction(port, watch, quietly, startServer, outputDirectoryPath);
|
|
61
|
+
case INITIALISE_COMMAND: {
|
|
62
|
+
initialiseAction();
|
|
60
63
|
|
|
61
64
|
break;
|
|
62
65
|
}
|
|
@@ -64,8 +67,6 @@ function main(command, argument, options) {
|
|
|
64
67
|
default: {
|
|
65
68
|
console.log(COMMAND_NOT_RECOGNISED_MESSAGE);
|
|
66
69
|
|
|
67
|
-
process.exit(1);
|
|
68
|
-
|
|
69
70
|
break;
|
|
70
71
|
}
|
|
71
72
|
}
|
package/bin/messages.js
CHANGED
|
@@ -4,8 +4,10 @@ const NO_COMMAND_GIVEN_MESSAGE = "No command has been given.",
|
|
|
4
4
|
COMMAND_NOT_RECOGNISED_MESSAGE = "The command is not recognised.",
|
|
5
5
|
FAILED_SERVER_MESSAGE = "Failed to serve.",
|
|
6
6
|
FAILED_PUBLISH_MESSAGE = "Failed to publish.",
|
|
7
|
+
FAILED_INITIALISE_MESSAGE = "Failed to create a configuration file because one is already present.",
|
|
7
8
|
SUCCESSFUL_SERVER_MESSAGE = "Served successfully.",
|
|
8
9
|
SUCCESSFUL_PUBLISH_MESSAGE = "Published successfully.",
|
|
10
|
+
SUCCESSFUL_INITIALISE_MESSAGE = "The configuration file has been created successfully.",
|
|
9
11
|
UNABLE_TO_COPY_FILE_MESSAGE = "Unable to copy the file.",
|
|
10
12
|
UNABLE_TO_READ_FILE_MESSAGE = "Unable to read the file.",
|
|
11
13
|
UNABLE_TO_WRITE_FILE_MESSAGE = "Unable to write the file.",
|
|
@@ -22,8 +24,10 @@ module.exports = {
|
|
|
22
24
|
COMMAND_NOT_RECOGNISED_MESSAGE,
|
|
23
25
|
FAILED_SERVER_MESSAGE,
|
|
24
26
|
FAILED_PUBLISH_MESSAGE,
|
|
27
|
+
FAILED_INITIALISE_MESSAGE,
|
|
25
28
|
SUCCESSFUL_SERVER_MESSAGE,
|
|
26
29
|
SUCCESSFUL_PUBLISH_MESSAGE,
|
|
30
|
+
SUCCESSFUL_INITIALISE_MESSAGE,
|
|
27
31
|
UNABLE_TO_COPY_FILE_MESSAGE,
|
|
28
32
|
UNABLE_TO_READ_FILE_MESSAGE,
|
|
29
33
|
UNABLE_TO_WRITE_FILE_MESSAGE,
|
|
@@ -6,10 +6,10 @@ function copyClientFilesOperation(proceed, abort, context) {
|
|
|
6
6
|
const { copyClientFiles } = context;
|
|
7
7
|
|
|
8
8
|
if (copyClientFiles) {
|
|
9
|
-
const {
|
|
10
|
-
targetDirectoryPath =
|
|
9
|
+
const { projectDirectoryName } = context,
|
|
10
|
+
targetDirectoryPath = projectDirectoryName; ///
|
|
11
11
|
|
|
12
|
-
copyClientFilesAsync(
|
|
12
|
+
copyClientFilesAsync(targetDirectoryPath);
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
proceed();
|
|
@@ -16,8 +16,8 @@ function copyFontsOperation(proceed, abort, context) {
|
|
|
16
16
|
return;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
const {
|
|
20
|
-
fontDirectoryPath = concatenatePaths(
|
|
19
|
+
const { projectDirectoryPath } = context,
|
|
20
|
+
fontDirectoryPath = concatenatePaths(projectDirectoryPath, FONT);
|
|
21
21
|
|
|
22
22
|
copyFontsAsync(fontDirectoryPath);
|
|
23
23
|
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const { createHTML: createClientHTML } = require("highmark-client");
|
|
4
|
+
|
|
5
|
+
function createClientHTMLOperation(proceed, abort, context) {
|
|
6
|
+
const { markdownHTML, markdownStylesCSS, projectDirectoryName } = context,
|
|
7
|
+
targetDirectoryPath = projectDirectoryName, ///
|
|
8
|
+
noClient = true;
|
|
9
|
+
|
|
10
|
+
createClientHTML(markdownHTML, markdownStylesCSS, targetDirectoryPath, noClient);
|
|
11
|
+
|
|
12
|
+
proceed();
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
module.exports = createClientHTMLOperation;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
const { pathUtilities } = require("necessary");
|
|
4
|
+
|
|
3
5
|
const importer = require("../importer");
|
|
4
6
|
|
|
5
7
|
const { readFile } = require("../utilities/fileSystem"),
|
|
@@ -7,8 +9,11 @@ const { readFile } = require("../utilities/fileSystem"),
|
|
|
7
9
|
{ nodeFromTokens, tokensFromContent } = require("../utilities/markdown"),
|
|
8
10
|
{ UNABLE_TO_CONVERT_MARKDOWN_TO_HTML_MESSAGE } = require("../messages");
|
|
9
11
|
|
|
12
|
+
const { concatenatePaths } = pathUtilities;
|
|
13
|
+
|
|
10
14
|
function markdownHTMLOperation(proceed, abort, context) {
|
|
11
|
-
const {
|
|
15
|
+
const { inputFileName, projectDirectoryName } = context,
|
|
16
|
+
inputFilePath = concatenatePaths(projectDirectoryName, inputFileName),
|
|
12
17
|
filePath = inputFilePath, ///
|
|
13
18
|
content = readFile(filePath);
|
|
14
19
|
|
|
@@ -5,10 +5,9 @@ const { constants } = require("highmark-client"),
|
|
|
5
5
|
{ filePathUtilities } = require("occam-entities"),
|
|
6
6
|
{ cssUtilities, defaultMarkdownStyle } = require("highmark-markdown")
|
|
7
7
|
|
|
8
|
-
const {
|
|
9
|
-
{
|
|
10
|
-
{
|
|
11
|
-
{ DIVS_SELECTOR_STRING } = require("../constants");
|
|
8
|
+
const { DIVS_SELECTOR_STRING } = require("../constants"),
|
|
9
|
+
{ classNameFromFilePath } = require("../utilities/division"),
|
|
10
|
+
{ readFile, readDirectory } = require("../utilities/fileSystem");
|
|
12
11
|
|
|
13
12
|
const { WEB_MEDIA_TYPE_NAME } = mediaTypeNames,
|
|
14
13
|
{ DIVS_SELECTOR_STRING: CLIENT_DIVS_SELECTOR_STRING } = constants,
|
|
@@ -16,11 +15,11 @@ const { WEB_MEDIA_TYPE_NAME } = mediaTypeNames,
|
|
|
16
15
|
{ isFilePathMarkdownStyleFilePath, isFilePathDefaultMarkdownStyleFilePath } = filePathUtilities;
|
|
17
16
|
|
|
18
17
|
function markdownStylesCSSOperation(proceed, abort, context) {
|
|
19
|
-
const {
|
|
20
|
-
|
|
18
|
+
const { copyClientFiles, projectDirectoryName } = context,
|
|
19
|
+
projectDirectoryPath = projectDirectoryName, ///
|
|
21
20
|
markdownStyleFilePaths = [];
|
|
22
21
|
|
|
23
|
-
readDirectory(
|
|
22
|
+
readDirectory(projectDirectoryPath, (filePath) => {
|
|
24
23
|
const filePathMarkdownStyleFilePath = isFilePathMarkdownStyleFilePath(filePath);
|
|
25
24
|
|
|
26
25
|
if (filePathMarkdownStyleFilePath) {
|
package/bin/operation/server.js
CHANGED
|
@@ -6,22 +6,14 @@ const { ERROR } = require("../constants"),
|
|
|
6
6
|
{ UNABLE_TO_START_SERVER_MESSAGE } = require("../messages");
|
|
7
7
|
|
|
8
8
|
function serverOperation(proceed, abort, context) {
|
|
9
|
-
let { startServer } = context;
|
|
10
|
-
|
|
11
|
-
if (!startServer) {
|
|
12
|
-
proceed();
|
|
13
|
-
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
9
|
const server = express(); ///
|
|
18
10
|
|
|
19
11
|
Object.assign(context, {
|
|
20
12
|
server
|
|
21
13
|
});
|
|
22
14
|
|
|
23
|
-
const { port,
|
|
24
|
-
staticRouter = express.static(
|
|
15
|
+
const { port, projectDirectoryName } = context,
|
|
16
|
+
staticRouter = express.static(projectDirectoryName);
|
|
25
17
|
|
|
26
18
|
server.use(staticRouter);
|
|
27
19
|
|
package/bin/operation/watch.js
CHANGED
|
@@ -10,19 +10,11 @@ const { concatenatePaths } = pathUtilities,
|
|
|
10
10
|
{ INDEX_HTML_FILE_NAME } = constants;
|
|
11
11
|
|
|
12
12
|
function watchOperation(proceed, abort, context) {
|
|
13
|
-
const { startServer } = context;
|
|
14
|
-
|
|
15
|
-
if (!startServer) {
|
|
16
|
-
proceed();
|
|
17
|
-
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
13
|
const { watch } = context;
|
|
22
14
|
|
|
23
15
|
if (watch) {
|
|
24
|
-
const { server, quietly,
|
|
25
|
-
indexHTMLFilePath = concatenatePaths(
|
|
16
|
+
const { server, quietly, projectDirectoryName } = context,
|
|
17
|
+
indexHTMLFilePath = concatenatePaths(projectDirectoryName, INDEX_HTML_FILE_NAME),
|
|
26
18
|
watchPattern = indexHTMLFilePath, ///
|
|
27
19
|
liveReloadHandler = createLiveReloadHandler(watchPattern, quietly);
|
|
28
20
|
|
package/bin/options.js
CHANGED
|
@@ -3,23 +3,21 @@
|
|
|
3
3
|
const HELP_OPTION = "help",
|
|
4
4
|
PORT_OPTION = "port",
|
|
5
5
|
WATCH_OPTION = "watch",
|
|
6
|
+
SERVER_OPTION = "server",
|
|
6
7
|
VERSION_OPTION = "version",
|
|
7
8
|
QUIETLY_OPTION = "quietly",
|
|
8
9
|
COPY_FONTS_OPTION = "copy-fonts",
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
COPY_CLIENT_FILES_OPTION = "copy-client-files",
|
|
12
|
-
OUTPUT_DIRECTORY_PATH_OPTION = "output-directory-path";
|
|
10
|
+
INPUT_FILE_NAME_OPTION = "input-file-name",
|
|
11
|
+
COPY_CLIENT_FILES_OPTION = "copy-client-files";
|
|
13
12
|
|
|
14
13
|
module.exports = {
|
|
15
14
|
HELP_OPTION,
|
|
16
15
|
PORT_OPTION,
|
|
17
16
|
WATCH_OPTION,
|
|
17
|
+
SERVER_OPTION,
|
|
18
18
|
VERSION_OPTION,
|
|
19
19
|
QUIETLY_OPTION,
|
|
20
20
|
COPY_FONTS_OPTION,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
COPY_CLIENT_FILES_OPTION,
|
|
24
|
-
OUTPUT_DIRECTORY_PATH_OPTION
|
|
21
|
+
INPUT_FILE_NAME_OPTION,
|
|
22
|
+
COPY_CLIENT_FILES_OPTION
|
|
25
23
|
};
|
package/bin/utilities/path.js
CHANGED
|
@@ -1,35 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
const { pathUtilities } = require("necessary");
|
|
4
|
-
|
|
5
|
-
const { PERIOD } = require("../constants");
|
|
6
|
-
|
|
7
|
-
const { isPathName, pathWithoutBottommostNameFromPath } = pathUtilities;
|
|
8
|
-
|
|
9
3
|
function isEntryNameHiddenName(entryName) {
|
|
10
4
|
const nameHiddenName = /^\..+/.test(entryName);
|
|
11
5
|
|
|
12
6
|
return nameHiddenName;
|
|
13
7
|
}
|
|
14
8
|
|
|
15
|
-
function directoryPathFromFilePath(filePath) {
|
|
16
|
-
let directoryPath;
|
|
17
|
-
|
|
18
|
-
const path = filePath, ///
|
|
19
|
-
pathName = isPathName(path);
|
|
20
|
-
|
|
21
|
-
if (pathName) {
|
|
22
|
-
directoryPath = PERIOD;
|
|
23
|
-
} else {
|
|
24
|
-
const pathWithoutBottommostName = pathWithoutBottommostNameFromPath(path);
|
|
25
|
-
|
|
26
|
-
directoryPath = pathWithoutBottommostName; ///
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return directoryPath;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
9
|
module.exports = {
|
|
33
|
-
isEntryNameHiddenName
|
|
34
|
-
directoryPathFromFilePath
|
|
10
|
+
isEntryNameHiddenName
|
|
35
11
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "highmark-cli",
|
|
3
3
|
"author": "James Smith",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.261",
|
|
5
5
|
"license": "MIT, Anti-996",
|
|
6
6
|
"homepage": "https://github.com/djalbat/highmark-cli",
|
|
7
7
|
"description": "Highmark's LIC tool.",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"argumentative": "^2.0.28",
|
|
14
14
|
"express": "^4.19.2",
|
|
15
|
-
"highmark-client": "^0.0.
|
|
15
|
+
"highmark-client": "^0.0.78",
|
|
16
16
|
"highmark-markdown": "^0.0.355",
|
|
17
17
|
"lively-cli": "^2.0.65",
|
|
18
18
|
"necessary": "^14.0.1",
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const { copyHTML } = require("highmark-client");
|
|
4
|
-
|
|
5
|
-
function copyHTMLOperation(proceed, abort, context) {
|
|
6
|
-
const { copyClientFiles } = context;
|
|
7
|
-
|
|
8
|
-
if (copyClientFiles) {
|
|
9
|
-
proceed();
|
|
10
|
-
|
|
11
|
-
return;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const { markdownHTML, markdownStylesCSS, outputDirectoryPath } = context,
|
|
15
|
-
targetDirectoryPath = outputDirectoryPath, ///
|
|
16
|
-
noClient = true;
|
|
17
|
-
|
|
18
|
-
copyHTML(markdownHTML, markdownStylesCSS, targetDirectoryPath, noClient);
|
|
19
|
-
|
|
20
|
-
proceed();
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
module.exports = copyHTMLOperation;
|