highmark-cli 0.0.150 → 0.0.153
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/action/publish.js +3 -1
- package/bin/action/server.js +4 -2
- package/bin/main.js +21 -5
- package/bin/operation/copyClient.js +11 -20
- package/bin/operation/server.js +9 -11
- package/bin/operation/watch.js +35 -0
- package/bin/utilities/client.js +38 -0
- package/package.json +1 -1
- package/bin/handler/liveReload.js +0 -18
- package/bin/router/static.js +0 -17
package/bin/action/publish.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
const htmlOperation = require("../operation/html"),
|
|
4
|
+
watchOperation = require("../operation/watch"),
|
|
4
5
|
serverOperation = require("../operation/server"),
|
|
5
6
|
copyFontsOperation = require("../operation/copyFonts"),
|
|
6
7
|
copyClientOperation = require("../operation/copyClient"),
|
|
@@ -19,7 +20,8 @@ function publishAction(port, watch, server, quietly, copyFonts, copyClient, inpu
|
|
|
19
20
|
copyClientOperation,
|
|
20
21
|
copyFontsOperation,
|
|
21
22
|
htmlOperation,
|
|
22
|
-
serverOperation
|
|
23
|
+
serverOperation,
|
|
24
|
+
watchOperation
|
|
23
25
|
],
|
|
24
26
|
context = {
|
|
25
27
|
port,
|
package/bin/action/server.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const watchOperation = require("../operation/watch"),
|
|
4
|
+
serverOperation = require("../operation/server");
|
|
4
5
|
|
|
5
6
|
const { executeOperations } = require("../utilities/operation"),
|
|
6
7
|
{ SUCCESSFUL_SERVER_MESSAGE, FAILED_SERVER_MESSAGE } = require("../messages");
|
|
7
8
|
|
|
8
9
|
function serverAction(port, watch, server, quietly, outputFilePath) {
|
|
9
10
|
const operations = [
|
|
10
|
-
serverOperation
|
|
11
|
+
serverOperation,
|
|
12
|
+
watchOperation
|
|
11
13
|
],
|
|
12
14
|
context = {
|
|
13
15
|
port,
|
package/bin/main.js
CHANGED
|
@@ -47,15 +47,31 @@ function main(command, argument, options) {
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
switch (command) {
|
|
50
|
-
case HELP_COMMAND:
|
|
51
|
-
|
|
52
|
-
case VERSION_COMMAND: versionAction(); break;
|
|
53
|
-
case PUBLISH_COMMAND: publishAction(port, watch, server, quietly, copyFonts, copyClient, inputFilePath, outputFilePath, templateFilePath); break;
|
|
50
|
+
case HELP_COMMAND: {
|
|
51
|
+
helpAction();
|
|
54
52
|
|
|
55
|
-
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
case SERVER_COMMAND: {
|
|
57
|
+
const server = true;
|
|
58
|
+
|
|
59
|
+
serverAction(port, watch, server, quietly, outputFilePath);
|
|
60
|
+
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
case VERSION_COMMAND: {
|
|
65
|
+
versionAction();
|
|
66
|
+
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
default: {
|
|
56
71
|
publishAction(port, watch, server, quietly, copyFonts, copyClient, inputFilePath, outputFilePath, templateFilePath);
|
|
57
72
|
|
|
58
73
|
break;
|
|
74
|
+
}
|
|
59
75
|
}
|
|
60
76
|
}
|
|
61
77
|
|
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
const { watch: watchFile } = require("lively-cli")
|
|
4
|
-
{ pathUtilities, packageUtilities } = require("necessary");
|
|
3
|
+
const { watch: watchFile } = require("lively-cli");
|
|
5
4
|
|
|
6
|
-
const {
|
|
7
|
-
{
|
|
8
|
-
{ DEFER_DELAY, CLIENT_FILE_NAME } = require("../constants");
|
|
9
|
-
|
|
10
|
-
const { getPackagePath } = packageUtilities,
|
|
11
|
-
{ concatenatePaths } = pathUtilities;
|
|
5
|
+
const { DEFER_DELAY } = require("../constants"),
|
|
6
|
+
{ copyClientFile: copyClientFileEx, getClientSourceFilePath } = require("../utilities/client");
|
|
12
7
|
|
|
13
8
|
function copyClientOperation(proceed, abort, context) {
|
|
14
9
|
const { copyClient } = context;
|
|
@@ -19,31 +14,27 @@ function copyClientOperation(proceed, abort, context) {
|
|
|
19
14
|
return;
|
|
20
15
|
}
|
|
21
16
|
|
|
22
|
-
|
|
23
|
-
packagePath = getPackagePath(),
|
|
24
|
-
outputDirectoryPath = directoryPathFromFilePath(outputFilePath),
|
|
25
|
-
sourceFilePath = concatenatePaths(packagePath, CLIENT_FILE_NAME),
|
|
26
|
-
targetFilePath = concatenatePaths(outputDirectoryPath, CLIENT_FILE_NAME);
|
|
27
|
-
|
|
28
|
-
copyFile(sourceFilePath, targetFilePath);
|
|
17
|
+
copyClientFile();
|
|
29
18
|
|
|
30
|
-
|
|
19
|
+
let { server } = context;
|
|
31
20
|
|
|
32
|
-
if (!
|
|
21
|
+
if (!server) {
|
|
33
22
|
proceed();
|
|
34
23
|
|
|
35
24
|
return;
|
|
36
25
|
}
|
|
37
26
|
|
|
38
|
-
const
|
|
39
|
-
|
|
27
|
+
const { quietly } = context,
|
|
28
|
+
clientSSourceFilePath = getClientSourceFilePath(context),
|
|
29
|
+
watchPattern = clientSSourceFilePath, ///
|
|
30
|
+
registerHandler = watchFile(watchPattern, quietly);
|
|
40
31
|
|
|
41
32
|
registerHandler(copyClientFile);
|
|
42
33
|
|
|
43
34
|
proceed();
|
|
44
35
|
|
|
45
36
|
function copyClientFile() {
|
|
46
|
-
|
|
37
|
+
copyClientFileEx(context);
|
|
47
38
|
|
|
48
39
|
defer(() => {
|
|
49
40
|
registerHandler(copyClientFile);
|
package/bin/operation/server.js
CHANGED
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
const express = require("express");
|
|
4
4
|
|
|
5
|
-
const {
|
|
6
|
-
{
|
|
7
|
-
{ ERROR, LIVE_RELOAD_PATH } = require("../constants"),
|
|
5
|
+
const { ERROR } = require("../constants"),
|
|
6
|
+
{ directoryPathFromFilePath } = require("../utilities/path"),
|
|
8
7
|
{ UNABLE_TO_START_SERVER_MESSAGE } = require("../messages");
|
|
9
8
|
|
|
10
9
|
function serverOperation(proceed, abort, context) {
|
|
@@ -18,16 +17,15 @@ function serverOperation(proceed, abort, context) {
|
|
|
18
17
|
|
|
19
18
|
server = express(); ///
|
|
20
19
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
server.use(staticRouter);
|
|
20
|
+
Object.assign(context, {
|
|
21
|
+
server
|
|
22
|
+
});
|
|
25
23
|
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
const { port, outputFilePath } = context,
|
|
25
|
+
outputDirectoryPath = directoryPathFromFilePath(outputFilePath),
|
|
26
|
+
staticRouter = express.static(outputDirectoryPath);
|
|
28
27
|
|
|
29
|
-
|
|
30
|
-
}
|
|
28
|
+
server.use(staticRouter);
|
|
31
29
|
|
|
32
30
|
const listener = server.listen(port, () => {
|
|
33
31
|
console.log(`Server listening on port ${port}...`);
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const { createLiveReloadHandler } = require("lively-cli");
|
|
4
|
+
|
|
5
|
+
const { LIVE_RELOAD_PATH } = require("../constants"),
|
|
6
|
+
{ directoryPathFromFilePath } = require("../utilities/path");
|
|
7
|
+
|
|
8
|
+
function watchOperation(proceed, abort, context) {
|
|
9
|
+
const { watch } = context;
|
|
10
|
+
|
|
11
|
+
if (!watch) {
|
|
12
|
+
proceed();
|
|
13
|
+
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const { server = null } = context;
|
|
18
|
+
|
|
19
|
+
if (server === null) {
|
|
20
|
+
proceed();
|
|
21
|
+
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const { quietly, outputFilePath } = context,
|
|
26
|
+
outputDirectoryPath = directoryPathFromFilePath(outputFilePath),
|
|
27
|
+
watchPattern = outputDirectoryPath, ///
|
|
28
|
+
liveReloadHandler = createLiveReloadHandler(watchPattern, quietly);
|
|
29
|
+
|
|
30
|
+
server.get(LIVE_RELOAD_PATH, liveReloadHandler);
|
|
31
|
+
|
|
32
|
+
proceed();
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
module.exports = watchOperation;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const { pathUtilities, packageUtilities } = require("necessary");
|
|
4
|
+
|
|
5
|
+
const { copyFile } = require("../utilities/fileSystem"),
|
|
6
|
+
{ CLIENT_FILE_NAME } = require("../constants"),
|
|
7
|
+
{ directoryPathFromFilePath } = require("../utilities/path");
|
|
8
|
+
|
|
9
|
+
const { getPackagePath } = packageUtilities,
|
|
10
|
+
{ concatenatePaths } = pathUtilities;
|
|
11
|
+
|
|
12
|
+
function copyClientFile(context) {
|
|
13
|
+
const clientTargetFilePath = getClientTargetFilePath(context),
|
|
14
|
+
clientSSourceFilePath = getClientSourceFilePath(context);
|
|
15
|
+
|
|
16
|
+
copyFile(clientSSourceFilePath, clientTargetFilePath);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function getClientTargetFilePath(context) {
|
|
20
|
+
const { outputFilePath } = context,
|
|
21
|
+
outputDirectoryPath = directoryPathFromFilePath(outputFilePath),
|
|
22
|
+
clientTargetFilePath = concatenatePaths(outputDirectoryPath, CLIENT_FILE_NAME);
|
|
23
|
+
|
|
24
|
+
return clientTargetFilePath;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function getClientSourceFilePath(context) {
|
|
28
|
+
const packagePath = getPackagePath(),
|
|
29
|
+
clientSSourceFilePath = concatenatePaths(packagePath, CLIENT_FILE_NAME);
|
|
30
|
+
|
|
31
|
+
return clientSSourceFilePath;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
module.exports = {
|
|
35
|
+
copyClientFile,
|
|
36
|
+
getClientTargetFilePath,
|
|
37
|
+
getClientSourceFilePath
|
|
38
|
+
};
|
package/package.json
CHANGED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const { createLiveReloadHandler: createLiveReloadHandlerEx } = require("lively-cli");
|
|
4
|
-
|
|
5
|
-
const { directoryPathFromFilePath } = require("../utilities/path");
|
|
6
|
-
|
|
7
|
-
function createLiveReloadHandler(context) {
|
|
8
|
-
const { quietly, outputFilePath } = context,
|
|
9
|
-
outputDirectoryPath = directoryPathFromFilePath(outputFilePath),
|
|
10
|
-
watchPattern = outputDirectoryPath, ///
|
|
11
|
-
liveReloadHandler = createLiveReloadHandlerEx(watchPattern, quietly);
|
|
12
|
-
|
|
13
|
-
return liveReloadHandler;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
module.exports = {
|
|
17
|
-
createLiveReloadHandler
|
|
18
|
-
};
|
package/bin/router/static.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const express = require("express");
|
|
4
|
-
|
|
5
|
-
const { directoryPathFromFilePath } = require("../utilities/path");
|
|
6
|
-
|
|
7
|
-
function createStaticRouter(context) {
|
|
8
|
-
const { outputFilePath } = context,
|
|
9
|
-
outputDirectoryPath = directoryPathFromFilePath(outputFilePath),
|
|
10
|
-
staticRouter = express.static(outputDirectoryPath);
|
|
11
|
-
|
|
12
|
-
return staticRouter;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
module.exports = {
|
|
16
|
-
createStaticRouter
|
|
17
|
-
};
|