Compare commits
26 Commits
Author | SHA1 | Date | |
---|---|---|---|
119f20915e | |||
ce1fa6640b | |||
8957e03445 | |||
3df86bee10 | |||
65326710ab | |||
2e174c9f55 | |||
9e42910456 | |||
ff85cee528 | |||
2a9fff0185 | |||
67689d79bd | |||
f8c851de97 | |||
09e9d8c190 | |||
80f5df3317 | |||
6cf3ff6e83 | |||
ceb30c7ac2 | |||
0df90eec5d | |||
261031a49c | |||
615cc6aa7c | |||
c9aa7fed48 | |||
44d30fc4d6 | |||
dd5e1a978d | |||
692602b463 | |||
382b694027 | |||
de831b086f | |||
01c7d2e482 | |||
49ebf991a2 |
220
package-lock.json
generated
220
package-lock.json
generated
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@pushrocks/smartdaemon",
|
||||
"version": "1.0.5",
|
||||
"version": "1.0.18",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
@ -93,24 +93,17 @@
|
||||
}
|
||||
},
|
||||
"@pushrocks/lik": {
|
||||
"version": "3.0.5",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2flik/-/lik-3.0.5.tgz",
|
||||
"integrity": "sha512-pc5Nq0WUysS34qPpyiZXiX254kL3vyRVbt3D36Q5QU+eHhxAThHofSzgOdyVHUZU2WFoaMlKowIVsyUFzIkfdw==",
|
||||
"version": "3.0.11",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2flik/-/lik-3.0.11.tgz",
|
||||
"integrity": "sha512-SDKRPj9+xBTqozlDPcA7O6BcccM1Tw/sXPVP+OnhNxCubDZ/L2kGNpPpqm43NJUoNxSSo5wdBw4N7MAFYCGdVg==",
|
||||
"requires": {
|
||||
"@pushrocks/smartdelay": "^2.0.2",
|
||||
"@pushrocks/smartpromise": "^2.0.5",
|
||||
"@pushrocks/smartdelay": "^2.0.3",
|
||||
"@pushrocks/smartpromise": "^3.0.2",
|
||||
"@pushrocks/smartrx": "^2.0.3",
|
||||
"@pushrocks/smarttime": "^3.0.5",
|
||||
"@pushrocks/smarttime": "^3.0.12",
|
||||
"@types/minimatch": "^3.0.3",
|
||||
"minimatch": "^3.0.4",
|
||||
"symbol-tree": "^3.2.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@pushrocks/smartpromise": {
|
||||
"version": "2.0.5",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartpromise/-/smartpromise-2.0.5.tgz",
|
||||
"integrity": "sha512-9j/chLtIiNkR0MDw7Mpxg9slxAVvAQwUZuiaPYX5KpHdKxQaHLI1VZ8IN0vPhwlfgNO4i4vGXV0wB8BvSDj03g=="
|
||||
}
|
||||
"symbol-tree": "^3.2.4"
|
||||
}
|
||||
},
|
||||
"@pushrocks/smartcli": {
|
||||
@ -187,10 +180,9 @@
|
||||
}
|
||||
},
|
||||
"@pushrocks/smartfile": {
|
||||
"version": "7.0.2",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartfile/-/smartfile-7.0.2.tgz",
|
||||
"integrity": "sha512-38l9DRalp1McEBFG+qKzBqefVQZZLPNk+uo7Ff1guy8BDxA+tATlZ6O6FuXW7M3wjFDBi245VJs+KWVKcCxBRA==",
|
||||
"dev": true,
|
||||
"version": "7.0.4",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartfile/-/smartfile-7.0.4.tgz",
|
||||
"integrity": "sha512-ym8eigWJAQhwgmuVLew3GLrk4WhV03ajapwuMWytxKSzfIW9ZqceJBX2QzOkmhFGA2bp+gc4Q2wOBy3Ffnlj+A==",
|
||||
"requires": {
|
||||
"@pushrocks/smartpath": "^4.0.1",
|
||||
"@pushrocks/smartpromise": "^3.0.2",
|
||||
@ -207,7 +199,6 @@
|
||||
"version": "5.1.0",
|
||||
"resolved": "https://verdaccio.lossless.one/@types%2ffs-extra/-/fs-extra-5.1.0.tgz",
|
||||
"integrity": "sha512-AInn5+UBFIK9FK5xc9yP5e3TQSPNNgjHByqYcj9g5elVBnDQcQL7PlO1CIRy2gWlbwK7UPYqi7vRvFA44dCmYQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/node": "*"
|
||||
}
|
||||
@ -216,7 +207,6 @@
|
||||
"version": "7.0.1",
|
||||
"resolved": "https://verdaccio.lossless.one/fs-extra/-/fs-extra-7.0.1.tgz",
|
||||
"integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"graceful-fs": "^4.1.2",
|
||||
"jsonfile": "^4.0.0",
|
||||
@ -225,6 +215,14 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"@pushrocks/smartfm": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartfm/-/smartfm-2.0.4.tgz",
|
||||
"integrity": "sha512-QYxmIGhRfnE57rTCjsDBilPTrO/3VmajDxQt5z14pxAm9CeZypyGc4N6+Ts3KT1VGbs68NzCsGOM5ZYJW0Wmfg==",
|
||||
"requires": {
|
||||
"gray-matter": "^4.0.2"
|
||||
}
|
||||
},
|
||||
"@pushrocks/smartlog": {
|
||||
"version": "2.0.19",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartlog/-/smartlog-2.0.19.tgz",
|
||||
@ -284,8 +282,7 @@
|
||||
"@pushrocks/smartpath": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartpath/-/smartpath-4.0.1.tgz",
|
||||
"integrity": "sha512-MaI0+uLQPCr2V3WGnbdgb0pWa9xkWyrP4qYcbsHIjeismGLbn9s3jmP/HIXU8LkgzRgaVb+BJxmZJHOwl32DyA==",
|
||||
"dev": true
|
||||
"integrity": "sha512-MaI0+uLQPCr2V3WGnbdgb0pWa9xkWyrP4qYcbsHIjeismGLbn9s3jmP/HIXU8LkgzRgaVb+BJxmZJHOwl32DyA=="
|
||||
},
|
||||
"@pushrocks/smartpromise": {
|
||||
"version": "3.0.2",
|
||||
@ -293,10 +290,9 @@
|
||||
"integrity": "sha512-jmrJMUEmBCWChWK8CIcx4Vw3wv/8OgVNmkaxJrbs+WMaoRUfJtpWWJfrAwwHWt9ZXJbarJ+CwfwfYiiZXymndQ=="
|
||||
},
|
||||
"@pushrocks/smartrequest": {
|
||||
"version": "1.1.16",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartrequest/-/smartrequest-1.1.16.tgz",
|
||||
"integrity": "sha512-3LbtqoqnjfzWSQ10NryhJmgwPpvMlVoYyTzE676+yC4hM2rnGSzxozLZxMr6enV4VeZcloQ0CqHBivKoT/kdvA==",
|
||||
"dev": true,
|
||||
"version": "1.1.23",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartrequest/-/smartrequest-1.1.23.tgz",
|
||||
"integrity": "sha512-Hws3YfzIE0b/E3aTkSugLskKWBq7e8HDXEN+RlRyTFONxW/XONKJFTw4mp3jk+puWpYGDoOTcP+Ua4jd19z9pA==",
|
||||
"requires": {
|
||||
"@pushrocks/smartpromise": "^3.0.2",
|
||||
"@types/form-data": "^2.2.1",
|
||||
@ -426,20 +422,11 @@
|
||||
}
|
||||
},
|
||||
"@types/form-data": {
|
||||
"version": "2.2.1",
|
||||
"resolved": "https://verdaccio.lossless.one/@types%2fform-data/-/form-data-2.2.1.tgz",
|
||||
"integrity": "sha512-JAMFhOaHIciYVh8fb5/83nmuO/AHwmto+Hq7a9y8FzLDcC1KCU344XDOMEmahnrTFlHjgh4L0WJFczNIX2GxnQ==",
|
||||
"dev": true,
|
||||
"version": "2.5.0",
|
||||
"resolved": "https://verdaccio.lossless.one/@types%2fform-data/-/form-data-2.5.0.tgz",
|
||||
"integrity": "sha512-23/wYiuckYYtFpL+4RPWiWmRQH2BjFuqCUi2+N3amB1a1Drv+i/byTrGvlLwRVLFNAZbwpbQ7JvTK+VCAPMbcg==",
|
||||
"requires": {
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"@types/fs-extra": {
|
||||
"version": "8.0.0",
|
||||
"resolved": "https://verdaccio.lossless.one/@types%2ffs-extra/-/fs-extra-8.0.0.tgz",
|
||||
"integrity": "sha512-bCtL5v9zdbQW86yexOlXWTEGvLNqWxMFyi7gQA7Gcthbezr2cPSOb8SkESVKA937QD5cIwOFLDFt0MQoXOEr9Q==",
|
||||
"requires": {
|
||||
"@types/node": "*"
|
||||
"form-data": "*"
|
||||
}
|
||||
},
|
||||
"@types/luxon": {
|
||||
@ -461,7 +448,6 @@
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://verdaccio.lossless.one/@types%2fvinyl/-/vinyl-2.0.3.tgz",
|
||||
"integrity": "sha512-hrT6xg16CWSmndZqOTJ6BGIn2abKyTw0B58bI+7ioUoj3Sma6u8ftZ1DTI2yCaJamOVGLOnQWiPH3a74+EaqTA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/node": "*"
|
||||
}
|
||||
@ -506,7 +492,6 @@
|
||||
"version": "1.0.10",
|
||||
"resolved": "https://verdaccio.lossless.one/argparse/-/argparse-1.0.10.tgz",
|
||||
"integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"sprintf-js": "~1.0.2"
|
||||
}
|
||||
@ -520,8 +505,7 @@
|
||||
"asynckit": {
|
||||
"version": "0.4.0",
|
||||
"resolved": "https://verdaccio.lossless.one/asynckit/-/asynckit-0.4.0.tgz",
|
||||
"integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=",
|
||||
"dev": true
|
||||
"integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k="
|
||||
},
|
||||
"balanced-match": {
|
||||
"version": "1.0.0",
|
||||
@ -627,26 +611,22 @@
|
||||
"clone": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://verdaccio.lossless.one/clone/-/clone-2.1.2.tgz",
|
||||
"integrity": "sha1-G39Ln1kfHo+DZwQBYANFoCiHQ18=",
|
||||
"dev": true
|
||||
"integrity": "sha1-G39Ln1kfHo+DZwQBYANFoCiHQ18="
|
||||
},
|
||||
"clone-buffer": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://verdaccio.lossless.one/clone-buffer/-/clone-buffer-1.0.0.tgz",
|
||||
"integrity": "sha1-4+JbIHrE5wGvch4staFnksrD3Fg=",
|
||||
"dev": true
|
||||
"integrity": "sha1-4+JbIHrE5wGvch4staFnksrD3Fg="
|
||||
},
|
||||
"clone-stats": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://verdaccio.lossless.one/clone-stats/-/clone-stats-1.0.0.tgz",
|
||||
"integrity": "sha1-s3gt/4u1R04Yuba/D9/ngvh3doA=",
|
||||
"dev": true
|
||||
"integrity": "sha1-s3gt/4u1R04Yuba/D9/ngvh3doA="
|
||||
},
|
||||
"cloneable-readable": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://verdaccio.lossless.one/cloneable-readable/-/cloneable-readable-1.1.3.tgz",
|
||||
"integrity": "sha512-2EF8zTQOxYq70Y4XKtorQupqF0m49MBz2/yf5Bj+MHjvpG3Hy7sImifnqD6UA+TKYxeSV+u6qqQPawN5UvnpKQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"inherits": "^2.0.1",
|
||||
"process-nextick-args": "^2.0.0",
|
||||
@ -676,7 +656,6 @@
|
||||
"version": "1.0.8",
|
||||
"resolved": "https://verdaccio.lossless.one/combined-stream/-/combined-stream-1.0.8.tgz",
|
||||
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"delayed-stream": "~1.0.0"
|
||||
}
|
||||
@ -695,8 +674,7 @@
|
||||
"core-util-is": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://verdaccio.lossless.one/core-util-is/-/core-util-is-1.0.2.tgz",
|
||||
"integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=",
|
||||
"dev": true
|
||||
"integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac="
|
||||
},
|
||||
"cron": {
|
||||
"version": "1.7.1",
|
||||
@ -752,8 +730,7 @@
|
||||
"delayed-stream": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://verdaccio.lossless.one/delayed-stream/-/delayed-stream-1.0.0.tgz",
|
||||
"integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=",
|
||||
"dev": true
|
||||
"integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk="
|
||||
},
|
||||
"diff": {
|
||||
"version": "4.0.1",
|
||||
@ -778,8 +755,7 @@
|
||||
"esprima": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://verdaccio.lossless.one/esprima/-/esprima-4.0.1.tgz",
|
||||
"integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==",
|
||||
"dev": true
|
||||
"integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A=="
|
||||
},
|
||||
"esutils": {
|
||||
"version": "2.0.2",
|
||||
@ -802,6 +778,14 @@
|
||||
"strip-eof": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"extend-shallow": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://verdaccio.lossless.one/extend-shallow/-/extend-shallow-2.0.1.tgz",
|
||||
"integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
|
||||
"requires": {
|
||||
"is-extendable": "^0.1.0"
|
||||
}
|
||||
},
|
||||
"figures": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://verdaccio.lossless.one/figures/-/figures-3.0.0.tgz",
|
||||
@ -824,44 +808,24 @@
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://verdaccio.lossless.one/first-chunk-stream/-/first-chunk-stream-2.0.0.tgz",
|
||||
"integrity": "sha1-G97NuOCDwGZLkZRVgVd6Q6nzHXA=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"readable-stream": "^2.0.2"
|
||||
}
|
||||
},
|
||||
"form-data": {
|
||||
"version": "2.4.0",
|
||||
"resolved": "https://verdaccio.lossless.one/form-data/-/form-data-2.4.0.tgz",
|
||||
"integrity": "sha512-4FinE8RfqYnNim20xDwZZE0V2kOs/AuElIjFUbPuegQSaoZM+vUT5FnwSl10KPugH4voTg1bEQlcbCG9ka75TA==",
|
||||
"dev": true,
|
||||
"version": "2.5.1",
|
||||
"resolved": "https://verdaccio.lossless.one/form-data/-/form-data-2.5.1.tgz",
|
||||
"integrity": "sha512-m21N3WOmEEURgk6B9GLOE4RuWOFf28Lhh9qGYeNlGq4VDXUlJy2th2slBNU8Gp8EzloYZOibZJ7t5ecIrFSjVA==",
|
||||
"requires": {
|
||||
"asynckit": "^0.4.0",
|
||||
"combined-stream": "^1.0.6",
|
||||
"mime-types": "^2.1.12"
|
||||
}
|
||||
},
|
||||
"fs-extra": {
|
||||
"version": "8.1.0",
|
||||
"resolved": "https://verdaccio.lossless.one/fs-extra/-/fs-extra-8.1.0.tgz",
|
||||
"integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==",
|
||||
"requires": {
|
||||
"graceful-fs": "^4.2.0",
|
||||
"jsonfile": "^4.0.0",
|
||||
"universalify": "^0.1.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"graceful-fs": {
|
||||
"version": "4.2.2",
|
||||
"resolved": "https://verdaccio.lossless.one/graceful-fs/-/graceful-fs-4.2.2.tgz",
|
||||
"integrity": "sha512-IItsdsea19BoLC7ELy13q1iJFNmd7ofZH5+X/pJr90/nRoPEX0DJo1dHDbgtYWOhJhcCgMDTOw84RZ72q6lB+Q=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"fs.realpath": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://verdaccio.lossless.one/fs.realpath/-/fs.realpath-1.0.0.tgz",
|
||||
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=",
|
||||
"dev": true
|
||||
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8="
|
||||
},
|
||||
"get-caller-file": {
|
||||
"version": "1.0.3",
|
||||
@ -888,7 +852,6 @@
|
||||
"version": "7.1.4",
|
||||
"resolved": "https://verdaccio.lossless.one/glob/-/glob-7.1.4.tgz",
|
||||
"integrity": "sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"fs.realpath": "^1.0.0",
|
||||
"inflight": "^1.0.4",
|
||||
@ -899,9 +862,20 @@
|
||||
}
|
||||
},
|
||||
"graceful-fs": {
|
||||
"version": "4.1.15",
|
||||
"resolved": "https://verdaccio.lossless.one/graceful-fs/-/graceful-fs-4.1.15.tgz",
|
||||
"integrity": "sha512-6uHUhOPEBgQ24HM+r6b/QwWfZq+yiFcipKFrOFiBEnWdy5sdzYoi+pJeQaPI5qOLRFqWmAXUPQNsielzdLoecA=="
|
||||
"version": "4.2.2",
|
||||
"resolved": "https://verdaccio.lossless.one/graceful-fs/-/graceful-fs-4.2.2.tgz",
|
||||
"integrity": "sha512-IItsdsea19BoLC7ELy13q1iJFNmd7ofZH5+X/pJr90/nRoPEX0DJo1dHDbgtYWOhJhcCgMDTOw84RZ72q6lB+Q=="
|
||||
},
|
||||
"gray-matter": {
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://verdaccio.lossless.one/gray-matter/-/gray-matter-4.0.2.tgz",
|
||||
"integrity": "sha512-7hB/+LxrOjq/dd8APlK0r24uL/67w7SkYnfwhNFwg/VDIGWGmduTDYf3WNstLW2fbbmRwrDGCVSJ2isuf2+4Hw==",
|
||||
"requires": {
|
||||
"js-yaml": "^3.11.0",
|
||||
"kind-of": "^6.0.2",
|
||||
"section-matter": "^1.0.0",
|
||||
"strip-bom-string": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"has-flag": {
|
||||
"version": "3.0.0",
|
||||
@ -912,7 +886,6 @@
|
||||
"version": "1.0.6",
|
||||
"resolved": "https://verdaccio.lossless.one/inflight/-/inflight-1.0.6.tgz",
|
||||
"integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"once": "^1.3.0",
|
||||
"wrappy": "1"
|
||||
@ -921,8 +894,7 @@
|
||||
"inherits": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://verdaccio.lossless.one/inherits/-/inherits-2.0.4.tgz",
|
||||
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
|
||||
"dev": true
|
||||
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
|
||||
},
|
||||
"invert-kv": {
|
||||
"version": "2.0.0",
|
||||
@ -930,6 +902,11 @@
|
||||
"integrity": "sha512-wPVv/y/QQ/Uiirj/vh3oP+1Ww+AWehmi1g5fFWGPF6IpCBCDVrhgHRMvrLfdYcwDh3QJbGXDW4JAuzxElLSqKA==",
|
||||
"dev": true
|
||||
},
|
||||
"is-extendable": {
|
||||
"version": "0.1.1",
|
||||
"resolved": "https://verdaccio.lossless.one/is-extendable/-/is-extendable-0.1.1.tgz",
|
||||
"integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik="
|
||||
},
|
||||
"is-fullwidth-code-point": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://verdaccio.lossless.one/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz",
|
||||
@ -950,14 +927,12 @@
|
||||
"is-utf8": {
|
||||
"version": "0.2.1",
|
||||
"resolved": "https://verdaccio.lossless.one/is-utf8/-/is-utf8-0.2.1.tgz",
|
||||
"integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=",
|
||||
"dev": true
|
||||
"integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI="
|
||||
},
|
||||
"isarray": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://verdaccio.lossless.one/isarray/-/isarray-1.0.0.tgz",
|
||||
"integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=",
|
||||
"dev": true
|
||||
"integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE="
|
||||
},
|
||||
"isexe": {
|
||||
"version": "2.0.0",
|
||||
@ -974,7 +949,6 @@
|
||||
"version": "3.13.1",
|
||||
"resolved": "https://verdaccio.lossless.one/js-yaml/-/js-yaml-3.13.1.tgz",
|
||||
"integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"argparse": "^1.0.7",
|
||||
"esprima": "^4.0.0"
|
||||
@ -988,6 +962,11 @@
|
||||
"graceful-fs": "^4.1.6"
|
||||
}
|
||||
},
|
||||
"kind-of": {
|
||||
"version": "6.0.2",
|
||||
"resolved": "https://verdaccio.lossless.one/kind-of/-/kind-of-6.0.2.tgz",
|
||||
"integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA=="
|
||||
},
|
||||
"lcid": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://verdaccio.lossless.one/lcid/-/lcid-2.0.0.tgz",
|
||||
@ -1049,14 +1028,12 @@
|
||||
"mime-db": {
|
||||
"version": "1.40.0",
|
||||
"resolved": "https://verdaccio.lossless.one/mime-db/-/mime-db-1.40.0.tgz",
|
||||
"integrity": "sha512-jYdeOMPy9vnxEqFRRo6ZvTZ8d9oPb+k18PKoYNYUe2stVEBPPwsln/qWzdbmaIvnhZ9v2P+CuecK+fpUfsV2mA==",
|
||||
"dev": true
|
||||
"integrity": "sha512-jYdeOMPy9vnxEqFRRo6ZvTZ8d9oPb+k18PKoYNYUe2stVEBPPwsln/qWzdbmaIvnhZ9v2P+CuecK+fpUfsV2mA=="
|
||||
},
|
||||
"mime-types": {
|
||||
"version": "2.1.24",
|
||||
"resolved": "https://verdaccio.lossless.one/mime-types/-/mime-types-2.1.24.tgz",
|
||||
"integrity": "sha512-WaFHS3MCl5fapm3oLxU4eYDw77IQM2ACcxQ9RIxfaC3ooc6PFuBMGZZsYpvoXS5D5QTWPieo1jjLdAm3TBP3cQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"mime-db": "1.40.0"
|
||||
}
|
||||
@ -1130,7 +1107,6 @@
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://verdaccio.lossless.one/once/-/once-1.4.0.tgz",
|
||||
"integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"wrappy": "1"
|
||||
}
|
||||
@ -1240,8 +1216,7 @@
|
||||
"path-is-absolute": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://verdaccio.lossless.one/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
|
||||
"integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=",
|
||||
"dev": true
|
||||
"integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18="
|
||||
},
|
||||
"path-key": {
|
||||
"version": "2.0.1",
|
||||
@ -1264,14 +1239,12 @@
|
||||
"pify": {
|
||||
"version": "2.3.0",
|
||||
"resolved": "https://verdaccio.lossless.one/pify/-/pify-2.3.0.tgz",
|
||||
"integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=",
|
||||
"dev": true
|
||||
"integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw="
|
||||
},
|
||||
"process-nextick-args": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://verdaccio.lossless.one/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
|
||||
"integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==",
|
||||
"dev": true
|
||||
"integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag=="
|
||||
},
|
||||
"pump": {
|
||||
"version": "3.0.0",
|
||||
@ -1287,7 +1260,6 @@
|
||||
"version": "2.3.6",
|
||||
"resolved": "https://verdaccio.lossless.one/readable-stream/-/readable-stream-2.3.6.tgz",
|
||||
"integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"core-util-is": "~1.0.0",
|
||||
"inherits": "~2.0.3",
|
||||
@ -1301,14 +1273,12 @@
|
||||
"remove-trailing-separator": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://verdaccio.lossless.one/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz",
|
||||
"integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=",
|
||||
"dev": true
|
||||
"integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8="
|
||||
},
|
||||
"replace-ext": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://verdaccio.lossless.one/replace-ext/-/replace-ext-1.0.0.tgz",
|
||||
"integrity": "sha1-3mMSg3P8v3w8z6TeWkgMRaZ5WOs=",
|
||||
"dev": true
|
||||
"integrity": "sha1-3mMSg3P8v3w8z6TeWkgMRaZ5WOs="
|
||||
},
|
||||
"require-directory": {
|
||||
"version": "2.1.1",
|
||||
@ -1351,8 +1321,16 @@
|
||||
"safe-buffer": {
|
||||
"version": "5.1.2",
|
||||
"resolved": "https://verdaccio.lossless.one/safe-buffer/-/safe-buffer-5.1.2.tgz",
|
||||
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
|
||||
"dev": true
|
||||
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
|
||||
},
|
||||
"section-matter": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://verdaccio.lossless.one/section-matter/-/section-matter-1.0.0.tgz",
|
||||
"integrity": "sha512-vfD3pmTzGpufjScBh50YHKzEu2lxBWhVEHsNGoEXmCmn2hKGfeNLYMzCJpe8cD7gqX7TJluOVpBkAequ6dgMmA==",
|
||||
"requires": {
|
||||
"extend-shallow": "^2.0.1",
|
||||
"kind-of": "^6.0.0"
|
||||
}
|
||||
},
|
||||
"semver": {
|
||||
"version": "5.7.0",
|
||||
@ -1419,8 +1397,7 @@
|
||||
"sprintf-js": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://verdaccio.lossless.one/sprintf-js/-/sprintf-js-1.0.3.tgz",
|
||||
"integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=",
|
||||
"dev": true
|
||||
"integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw="
|
||||
},
|
||||
"string-width": {
|
||||
"version": "2.1.1",
|
||||
@ -1436,7 +1413,6 @@
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://verdaccio.lossless.one/string_decoder/-/string_decoder-1.1.1.tgz",
|
||||
"integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"safe-buffer": "~5.1.0"
|
||||
}
|
||||
@ -1454,7 +1430,6 @@
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://verdaccio.lossless.one/strip-bom/-/strip-bom-2.0.0.tgz",
|
||||
"integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"is-utf8": "^0.2.0"
|
||||
}
|
||||
@ -1463,7 +1438,6 @@
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://verdaccio.lossless.one/strip-bom-buf/-/strip-bom-buf-1.0.0.tgz",
|
||||
"integrity": "sha1-HLRar1dTD0yvhsf3UXnSyaUd1XI=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"is-utf8": "^0.2.1"
|
||||
}
|
||||
@ -1472,12 +1446,16 @@
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://verdaccio.lossless.one/strip-bom-stream/-/strip-bom-stream-2.0.0.tgz",
|
||||
"integrity": "sha1-+H217yYT9paKpUWr/h7HKLaoKco=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"first-chunk-stream": "^2.0.0",
|
||||
"strip-bom": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"strip-bom-string": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://verdaccio.lossless.one/strip-bom-string/-/strip-bom-string-1.0.0.tgz",
|
||||
"integrity": "sha1-5SEekiQ2n7uB1jOi8ABE3IztrZI="
|
||||
},
|
||||
"strip-eof": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://verdaccio.lossless.one/strip-eof/-/strip-eof-1.0.0.tgz",
|
||||
@ -1579,14 +1557,12 @@
|
||||
"util-deprecate": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://verdaccio.lossless.one/util-deprecate/-/util-deprecate-1.0.2.tgz",
|
||||
"integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=",
|
||||
"dev": true
|
||||
"integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8="
|
||||
},
|
||||
"vinyl": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://verdaccio.lossless.one/vinyl/-/vinyl-2.2.0.tgz",
|
||||
"integrity": "sha512-MBH+yP0kC/GQ5GwBqrTPTzEfiiLjta7hTtvQtbxBgTeSXsmKQRQecjibMbxIXzVT3Y9KJK+drOz1/k+vsu8Nkg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"clone": "^2.1.1",
|
||||
"clone-buffer": "^1.0.0",
|
||||
@ -1600,7 +1576,6 @@
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://verdaccio.lossless.one/vinyl-file/-/vinyl-file-3.0.0.tgz",
|
||||
"integrity": "sha1-sQTZ5ECf+jJfqt1SBkLQo7SIs2U=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"graceful-fs": "^4.1.2",
|
||||
"pify": "^2.3.0",
|
||||
@ -1681,8 +1656,7 @@
|
||||
"wrappy": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://verdaccio.lossless.one/wrappy/-/wrappy-1.0.2.tgz",
|
||||
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
|
||||
"dev": true
|
||||
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
|
||||
},
|
||||
"y18n": {
|
||||
"version": "4.0.0",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@pushrocks/smartdaemon",
|
||||
"version": "1.0.5",
|
||||
"version": "1.0.18",
|
||||
"private": false,
|
||||
"description": "start scripts as long running daemons and manage them",
|
||||
"main": "dist/index.js",
|
||||
@ -21,12 +21,13 @@
|
||||
"tslint-config-prettier": "^1.15.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@pushrocks/lik": "^3.0.11",
|
||||
"@pushrocks/smartfile": "^7.0.4",
|
||||
"@pushrocks/smartfm": "^2.0.4",
|
||||
"@pushrocks/smartlog": "^2.0.19",
|
||||
"@pushrocks/smartlog-destination-local": "^8.0.2",
|
||||
"@pushrocks/smartshell": "^2.0.25",
|
||||
"@pushrocks/smartsystem": "^2.0.8",
|
||||
"@types/fs-extra": "^8.0.0",
|
||||
"fs-extra": "^8.1.0"
|
||||
"@pushrocks/smartsystem": "^2.0.8"
|
||||
},
|
||||
"files": [
|
||||
"ts/*",
|
||||
|
17
test/test.ts
17
test/test.ts
@ -1,8 +1,21 @@
|
||||
import { expect, tap } from '@pushrocks/tapbundle';
|
||||
import * as smartdaemon from '../ts/index';
|
||||
|
||||
tap.test('first test', async () => {
|
||||
console.log(smartdaemon.standardExport);
|
||||
let testSmartdaemon: smartdaemon.SmartDaemon;
|
||||
|
||||
tap.test('should create an instance of smartdaemon', async () => {
|
||||
testSmartdaemon = new smartdaemon.SmartDaemon();
|
||||
expect(testSmartdaemon).to.be.instanceOf(smartdaemon.SmartDaemon);
|
||||
});
|
||||
|
||||
tap.test('should create a service', async () => {
|
||||
testSmartdaemon.addService({
|
||||
name: 'npmversion',
|
||||
version: 'x.x.x',
|
||||
command: 'npm -v',
|
||||
description: 'displays the npm version',
|
||||
workingDir: __dirname
|
||||
});
|
||||
});
|
||||
|
||||
tap.start();
|
||||
|
@ -1,3 +1 @@
|
||||
import * as plugins from './smartdaemon.plugins';
|
||||
|
||||
export let standardExport = 'Hi there! :) This is an exported string';
|
||||
export * from './smartdaemon.classes.smartdaemon';
|
||||
|
84
ts/smartdaemon.classes.service.ts
Normal file
84
ts/smartdaemon.classes.service.ts
Normal file
@ -0,0 +1,84 @@
|
||||
import * as plugins from './smartdaemon.plugins';
|
||||
import * as paths from './smartdaemon.paths';
|
||||
import { SmartDaemon } from './smartdaemon.classes.smartdaemon';
|
||||
|
||||
export interface ISmartDaemonServiceConstructorOptions {
|
||||
name: string;
|
||||
description: string;
|
||||
command: string;
|
||||
workingDir: string;
|
||||
version: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* represents a service that is being spawned by SmartDaemon
|
||||
*/
|
||||
export class SmartDaemonService implements ISmartDaemonServiceConstructorOptions {
|
||||
public static async createFromOptions(smartdaemonRef: SmartDaemon, optionsArg: ISmartDaemonServiceConstructorOptions) {
|
||||
const service = new SmartDaemonService(smartdaemonRef);
|
||||
for (const key of Object.keys(optionsArg)) {
|
||||
service[key] = optionsArg[key];
|
||||
}
|
||||
return service;
|
||||
}
|
||||
|
||||
public options: ISmartDaemonServiceConstructorOptions;
|
||||
public alreadyExists = false;
|
||||
|
||||
public name: string;
|
||||
public version: string;
|
||||
public command: string;
|
||||
public workingDir: string;
|
||||
public description: string;
|
||||
|
||||
public smartdaemonRef: SmartDaemon;
|
||||
|
||||
constructor(smartdaemonRegfArg: SmartDaemon) {
|
||||
this.smartdaemonRef = smartdaemonRegfArg;
|
||||
}
|
||||
|
||||
/**
|
||||
* enables the service
|
||||
*/
|
||||
public async enable() {
|
||||
await this.smartdaemonRef.systemdManager.enableService(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* disables the service
|
||||
*/
|
||||
public async disable() {
|
||||
await this.smartdaemonRef.systemdManager.disableService(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* starts a service
|
||||
*/
|
||||
public async start() {
|
||||
await this.smartdaemonRef.systemdManager.startService(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* stops a service
|
||||
*/
|
||||
public async stop() {
|
||||
await this.smartdaemonRef.systemdManager.stopService(this);
|
||||
}
|
||||
|
||||
|
||||
// Save and Delete
|
||||
public async save() {
|
||||
await this.smartdaemonRef.systemdManager.saveService(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* deletes the service
|
||||
*/
|
||||
public async delete() {
|
||||
await this.smartdaemonRef.systemdManager.deleteService(this);
|
||||
}
|
||||
|
||||
public async reload() {
|
||||
await this.smartdaemonRef.systemdManager.reload();
|
||||
}
|
||||
}
|
@ -1,60 +1,38 @@
|
||||
import * as plugins from './smartdaemon.plugins';
|
||||
import { SmartDaemonTemplateManager } from './smartdaemon.classes.templatemanager';
|
||||
import { SmartDaemonService, ISmartDaemonServiceConstructorOptions } from './smartdaemon.classes.service';
|
||||
import { SmartDaemonSystemdManager } from './smartdaemon.classes.systemdmanager';
|
||||
|
||||
const smartDaemonNamespace = 'smartdaemon_';
|
||||
|
||||
interface SmartDaemonConstructorOptions {
|
||||
name: string;
|
||||
scriptPath: string;
|
||||
workingDir: string;
|
||||
}
|
||||
|
||||
export class SmartDaemon {
|
||||
private templateManager: SmartDaemonTemplateManager;
|
||||
private smartshellInstance: plugins.smartshell.Smartshell;
|
||||
private smartsystem: plugins.smartsystem.Smartsystem;
|
||||
private shouldExecute: boolean = false;
|
||||
public templateManager: SmartDaemonTemplateManager;
|
||||
public systemdManager: SmartDaemonSystemdManager;
|
||||
|
||||
constructor() {
|
||||
this.templateManager = new SmartDaemonTemplateManager;
|
||||
this.smartshellInstance = new plugins.smartshell.Smartshell({
|
||||
executor: 'bash'
|
||||
this.templateManager = new SmartDaemonTemplateManager(this);
|
||||
this.systemdManager = new SmartDaemonSystemdManager(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* adds a service
|
||||
* @param nameArg
|
||||
* @param commandArg
|
||||
* @param workingDirectoryArg
|
||||
*/
|
||||
public async addService(optionsArg: ISmartDaemonServiceConstructorOptions): Promise<SmartDaemonService> {
|
||||
let serviceToAdd: SmartDaemonService;
|
||||
const existingServices = await this.systemdManager.getServices();
|
||||
const existingService = existingServices.find(serviceArg => {
|
||||
return serviceArg.name === optionsArg.name;
|
||||
});
|
||||
this.smartsystem = new plugins.smartsystem.Smartsystem();
|
||||
}
|
||||
|
||||
public async checkElegibility () {
|
||||
if (await this.smartsystem.env.isLinuxAsync()) {
|
||||
this.shouldExecute = true;
|
||||
if (!existingService) {
|
||||
serviceToAdd = await SmartDaemonService.createFromOptions(this, optionsArg);
|
||||
} else {
|
||||
console.log('Smartdaemon can only be used on Linuc systems! Refusing to set up a service.');
|
||||
this.shouldExecute = false;
|
||||
serviceToAdd = existingService;
|
||||
Object.assign(serviceToAdd, optionsArg);
|
||||
}
|
||||
return this.shouldExecute;
|
||||
}
|
||||
|
||||
/**
|
||||
* enables the service
|
||||
*/
|
||||
public async enable() {
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* disables the service
|
||||
*/
|
||||
public async disable() {
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* pauses the service
|
||||
*/
|
||||
public pause() {};
|
||||
|
||||
|
||||
private async execute(commandArg: string) {
|
||||
|
||||
this.smartshellInstance.exec(commandArg);
|
||||
await serviceToAdd.save();
|
||||
return serviceToAdd;
|
||||
}
|
||||
}
|
138
ts/smartdaemon.classes.systemdmanager.ts
Normal file
138
ts/smartdaemon.classes.systemdmanager.ts
Normal file
@ -0,0 +1,138 @@
|
||||
import * as plugins from './smartdaemon.plugins';
|
||||
import * as paths from './smartdaemon.paths';
|
||||
import { SmartDaemon } from './smartdaemon.classes.smartdaemon';
|
||||
import { ISmartDaemonServiceConstructorOptions, SmartDaemonService } from './smartdaemon.classes.service';
|
||||
|
||||
export class SmartDaemonSystemdManager {
|
||||
// STATIC
|
||||
private static smartDaemonNamespace = 'smartdaemon';
|
||||
|
||||
public static createServiceNameFromServiceName (serviceNameArg: string) {
|
||||
return `${SmartDaemonSystemdManager.smartDaemonNamespace}_${serviceNameArg}`;
|
||||
}
|
||||
|
||||
public static createFileNameFromServiceName (serviceNameArg: string) {
|
||||
return `${SmartDaemonSystemdManager.createServiceNameFromServiceName(serviceNameArg)}.service`;
|
||||
};
|
||||
|
||||
public static createFilePathFromServiceName (serviceNameArg: string) {
|
||||
return plugins.path.join(
|
||||
paths.systemdDir,
|
||||
SmartDaemonSystemdManager.createFileNameFromServiceName(serviceNameArg)
|
||||
);
|
||||
}
|
||||
|
||||
// INSTANCE
|
||||
public smartdaemonRef: SmartDaemon;
|
||||
public smartshellInstance: plugins.smartshell.Smartshell;
|
||||
public smartsystem: plugins.smartsystem.Smartsystem;
|
||||
|
||||
public shouldExecute: boolean = false;
|
||||
|
||||
constructor(smartdaemonRefArg: SmartDaemon) {
|
||||
this.smartdaemonRef = smartdaemonRefArg;
|
||||
this.smartshellInstance = new plugins.smartshell.Smartshell({
|
||||
executor: 'bash'
|
||||
});
|
||||
this.smartsystem = new plugins.smartsystem.Smartsystem();
|
||||
}
|
||||
|
||||
public async checkElegibility() {
|
||||
if (await this.smartsystem.env.isLinuxAsync()) {
|
||||
this.shouldExecute = true;
|
||||
} else {
|
||||
console.log('Smartdaemon can only be used on Linux systems! Refusing to set up a service.');
|
||||
this.shouldExecute = false;
|
||||
}
|
||||
return this.shouldExecute;
|
||||
}
|
||||
|
||||
public async execute(commandArg: string) {
|
||||
if (await this.checkElegibility()) {
|
||||
await this.smartshellInstance.exec(commandArg);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gets all services that are already present
|
||||
*/
|
||||
public async getServices() {
|
||||
const existingServices: SmartDaemonService[] = [];
|
||||
if (await this.checkElegibility()) {
|
||||
const smartfmInstance = new plugins.smartfm.Smartfm({
|
||||
fmType: 'yaml'
|
||||
});
|
||||
const availableServices = await plugins.smartfile.fs.fileTreeToObject(
|
||||
paths.systemdDir,
|
||||
'smartdaemon_*.service'
|
||||
);
|
||||
for (const serviceFile of availableServices) {
|
||||
const data = smartfmInstance.parseFromComments('# ', serviceFile.contentBuffer.toString())
|
||||
.data as ISmartDaemonServiceConstructorOptions;
|
||||
const service = await SmartDaemonService.createFromOptions(this.smartdaemonRef, data);
|
||||
service.alreadyExists = true;
|
||||
existingServices.push(service);
|
||||
}
|
||||
}
|
||||
return existingServices;
|
||||
}
|
||||
|
||||
public async startService(serviceArg: SmartDaemonService) {
|
||||
if (await this.checkElegibility()) {
|
||||
await this.execute(
|
||||
`systemctl start ${SmartDaemonSystemdManager.createServiceNameFromServiceName(serviceArg.name)}`
|
||||
);
|
||||
}
|
||||
}
|
||||
public async stopService(serviceArg: SmartDaemonService) {
|
||||
if (await this.checkElegibility()) {
|
||||
await this.execute(
|
||||
`systemctl stop ${SmartDaemonSystemdManager.createServiceNameFromServiceName(serviceArg.name)}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public async saveService(serviceArg: SmartDaemonService) {
|
||||
if (await this.checkElegibility()) {
|
||||
await plugins.smartfile.memory.toFs(
|
||||
this.smartdaemonRef.templateManager.generateUnitFileForService(serviceArg),
|
||||
SmartDaemonSystemdManager.createFilePathFromServiceName(serviceArg.name)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public async deleteService(serviceArg: SmartDaemonService) {
|
||||
if (await this.checkElegibility()) {
|
||||
await plugins.smartfile.fs.remove(
|
||||
SmartDaemonSystemdManager.createServiceNameFromServiceName(serviceArg.name)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public async enableService(serviceArg: SmartDaemonService) {
|
||||
if (await this.checkElegibility()) {
|
||||
await this.saveService(serviceArg);
|
||||
if (serviceArg.alreadyExists) {
|
||||
await this.execute(`systemctl daemon-reload`);
|
||||
}
|
||||
await this.execute(
|
||||
`systemctl enable ${SmartDaemonSystemdManager.createServiceNameFromServiceName(serviceArg.name)}`
|
||||
);
|
||||
}
|
||||
}
|
||||
public async disableService(serviceArg: SmartDaemonService) {
|
||||
if (await this.checkElegibility()) {
|
||||
await this.execute(
|
||||
`systemctl disable ${SmartDaemonSystemdManager.createServiceNameFromServiceName(serviceArg.name)}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public async reload() {
|
||||
if (await this.checkElegibility()) {
|
||||
await this.execute(
|
||||
`systemctl daemon-reload`
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,25 +1,31 @@
|
||||
import * as plugins from './smartdaemon.plugins';
|
||||
import { SmartDaemon } from './smartdaemon.classes.smartdaemon';
|
||||
import { SmartDaemonService } from './smartdaemon.classes.service';
|
||||
|
||||
export class SmartDaemonTemplateManager {
|
||||
public generateServiceTemplate = (optionsArg: {
|
||||
serviceName: string;
|
||||
description: string;
|
||||
serviceVersion: string;
|
||||
pathNodeJs: string;
|
||||
pathWorkkingDir;
|
||||
pathJsFileToRun;
|
||||
}) => {
|
||||
return `
|
||||
# servicVersion: ${optionsArg.serviceVersion}
|
||||
public smartdaemonRef: SmartDaemon;
|
||||
|
||||
constructor(smartdaemonRefArg: SmartDaemon) {
|
||||
this.smartdaemonRef = smartdaemonRefArg;
|
||||
}
|
||||
|
||||
public generateUnitFileForService = (serviceArg: SmartDaemonService) => {
|
||||
return `# ---
|
||||
# name: ${serviceArg.name}
|
||||
# version: ${serviceArg.version}
|
||||
# description: ${serviceArg.description}
|
||||
# command: ${serviceArg.command}
|
||||
# workingDir: ${serviceArg.workingDir}
|
||||
# ---
|
||||
[Unit]
|
||||
Description=${optionsArg.description}
|
||||
Description=${serviceArg.description}
|
||||
Requires=network.target
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=${optionsArg.pathNodeJs} ${optionsArg.pathJsFileToRun}
|
||||
WorkingDirectory=${optionsArg.pathWorkkingDir}
|
||||
ExecStart=/bin/bash -c "cd ${serviceArg.workingDir} && ${serviceArg.command}"
|
||||
WorkingDirectory=${serviceArg.workingDir}
|
||||
Restart=on-failure
|
||||
LimitNOFILE=infinity
|
||||
LimitCORE=infinity
|
||||
@ -30,5 +36,5 @@ Restart=always
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
`;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -7,12 +7,18 @@ export {
|
||||
};
|
||||
|
||||
// @pushrocks scope
|
||||
import * as lik from '@pushrocks/lik';
|
||||
import * as smartfile from '@pushrocks/smartfile';
|
||||
import * as smartfm from '@pushrocks/smartfm';
|
||||
import * as smartlog from '@pushrocks/smartlog';
|
||||
import * as smartlogDestinationLocal from '@pushrocks/smartlog-destination-local';
|
||||
import * as smartshell from '@pushrocks/smartshell';
|
||||
import * as smartsystem from '@pushrocks/smartsystem';
|
||||
|
||||
export {
|
||||
lik,
|
||||
smartfile,
|
||||
smartfm,
|
||||
smartlog,
|
||||
smartlogDestinationLocal,
|
||||
smartshell,
|
||||
@ -20,9 +26,3 @@ export {
|
||||
};
|
||||
|
||||
// third party
|
||||
|
||||
import * as fs from 'fs-extra';
|
||||
|
||||
export {
|
||||
fs
|
||||
};
|
Reference in New Issue
Block a user