-
Notifications
You must be signed in to change notification settings - Fork 32
Open
Description
Hello. I like being able to run my scripts locally, they usually have a little short main() function they run if they are run directly.
At the moment, if I create a short script & run tspath -f throws, tspath seems to not be able to work with it:
TSPath 1.3.7
Parsing project: take-over-the-world /iamgroot/src/take-over-the-world/
Unable to parse file: /iamgroot/src/take-over-the-world/dist/config.js
Error: Error: Line 1: Unexpected token ILLEGAL
at ErrorHandler.constructError (/iamgroot/src/take-over-the-world/node_modules/esprima/dist/esprima.js:5012:22)
at ErrorHandler.createError (/iamgroot/src/take-over-the-world/node_modules/esprima/dist/esprima.js:5028:27)
at ErrorHandler.throwError (/iamgroot/src/take-over-the-world/node_modules/esprima/dist/esprima.js:5035:21)
at Scanner.throwUnexpectedToken (/iamgroot/src/take-over-the-world/node_modules/esprima/dist/esprima.js:5164:35)
at Scanner.scanPunctuator (/iamgroot/src/take-over-the-world/node_modules/esprima/dist/esprima.js:5667:19)
at Scanner.lex (/iamgroot/src/take-over-the-world/node_modules/esprima/dist/esprima.js:6264:22)
at Parser.nextToken (/iamgroot/src/take-over-the-world/node_modules/esprima/dist/esprima.js:2079:34)
at new Parser (/iamgroot/src/take-over-the-world/node_modules/esprima/dist/esprima.js:1916:15)
at Object.parse (/iamgroot/src/take-over-the-world/node_modules/esprima/dist/esprima.js:120:19)
at ParserEngine.processFile (/iamgroot/src/take-over-the-world/node_modules/tspath/src/parser-engine.js:170:27) {
index: 0,
lineNumber: 1,
description: 'Unexpected token ILLEGAL'
}
Example dist/config.js:
#!/usr/bin/env ts-node
console.log("hi!")
Some general description of using ts-node to make scripts directly runnable, the technique i'm trying to use, is in this great write-up: Shelling with TypeScript.
Metadata
Metadata
Assignees
Labels
No labels