fix(core): update

This commit is contained in:
Philipp Kunz 2022-03-12 14:43:54 +01:00
parent e40c0151bc
commit b66b2083ab
7 changed files with 196 additions and 68 deletions

167
package-lock.json generated
View File

@ -10,14 +10,16 @@
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@pushrocks/smartfile": "^9.0.6", "@pushrocks/smartfile": "^9.0.6",
"@pushrocks/smartshell": "^2.0.30",
"ts-node": "^10.7.0", "ts-node": "^10.7.0",
"typescript": "^4.6.2" "typescript": "4.7.0-dev.20220311"
}, },
"bin": { "bin": {
"tsrun": "cli.js" "tsrun": "cli.js"
}, },
"devDependencies": { "devDependencies": {
"@gitzone/tsbuild": "^2.1.43", "@gitzone/tsbuild": "^2.1.43",
"@pushrocks/smartcli": "^3.0.14",
"@types/node": "^17.0.21", "@types/node": "^17.0.21",
"node-fetch": "^3.2.2", "node-fetch": "^3.2.2",
"tslint": "^6.1.2", "tslint": "^6.1.2",
@ -109,20 +111,6 @@
"tsbuild": "cli.js" "tsbuild": "cli.js"
} }
}, },
"node_modules/@gitzone/tsbuild/node_modules/typescript": {
"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==",
"dev": true,
"license": "Apache-2.0",
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
},
"engines": {
"node": ">=4.2.0"
}
},
"node_modules/@pushrocks/consolecolor": { "node_modules/@pushrocks/consolecolor": {
"version": "2.0.1", "version": "2.0.1",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fconsolecolor/-/consolecolor-2.0.1.tgz", "resolved": "https://verdaccio.lossless.one/@pushrocks%2fconsolecolor/-/consolecolor-2.0.1.tgz",
@ -156,7 +144,6 @@
"version": "4.0.20", "version": "4.0.20",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2flik/-/lik-4.0.20.tgz", "resolved": "https://verdaccio.lossless.one/@pushrocks%2flik/-/lik-4.0.20.tgz",
"integrity": "sha512-DJbxSZFwDuHe4W7dU5anyO72gy4woZpkxSpySphdHbSYZf50VJ1sMOKIccSpgRIczeB0BTR5i0c+cKnNFrg2jw==", "integrity": "sha512-DJbxSZFwDuHe4W7dU5anyO72gy4woZpkxSpySphdHbSYZf50VJ1sMOKIccSpgRIczeB0BTR5i0c+cKnNFrg2jw==",
"dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@pushrocks/smartdelay": "^2.0.10", "@pushrocks/smartdelay": "^2.0.10",
@ -193,6 +180,16 @@
"@pushrocks/smartpromise": "^3.0.6" "@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": { "node_modules/@pushrocks/smartfile": {
"version": "9.0.6", "version": "9.0.6",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartfile/-/smartfile-9.0.6.tgz", "resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartfile/-/smartfile-9.0.6.tgz",
@ -381,6 +378,20 @@
"integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==", "integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==",
"license": "0BSD" "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": { "node_modules/@pushrocks/smarttime": {
"version": "3.0.45", "version": "3.0.45",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmarttime/-/smarttime-3.0.45.tgz", "resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmarttime/-/smarttime-3.0.45.tgz",
@ -509,6 +520,12 @@
"@types/node": "*" "@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": { "node_modules/@types/yargs": {
"version": "16.0.3", "version": "16.0.3",
"resolved": "https://verdaccio.lossless.one/@types%2fyargs/-/yargs-16.0.3.tgz", "resolved": "https://verdaccio.lossless.one/@types%2fyargs/-/yargs-16.0.3.tgz",
@ -1105,6 +1122,12 @@
"dev": true, "dev": true,
"license": "MIT" "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": { "node_modules/js-tokens": {
"version": "4.0.0", "version": "4.0.0",
"resolved": "https://verdaccio.lossless.one/js-tokens/-/js-tokens-4.0.0.tgz", "resolved": "https://verdaccio.lossless.one/js-tokens/-/js-tokens-4.0.0.tgz",
@ -1471,6 +1494,15 @@
"readable-stream": "3" "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": { "node_modules/ts-node": {
"version": "10.7.0", "version": "10.7.0",
"resolved": "https://verdaccio.lossless.one/ts-node/-/ts-node-10.7.0.tgz", "resolved": "https://verdaccio.lossless.one/ts-node/-/ts-node-10.7.0.tgz",
@ -1565,7 +1597,7 @@
"node": ">=4.0.0" "node": ">=4.0.0"
} }
}, },
"node_modules/tsutils": { "node_modules/tslint/node_modules/tsutils": {
"version": "2.29.0", "version": "2.29.0",
"resolved": "https://verdaccio.lossless.one/tsutils/-/tsutils-2.29.0.tgz", "resolved": "https://verdaccio.lossless.one/tsutils/-/tsutils-2.29.0.tgz",
"integrity": "sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA==", "integrity": "sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA==",
@ -1579,9 +1611,9 @@
} }
}, },
"node_modules/typescript": { "node_modules/typescript": {
"version": "4.6.2", "version": "4.7.0-dev.20220311",
"resolved": "https://verdaccio.lossless.one/typescript/-/typescript-4.6.2.tgz", "resolved": "https://verdaccio.lossless.one/typescript/-/typescript-4.7.0-dev.20220311.tgz",
"integrity": "sha512-HM/hFigTBHZhLXshn9sN37H085+hQGeJHJ/X7LpBWLID/fbc2acUMfU+lGD98X81sKP+pFa9f0DZmCwB9GnbAg==", "integrity": "sha512-ZNMv/ta7e5SqRO591yC36VBmsM4+S6u60MFW3xOwKrrm/RbPCNJjwS+lmSY57avA0VIAUnokWlm+ThWBNo0awQ==",
"license": "Apache-2.0", "license": "Apache-2.0",
"bin": { "bin": {
"tsc": "bin/tsc", "tsc": "bin/tsc",
@ -1622,6 +1654,21 @@
"node": ">= 8" "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": { "node_modules/wrap-ansi": {
"version": "7.0.0", "version": "7.0.0",
"resolved": "https://verdaccio.lossless.one/wrap-ansi/-/wrap-ansi-7.0.0.tgz", "resolved": "https://verdaccio.lossless.one/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
@ -1790,14 +1837,6 @@
"@pushrocks/smartpath": "^4.0.3", "@pushrocks/smartpath": "^4.0.3",
"@pushrocks/smartpromise": "^3.1.7", "@pushrocks/smartpromise": "^3.1.7",
"typescript": "4.7.0-dev.20220311" "typescript": "4.7.0-dev.20220311"
},
"dependencies": {
"typescript": {
"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==",
"dev": true
}
} }
}, },
"@pushrocks/consolecolor": { "@pushrocks/consolecolor": {
@ -1830,7 +1869,6 @@
"version": "4.0.20", "version": "4.0.20",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2flik/-/lik-4.0.20.tgz", "resolved": "https://verdaccio.lossless.one/@pushrocks%2flik/-/lik-4.0.20.tgz",
"integrity": "sha512-DJbxSZFwDuHe4W7dU5anyO72gy4woZpkxSpySphdHbSYZf50VJ1sMOKIccSpgRIczeB0BTR5i0c+cKnNFrg2jw==", "integrity": "sha512-DJbxSZFwDuHe4W7dU5anyO72gy4woZpkxSpySphdHbSYZf50VJ1sMOKIccSpgRIczeB0BTR5i0c+cKnNFrg2jw==",
"dev": true,
"requires": { "requires": {
"@pushrocks/smartdelay": "^2.0.10", "@pushrocks/smartdelay": "^2.0.10",
"@pushrocks/smartmatch": "^1.0.7", "@pushrocks/smartmatch": "^1.0.7",
@ -1864,6 +1902,15 @@
"@pushrocks/smartpromise": "^3.0.6" "@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": { "@pushrocks/smartfile": {
"version": "9.0.6", "version": "9.0.6",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartfile/-/smartfile-9.0.6.tgz", "resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartfile/-/smartfile-9.0.6.tgz",
@ -2035,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": { "@pushrocks/smarttime": {
"version": "3.0.45", "version": "3.0.45",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmarttime/-/smarttime-3.0.45.tgz", "resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmarttime/-/smarttime-3.0.45.tgz",
@ -2148,6 +2208,11 @@
"@types/node": "*" "@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": { "@types/yargs": {
"version": "16.0.3", "version": "16.0.3",
"resolved": "https://verdaccio.lossless.one/@types%2fyargs/-/yargs-16.0.3.tgz", "resolved": "https://verdaccio.lossless.one/@types%2fyargs/-/yargs-16.0.3.tgz",
@ -2555,6 +2620,11 @@
"integrity": "sha512-+lP4/6lKUBfQjZ2pdxThZvLUAafmZb8OAxFb8XXtiQmS35INgr85hdOGoEs124ez1FCnZJt6jau/T+alh58QFQ==", "integrity": "sha512-+lP4/6lKUBfQjZ2pdxThZvLUAafmZb8OAxFb8XXtiQmS35INgr85hdOGoEs124ez1FCnZJt6jau/T+alh58QFQ==",
"dev": true "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": { "js-tokens": {
"version": "4.0.0", "version": "4.0.0",
"resolved": "https://verdaccio.lossless.one/js-tokens/-/js-tokens-4.0.0.tgz", "resolved": "https://verdaccio.lossless.one/js-tokens/-/js-tokens-4.0.0.tgz",
@ -2795,6 +2865,11 @@
"readable-stream": "3" "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": { "ts-node": {
"version": "10.7.0", "version": "10.7.0",
"resolved": "https://verdaccio.lossless.one/ts-node/-/ts-node-10.7.0.tgz", "resolved": "https://verdaccio.lossless.one/ts-node/-/ts-node-10.7.0.tgz",
@ -2840,6 +2915,17 @@
"semver": "^5.3.0", "semver": "^5.3.0",
"tslib": "^1.13.0", "tslib": "^1.13.0",
"tsutils": "^2.29.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": { "tslint-config-prettier": {
@ -2848,19 +2934,10 @@
"integrity": "sha512-xPw9PgNPLG3iKRxmK7DWr+Ea/SzrvfHtjFt5LBl61gk2UBG/DB9kCXRjv+xyIU1rUtnayLeMUVJBcMX8Z17nDg==", "integrity": "sha512-xPw9PgNPLG3iKRxmK7DWr+Ea/SzrvfHtjFt5LBl61gk2UBG/DB9kCXRjv+xyIU1rUtnayLeMUVJBcMX8Z17nDg==",
"dev": true "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": { "typescript": {
"version": "4.6.2", "version": "4.7.0-dev.20220311",
"resolved": "https://verdaccio.lossless.one/typescript/-/typescript-4.6.2.tgz", "resolved": "https://verdaccio.lossless.one/typescript/-/typescript-4.7.0-dev.20220311.tgz",
"integrity": "sha512-HM/hFigTBHZhLXshn9sN37H085+hQGeJHJ/X7LpBWLID/fbc2acUMfU+lGD98X81sKP+pFa9f0DZmCwB9GnbAg==" "integrity": "sha512-ZNMv/ta7e5SqRO591yC36VBmsM4+S6u60MFW3xOwKrrm/RbPCNJjwS+lmSY57avA0VIAUnokWlm+ThWBNo0awQ=="
}, },
"universalify": { "universalify": {
"version": "2.0.0", "version": "2.0.0",
@ -2883,6 +2960,14 @@
"integrity": "sha512-EqPmREeOzttaLRm5HS7io98goBgZ7IVz79aDvqjD0kYXLtFZTc0T/U6wHTPKyIjb+MdN7DFIIX6hgdBEpWmfPA==", "integrity": "sha512-EqPmREeOzttaLRm5HS7io98goBgZ7IVz79aDvqjD0kYXLtFZTc0T/U6wHTPKyIjb+MdN7DFIIX6hgdBEpWmfPA==",
"dev": true "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": { "wrap-ansi": {
"version": "7.0.0", "version": "7.0.0",
"resolved": "https://verdaccio.lossless.one/wrap-ansi/-/wrap-ansi-7.0.0.tgz", "resolved": "https://verdaccio.lossless.one/wrap-ansi/-/wrap-ansi-7.0.0.tgz",

View File

@ -11,12 +11,13 @@
"tsrun": "./cli.js" "tsrun": "./cli.js"
}, },
"scripts": { "scripts": {
"test": "(tsbuild && node ./cli.js test/test.ts)", "test": "(tsbuild && node ./cli.js test/test.js sayhello)",
"format": "(gitzone format)", "format": "(gitzone format)",
"build": "(tsbuild)" "build": "(tsbuild)"
}, },
"devDependencies": { "devDependencies": {
"@gitzone/tsbuild": "^2.1.43", "@gitzone/tsbuild": "^2.1.43",
"@pushrocks/smartcli": "^3.0.14",
"@types/node": "^17.0.21", "@types/node": "^17.0.21",
"node-fetch": "^3.2.2", "node-fetch": "^3.2.2",
"tslint": "^6.1.2", "tslint": "^6.1.2",
@ -24,8 +25,9 @@
}, },
"dependencies": { "dependencies": {
"@pushrocks/smartfile": "^9.0.6", "@pushrocks/smartfile": "^9.0.6",
"@pushrocks/smartshell": "^2.0.30",
"ts-node": "^10.7.0", "ts-node": "^10.7.0",
"typescript": "^4.6.2" "typescript": "4.7.0-dev.20220311"
}, },
"private": false, "private": false,
"files": [ "files": [

View File

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

View File

@ -1,23 +1,9 @@
import * as path from 'path'; import * as plugins from './plugins.js';
import * as tsNode from 'ts-node';
import { CompilerOptions } from 'typescript';
const defaultTsNodeOptions: tsNode.CreateOptions = { import { dirname } from 'path';
compilerOptions: { import { fileURLToPath } from 'url';
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,
};
tsNode.register(defaultTsNodeOptions); const __dirname = dirname(fileURLToPath(import.meta.url));
export const runCli = async () => { export const runCli = async () => {
// contents of argv array // contents of argv array
@ -25,8 +11,17 @@ export const runCli = async () => {
// process.argv[1] -> tsrun executable // process.argv[1] -> tsrun executable
const pathToTsFile = process.argv[2]; const pathToTsFile = process.argv[2];
const pathToLoad = path.join(process.cwd(), pathToTsFile); const tsNodeLoaderPath = plugins.path.join(__dirname, 'loader.js')
process.argv.splice(2, 1); const pathToLoad = plugins.path.join(process.cwd(), pathToTsFile);
process.argv.splice(0, 3);
// console.log(process.argv); // console.log(process.argv);
import(pathToLoad);
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"
}
}