benawad / tsconfig.json Goto Github PK
View Code? Open in Web Editor NEWQuickly create an opinionated tsconfig.json
License: MIT License
Quickly create an opinionated tsconfig.json
License: MIT License
The tsconfig for node is not optimal if using node v14.
Could we add new configs suffixed with node version ?
And maybe we could use process.version
to infer the correct config.
More information about optimal tsconfig for node v14 can be found here
I can do a PR, if you are ok with that
It would be neat to add flags e.g. npx tsconfig.json --react
for convenience. I'm using the command as part of a zsh alias, so this would allow me to avoid having the select the same option every time.
It should let me choose between react, react native or node (as per this video https://www.youtube.com/watch?v=I6ypD7qv3Z8&t=296s) but it only create a file with the following
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/../tsconfig.json/src/index.js" "$@"
ret=$?
else
node "$basedir/../tsconfig.json/src/index.js" "$@"
ret=$?
fi
exit $ret
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/../tsconfig.json/src/index.js" "$@"
ret=$?
else
node "$basedir/../tsconfig.json/src/index.js" "$@"
ret=$?
fi
exit $ret
Could you know tsconfig for VueJs? If u know, can you create one? Thank's you!
Hello, the new config file is not good with my NodeJS project. I'm copying the old version for now. If you can fix that issue it would be great.
System Information:
node -v
14.15.1
uname -osr
Linux 5.8.0-41-generic GNU/Linux
yarn -v
1.22.10
npm -v
7.5.2
Problem:
https://github.com/benawad/tsconfig.json/blob/master/src/index.js#L61 is causing the generated tsconfig file to have broken formatting (see screenshot below)
Possible solution:
Fixable by removing the call to the JSON.stringify()
method and simply passing config.toString()
to writeFile
method.
When i type npx tsconfig.json
and hit enter, a notepad called tsconfig.json
opens containing:
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
exec "$basedir/node" "$basedir/node_modules/tsconfig.json/src/index.js" "$@"
else
exec node "$basedir/node_modules/tsconfig.json/src/index.js" "$@"
fi
The shell waits while the notepad is open. The shell now contains:
C:\Users\simon>npx tsconfig.json
C:\Users\simon>
This is the case for
On a Windows 10 Desktop
I don't know if this is a problem on my end.
Hi Ben, I'm planning to change the way we read and write config files. I feel like downloading the scripts along with the files is a little bit redundant, and I am not sure if it would be a good idea to stick the files in your github repo and read it using the github api which will effectively reduce the size.
C:\Users\Saif\AppData\Local\npm-cache\_npx\bb22b66c4c94b5c9\node_modules\.bin\tsconfig.json
the code says:
`#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\,/,g')")
case uname
in
CYGWIN|MINGW|MSYS) basedir=cygpath -w "$basedir"
;;
esac
if [ -x "$basedir/node" ]; then
exec "$basedir/node" "$basedir/../tsconfig.json/src/index.js" "$@"
else
exec node "$basedir/../tsconfig.json/src/index.js" "$@"
fi`
Hi Ben,
I was wondering if you could publish the package with all the new modifications so the people using it since then can benefit from them?
Hello!
this repo is very interesting on creating tsconfig, but is there any tutorial on using this?
or maybe @benawad has some tutorial in his youtube channel that i can create more informational README based on?
For some reason this tsconfig does not allow es modules:
(node:4907) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)
Waiting for the debugger to disconnect...
/home/jasterv/crud/dist/index.js:1
import app from './api/server';
^^^^^^
SyntaxError: Cannot use import statement outside a module
at Object.compileFunction (node:vm:352:18)
at wrapSafe (node:internal/modules/cjs/loader:1025:15)
at Module._compile (node:internal/modules/cjs/loader:1059:27)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1124:10)
at Module.load (node:internal/modules/cjs/loader:975:32)
at Function.Module._load (node:internal/modules/cjs/loader:816:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:79:12)
at node:internal/main/run_main_module:17:47
I have tried every fix and still can't seem to make it run the command instead of opening the file.
Hey Ben, this project would be a lot nicer if it has a feature of pulling tsconfig.json from any public GitHub repo that has it. This way everyone can use this package to create "your opinionated" and "<user>
opinionated" tsconfig.
npx tsconfig.json -t benawad:dogehouse/baklava/tsconfig.json
npx tsconfig.json -t 41y08h:jstube-api
Looking forward to this feature, thanks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.