Compare commits

...

6 Commits

Author SHA1 Message Date
b8332e1de4 1.2.23 2022-03-12 14:52:42 +01:00
da9a73bc79 fix(core): update 2022-03-12 14:52:42 +01:00
26bf39abae 1.2.22 2022-03-12 14:43:54 +01:00
b66b2083ab fix(core): update 2022-03-12 14:43:54 +01:00
e40c0151bc 1.2.21 2022-03-11 18:09:35 +01:00
fe97fcd193 fix(core): update 2022-03-11 18:09:35 +01:00
9 changed files with 215 additions and 146 deletions

2
cli.js
View File

@ -1,4 +1,4 @@
#!/usr/bin/env node
process.env.CLI_CALL = 'true';
const cliTool = require('./dist_ts/index');
const cliTool = await import('./dist_ts/index.js');
cliTool.runCli();

View File

@ -1,5 +1,5 @@
#!/usr/bin/env node
process.env.CLI_CALL = 'true';
require('@gitzone/tsrun');
const cliTool = require('./ts/index');
await import('@gitzone/tsrun');
const cliTool = await import('./ts/index.js');
cliTool.runCli();

255
package-lock.json generated
View File

@ -1,23 +1,25 @@
{
"name": "@gitzone/tsrun",
"version": "1.2.20",
"version": "1.2.23",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@gitzone/tsrun",
"version": "1.2.20",
"version": "1.2.23",
"license": "MIT",
"dependencies": {
"@pushrocks/smartfile": "^9.0.6",
"@pushrocks/smartshell": "^2.0.30",
"ts-node": "^10.7.0",
"typescript": "^4.6.2"
"typescript": "4.7.0-dev.20220311"
},
"bin": {
"tsrun": "cli.js"
},
"devDependencies": {
"@gitzone/tsbuild": "2.1.29",
"@gitzone/tsbuild": "^2.1.43",
"@pushrocks/smartcli": "^3.0.14",
"@types/node": "^17.0.21",
"node-fetch": "^3.2.2",
"tslint": "^6.1.2",
@ -91,66 +93,24 @@
}
},
"node_modules/@gitzone/tsbuild": {
"version": "2.1.29",
"resolved": "https://verdaccio.lossless.one/@gitzone%2ftsbuild/-/tsbuild-2.1.29.tgz",
"integrity": "sha512-rS0WlwXKb0W+gjFvVgcr1h+ZWRQTBwDm9RylEipPsDb+RmbTYKFT1xtoS53TWAgSKJouknVfsLowbSEic9+75g==",
"version": "2.1.43",
"resolved": "https://verdaccio.lossless.one/@gitzone%2ftsbuild/-/tsbuild-2.1.43.tgz",
"integrity": "sha512-7vWO3Od03JGXQzmrdFahsgNST5LpaJjOREL1lvO1gUfbOIyJiFLr/SpI2pRTKd181YETbXu1RCp8VoVyJP3YDg==",
"dev": true,
"license": "MIT",
"dependencies": {
"@pushrocks/early": "^3.0.6",
"@pushrocks/smartcli": "^3.0.14",
"@pushrocks/smartfile": "^8.0.10",
"@pushrocks/smartfile": "^9.0.6",
"@pushrocks/smartlog": "^2.0.44",
"@pushrocks/smartpath": "^4.0.3",
"@pushrocks/smartpromise": "^3.1.6",
"typescript": "^4.4.2"
"@pushrocks/smartpromise": "^3.1.7",
"typescript": "4.7.0-dev.20220311"
},
"bin": {
"tsbuild": "cli.js"
}
},
"node_modules/@gitzone/tsbuild/node_modules/@pushrocks/smartfile": {
"version": "8.0.11",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartfile/-/smartfile-8.0.11.tgz",
"integrity": "sha512-mujs1mDgorsryQ8OZuL94MZZDYL3+cbdPKaXSchPjyxOOx8iGacUzc5BK4jDsImYeYEo07MpdJ5BjvGkORQR/w==",
"dev": true,
"license": "MIT",
"dependencies": {
"@pushrocks/smartfile-interfaces": "^1.0.7",
"@pushrocks/smarthash": "^2.1.10",
"@pushrocks/smartjson": "^4.0.6",
"@pushrocks/smartmime": "^1.0.5",
"@pushrocks/smartpath": "^4.0.3",
"@pushrocks/smartpromise": "^3.1.6",
"@pushrocks/smartrequest": "^1.1.52",
"@types/fs-extra": "^9.0.13",
"@types/glob": "^7.2.0",
"@types/js-yaml": "^4.0.5",
"fs-extra": "^10.0.0",
"glob": "^7.2.0",
"js-yaml": "^4.1.0"
}
},
"node_modules/@gitzone/tsbuild/node_modules/argparse": {
"version": "2.0.1",
"resolved": "https://verdaccio.lossless.one/argparse/-/argparse-2.0.1.tgz",
"integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
"dev": true,
"license": "Python-2.0"
},
"node_modules/@gitzone/tsbuild/node_modules/js-yaml": {
"version": "4.1.0",
"resolved": "https://verdaccio.lossless.one/js-yaml/-/js-yaml-4.1.0.tgz",
"integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==",
"dev": true,
"license": "MIT",
"dependencies": {
"argparse": "^2.0.1"
},
"bin": {
"js-yaml": "bin/js-yaml.js"
}
},
"node_modules/@pushrocks/consolecolor": {
"version": "2.0.1",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fconsolecolor/-/consolecolor-2.0.1.tgz",
@ -184,7 +144,6 @@
"version": "4.0.20",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2flik/-/lik-4.0.20.tgz",
"integrity": "sha512-DJbxSZFwDuHe4W7dU5anyO72gy4woZpkxSpySphdHbSYZf50VJ1sMOKIccSpgRIczeB0BTR5i0c+cKnNFrg2jw==",
"dev": true,
"license": "MIT",
"dependencies": {
"@pushrocks/smartdelay": "^2.0.10",
@ -221,6 +180,16 @@
"@pushrocks/smartpromise": "^3.0.6"
}
},
"node_modules/@pushrocks/smartexit": {
"version": "1.0.20",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartexit/-/smartexit-1.0.20.tgz",
"integrity": "sha512-u/KgA7s2zAtZ7gZvL13HZbO3mZATvjfCLU8Ez6h8VweG8UsIBVaPfYziMDCmJOWIPYLGzEW8eG/u4mCHuyLBow==",
"license": "MIT",
"dependencies": {
"@pushrocks/lik": "^4.0.20",
"@pushrocks/smartdelay": "^2.0.3"
}
},
"node_modules/@pushrocks/smartfile": {
"version": "9.0.6",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartfile/-/smartfile-9.0.6.tgz",
@ -409,6 +378,20 @@
"integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==",
"license": "0BSD"
},
"node_modules/@pushrocks/smartshell": {
"version": "2.0.30",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartshell/-/smartshell-2.0.30.tgz",
"integrity": "sha512-HPgdTFzfzhk2TQau/jVdYNSANlxyBZdqq2vyZ+bZahegVHfH/27Zur5Fk+2vE16VJjJMqP7zcvDITUe2+ipgJg==",
"license": "MIT",
"dependencies": {
"@pushrocks/smartdelay": "^2.0.13",
"@pushrocks/smartexit": "^1.0.20",
"@pushrocks/smartpromise": "^3.1.6",
"@types/which": "^2.0.1",
"tree-kill": "^1.2.2",
"which": "^2.0.2"
}
},
"node_modules/@pushrocks/smarttime": {
"version": "3.0.45",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmarttime/-/smarttime-3.0.45.tgz",
@ -537,6 +520,12 @@
"@types/node": "*"
}
},
"node_modules/@types/which": {
"version": "2.0.1",
"resolved": "https://verdaccio.lossless.one/@types%2fwhich/-/which-2.0.1.tgz",
"integrity": "sha512-Jjakcv8Roqtio6w1gr0D7y6twbhx6gGgFGF5BLwajPpnOIOxFkakFhCq+LmyyeAz7BX6ULrjBOxdKaCDy+4+dQ==",
"license": "MIT"
},
"node_modules/@types/yargs": {
"version": "16.0.3",
"resolved": "https://verdaccio.lossless.one/@types%2fyargs/-/yargs-16.0.3.tgz",
@ -1133,6 +1122,12 @@
"dev": true,
"license": "MIT"
},
"node_modules/isexe": {
"version": "2.0.0",
"resolved": "https://verdaccio.lossless.one/isexe/-/isexe-2.0.0.tgz",
"integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=",
"license": "ISC"
},
"node_modules/js-tokens": {
"version": "4.0.0",
"resolved": "https://verdaccio.lossless.one/js-tokens/-/js-tokens-4.0.0.tgz",
@ -1499,6 +1494,15 @@
"readable-stream": "3"
}
},
"node_modules/tree-kill": {
"version": "1.2.2",
"resolved": "https://verdaccio.lossless.one/tree-kill/-/tree-kill-1.2.2.tgz",
"integrity": "sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==",
"license": "MIT",
"bin": {
"tree-kill": "cli.js"
}
},
"node_modules/ts-node": {
"version": "10.7.0",
"resolved": "https://verdaccio.lossless.one/ts-node/-/ts-node-10.7.0.tgz",
@ -1593,7 +1597,7 @@
"node": ">=4.0.0"
}
},
"node_modules/tsutils": {
"node_modules/tslint/node_modules/tsutils": {
"version": "2.29.0",
"resolved": "https://verdaccio.lossless.one/tsutils/-/tsutils-2.29.0.tgz",
"integrity": "sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA==",
@ -1607,9 +1611,9 @@
}
},
"node_modules/typescript": {
"version": "4.6.2",
"resolved": "https://verdaccio.lossless.one/typescript/-/typescript-4.6.2.tgz",
"integrity": "sha512-HM/hFigTBHZhLXshn9sN37H085+hQGeJHJ/X7LpBWLID/fbc2acUMfU+lGD98X81sKP+pFa9f0DZmCwB9GnbAg==",
"version": "4.7.0-dev.20220311",
"resolved": "https://verdaccio.lossless.one/typescript/-/typescript-4.7.0-dev.20220311.tgz",
"integrity": "sha512-ZNMv/ta7e5SqRO591yC36VBmsM4+S6u60MFW3xOwKrrm/RbPCNJjwS+lmSY57avA0VIAUnokWlm+ThWBNo0awQ==",
"license": "Apache-2.0",
"bin": {
"tsc": "bin/tsc",
@ -1650,6 +1654,21 @@
"node": ">= 8"
}
},
"node_modules/which": {
"version": "2.0.2",
"resolved": "https://verdaccio.lossless.one/which/-/which-2.0.2.tgz",
"integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
"license": "ISC",
"dependencies": {
"isexe": "^2.0.0"
},
"bin": {
"node-which": "bin/node-which"
},
"engines": {
"node": ">= 8"
}
},
"node_modules/wrap-ansi": {
"version": "7.0.0",
"resolved": "https://verdaccio.lossless.one/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
@ -1806,56 +1825,18 @@
}
},
"@gitzone/tsbuild": {
"version": "2.1.29",
"resolved": "https://verdaccio.lossless.one/@gitzone%2ftsbuild/-/tsbuild-2.1.29.tgz",
"integrity": "sha512-rS0WlwXKb0W+gjFvVgcr1h+ZWRQTBwDm9RylEipPsDb+RmbTYKFT1xtoS53TWAgSKJouknVfsLowbSEic9+75g==",
"version": "2.1.43",
"resolved": "https://verdaccio.lossless.one/@gitzone%2ftsbuild/-/tsbuild-2.1.43.tgz",
"integrity": "sha512-7vWO3Od03JGXQzmrdFahsgNST5LpaJjOREL1lvO1gUfbOIyJiFLr/SpI2pRTKd181YETbXu1RCp8VoVyJP3YDg==",
"dev": true,
"requires": {
"@pushrocks/early": "^3.0.6",
"@pushrocks/smartcli": "^3.0.14",
"@pushrocks/smartfile": "^8.0.10",
"@pushrocks/smartfile": "^9.0.6",
"@pushrocks/smartlog": "^2.0.44",
"@pushrocks/smartpath": "^4.0.3",
"@pushrocks/smartpromise": "^3.1.6",
"typescript": "^4.4.2"
},
"dependencies": {
"@pushrocks/smartfile": {
"version": "8.0.11",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartfile/-/smartfile-8.0.11.tgz",
"integrity": "sha512-mujs1mDgorsryQ8OZuL94MZZDYL3+cbdPKaXSchPjyxOOx8iGacUzc5BK4jDsImYeYEo07MpdJ5BjvGkORQR/w==",
"dev": true,
"requires": {
"@pushrocks/smartfile-interfaces": "^1.0.7",
"@pushrocks/smarthash": "^2.1.10",
"@pushrocks/smartjson": "^4.0.6",
"@pushrocks/smartmime": "^1.0.5",
"@pushrocks/smartpath": "^4.0.3",
"@pushrocks/smartpromise": "^3.1.6",
"@pushrocks/smartrequest": "^1.1.52",
"@types/fs-extra": "^9.0.13",
"@types/glob": "^7.2.0",
"@types/js-yaml": "^4.0.5",
"fs-extra": "^10.0.0",
"glob": "^7.2.0",
"js-yaml": "^4.1.0"
}
},
"argparse": {
"version": "2.0.1",
"resolved": "https://verdaccio.lossless.one/argparse/-/argparse-2.0.1.tgz",
"integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
"dev": true
},
"js-yaml": {
"version": "4.1.0",
"resolved": "https://verdaccio.lossless.one/js-yaml/-/js-yaml-4.1.0.tgz",
"integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==",
"dev": true,
"requires": {
"argparse": "^2.0.1"
}
}
"@pushrocks/smartpromise": "^3.1.7",
"typescript": "4.7.0-dev.20220311"
}
},
"@pushrocks/consolecolor": {
@ -1888,7 +1869,6 @@
"version": "4.0.20",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2flik/-/lik-4.0.20.tgz",
"integrity": "sha512-DJbxSZFwDuHe4W7dU5anyO72gy4woZpkxSpySphdHbSYZf50VJ1sMOKIccSpgRIczeB0BTR5i0c+cKnNFrg2jw==",
"dev": true,
"requires": {
"@pushrocks/smartdelay": "^2.0.10",
"@pushrocks/smartmatch": "^1.0.7",
@ -1922,6 +1902,15 @@
"@pushrocks/smartpromise": "^3.0.6"
}
},
"@pushrocks/smartexit": {
"version": "1.0.20",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartexit/-/smartexit-1.0.20.tgz",
"integrity": "sha512-u/KgA7s2zAtZ7gZvL13HZbO3mZATvjfCLU8Ez6h8VweG8UsIBVaPfYziMDCmJOWIPYLGzEW8eG/u4mCHuyLBow==",
"requires": {
"@pushrocks/lik": "^4.0.20",
"@pushrocks/smartdelay": "^2.0.3"
}
},
"@pushrocks/smartfile": {
"version": "9.0.6",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartfile/-/smartfile-9.0.6.tgz",
@ -2093,6 +2082,19 @@
}
}
},
"@pushrocks/smartshell": {
"version": "2.0.30",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartshell/-/smartshell-2.0.30.tgz",
"integrity": "sha512-HPgdTFzfzhk2TQau/jVdYNSANlxyBZdqq2vyZ+bZahegVHfH/27Zur5Fk+2vE16VJjJMqP7zcvDITUe2+ipgJg==",
"requires": {
"@pushrocks/smartdelay": "^2.0.13",
"@pushrocks/smartexit": "^1.0.20",
"@pushrocks/smartpromise": "^3.1.6",
"@types/which": "^2.0.1",
"tree-kill": "^1.2.2",
"which": "^2.0.2"
}
},
"@pushrocks/smarttime": {
"version": "3.0.45",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmarttime/-/smarttime-3.0.45.tgz",
@ -2206,6 +2208,11 @@
"@types/node": "*"
}
},
"@types/which": {
"version": "2.0.1",
"resolved": "https://verdaccio.lossless.one/@types%2fwhich/-/which-2.0.1.tgz",
"integrity": "sha512-Jjakcv8Roqtio6w1gr0D7y6twbhx6gGgFGF5BLwajPpnOIOxFkakFhCq+LmyyeAz7BX6ULrjBOxdKaCDy+4+dQ=="
},
"@types/yargs": {
"version": "16.0.3",
"resolved": "https://verdaccio.lossless.one/@types%2fyargs/-/yargs-16.0.3.tgz",
@ -2613,6 +2620,11 @@
"integrity": "sha512-+lP4/6lKUBfQjZ2pdxThZvLUAafmZb8OAxFb8XXtiQmS35INgr85hdOGoEs124ez1FCnZJt6jau/T+alh58QFQ==",
"dev": true
},
"isexe": {
"version": "2.0.0",
"resolved": "https://verdaccio.lossless.one/isexe/-/isexe-2.0.0.tgz",
"integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA="
},
"js-tokens": {
"version": "4.0.0",
"resolved": "https://verdaccio.lossless.one/js-tokens/-/js-tokens-4.0.0.tgz",
@ -2853,6 +2865,11 @@
"readable-stream": "3"
}
},
"tree-kill": {
"version": "1.2.2",
"resolved": "https://verdaccio.lossless.one/tree-kill/-/tree-kill-1.2.2.tgz",
"integrity": "sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A=="
},
"ts-node": {
"version": "10.7.0",
"resolved": "https://verdaccio.lossless.one/ts-node/-/ts-node-10.7.0.tgz",
@ -2898,6 +2915,17 @@
"semver": "^5.3.0",
"tslib": "^1.13.0",
"tsutils": "^2.29.0"
},
"dependencies": {
"tsutils": {
"version": "2.29.0",
"resolved": "https://verdaccio.lossless.one/tsutils/-/tsutils-2.29.0.tgz",
"integrity": "sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA==",
"dev": true,
"requires": {
"tslib": "^1.8.1"
}
}
}
},
"tslint-config-prettier": {
@ -2906,19 +2934,10 @@
"integrity": "sha512-xPw9PgNPLG3iKRxmK7DWr+Ea/SzrvfHtjFt5LBl61gk2UBG/DB9kCXRjv+xyIU1rUtnayLeMUVJBcMX8Z17nDg==",
"dev": true
},
"tsutils": {
"version": "2.29.0",
"resolved": "https://verdaccio.lossless.one/tsutils/-/tsutils-2.29.0.tgz",
"integrity": "sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA==",
"dev": true,
"requires": {
"tslib": "^1.8.1"
}
},
"typescript": {
"version": "4.6.2",
"resolved": "https://verdaccio.lossless.one/typescript/-/typescript-4.6.2.tgz",
"integrity": "sha512-HM/hFigTBHZhLXshn9sN37H085+hQGeJHJ/X7LpBWLID/fbc2acUMfU+lGD98X81sKP+pFa9f0DZmCwB9GnbAg=="
"version": "4.7.0-dev.20220311",
"resolved": "https://verdaccio.lossless.one/typescript/-/typescript-4.7.0-dev.20220311.tgz",
"integrity": "sha512-ZNMv/ta7e5SqRO591yC36VBmsM4+S6u60MFW3xOwKrrm/RbPCNJjwS+lmSY57avA0VIAUnokWlm+ThWBNo0awQ=="
},
"universalify": {
"version": "2.0.0",
@ -2941,6 +2960,14 @@
"integrity": "sha512-EqPmREeOzttaLRm5HS7io98goBgZ7IVz79aDvqjD0kYXLtFZTc0T/U6wHTPKyIjb+MdN7DFIIX6hgdBEpWmfPA==",
"dev": true
},
"which": {
"version": "2.0.2",
"resolved": "https://verdaccio.lossless.one/which/-/which-2.0.2.tgz",
"integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
"requires": {
"isexe": "^2.0.0"
}
},
"wrap-ansi": {
"version": "7.0.0",
"resolved": "https://verdaccio.lossless.one/wrap-ansi/-/wrap-ansi-7.0.0.tgz",

View File

@ -1,6 +1,6 @@
{
"name": "@gitzone/tsrun",
"version": "1.2.20",
"version": "1.2.23",
"description": "run typescript programs efficiently",
"main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts",
@ -11,12 +11,13 @@
"tsrun": "./cli.js"
},
"scripts": {
"test": "(tsbuild && node ./cli.js test/test.ts)",
"test": "(tsbuild && node ./cli.js test/test.js sayhello)",
"format": "(gitzone format)",
"build": "(tsbuild)"
},
"devDependencies": {
"@gitzone/tsbuild": "2.1.29",
"@gitzone/tsbuild": "^2.1.43",
"@pushrocks/smartcli": "^3.0.14",
"@types/node": "^17.0.21",
"node-fetch": "^3.2.2",
"tslint": "^6.1.2",
@ -24,8 +25,9 @@
},
"dependencies": {
"@pushrocks/smartfile": "^9.0.6",
"@pushrocks/smartshell": "^2.0.30",
"ts-node": "^10.7.0",
"typescript": "^4.6.2"
"typescript": "4.7.0-dev.20220311"
},
"private": false,
"files": [

View File

@ -2,9 +2,13 @@ const textToPost: string = 'Test runs!';
console.log(textToPost);
const run = async () => {
// lets test esm
console.warn('remember to enable esm checks once TypeScript 4.5 is released.')
// const nodeFetch = await import('node-fetch');
const smartcli = await import('@pushrocks/smartcli');
const smartcliInstance = new smartcli.Smartcli();
console.log(process.argv)
smartcliInstance.addCommand('sayhello').subscribe(async argvArg => {
console.log('hello there');
})
smartcliInstance.startParse();
}
run();

View File

@ -1,23 +1,9 @@
import * as path from 'path';
import * as tsNode from 'ts-node';
import { CompilerOptions } from 'typescript';
import * as plugins from './plugins.js';
const defaultTsNodeOptions: tsNode.CreateOptions = {
compilerOptions: {
lib: ['dom'],
target: <any>'es2020', // Script Target should be a string -> 2 is for ES2015
experimentalDecorators: true,
esModuleInterop: true,
strictNullChecks: false,
moduleResolution: <any>'node12',
module: <any>'es2020',
importsNotUsedAsValues: <any>'preserve',
} as CompilerOptions,
skipIgnore: true,
esm: true,
};
import { dirname } from 'path';
import { fileURLToPath } from 'url';
tsNode.register(defaultTsNodeOptions);
const __dirname = dirname(fileURLToPath(import.meta.url));
export const runCli = async () => {
// contents of argv array
@ -25,8 +11,16 @@ export const runCli = async () => {
// process.argv[1] -> tsrun executable
const pathToTsFile = process.argv[2];
const pathToLoad = path.join(process.cwd(), pathToTsFile);
process.argv.splice(2, 1);
// console.log(process.argv);
import(pathToLoad);
const tsNodeLoaderPath = plugins.path.join(__dirname, 'loader.js')
const pathToLoad = plugins.path.join(process.cwd(), pathToTsFile);
process.argv.splice(0, 3); // this ensures transparent arguments for the child process
const smartshellInstance = new plugins.smartshell.Smartshell({
executor: 'bash'
});
smartshellInstance.exec(`node --loader ${tsNodeLoaderPath} ${pathToLoad} ${process.argv.reduce((prevArg, currentArg) => {
return prevArg + ' ' + currentArg;
})}`);
};

20
ts/loader.ts Normal file
View File

@ -0,0 +1,20 @@
import * as plugins from './plugins.js';
import type { CompilerOptions } from 'typescript';
const defaultTsNodeOptions: plugins.tsNode.CreateOptions = {
compilerOptions: {
lib: ['dom'],
target: <any>'es2020', // Script Target should be a string -> 2 is for ES2015
experimentalDecorators: true,
esModuleInterop: true,
strictNullChecks: false,
moduleResolution: <any>'node12',
module: <any>'ESNext',
importsNotUsedAsValues: <any>'preserve',
} as CompilerOptions,
esm: true,
skipIgnore: true,
transpileOnly: true
};
export const { resolve, load, getFormat, transformSource } = plugins.tsNode.createEsmHooks(plugins.tsNode.register(defaultTsNodeOptions)) as any;

15
ts/plugins.ts Normal file
View File

@ -0,0 +1,15 @@
// @pushrocks scope
import * as smartshell from '@pushrocks/smartshell';
export {
smartshell
}
// third party scope
import * as path from 'path';
import * as tsNode from 'ts-node';
export {
path,
tsNode
}

7
tsconfig.json Normal file
View File

@ -0,0 +1,7 @@
{
"compilerOptions": {
"module": "ES2022",
"target": "ES2020",
"moduleResolution": "Node12"
}
}