Support for TypeScript template and eject command
See original GitHub issueHi, guys. It will be nice to include in fastify-cli support for TypeScript projects. In order to generate a TS project we need to change some of the current fastify-cli’s commands and to add one new:
start
start a server -> here we can add support for .ts files (auto-discover file extension), add default tsconfig.json file with default compilation rules and use ts-node with inline sourcemap generation to run the code. Notes: Running .ts is not intended for production environment, .ts files will be inside/src
folder, as this is a TS standard defacto.generate
generate a new project -> we need to add new arg--typescript
(-ts
) to generate TypeScript project with all dependencies and to add topackage.json
typings and typescript compiler. In addition we need (just one?) new npm-script to build .ts code.eject
ejects the app (new command) -> creates server.ts file and compiles all TypeScript code from src tobuild
(ordist
) folder and modifies scripts to use newly generated paths. Note: this command could be used also by JS projects.
In addition to that, what do you think to add one more new npm-script for running debugger in package.json
? It would be nice to have it ready inside package.json.
I am looking forward for ideas and I am ready to implement this feature,
Issue Analytics
- State:
- Created 5 years ago
- Reactions:12
- Comments:26 (19 by maintainers)
Top Results From Across the Web
Using TypeScript - Expo Documentation
Expo has first-class support for TypeScript. ... The easiest way to get started is to initialize your new project using a TypeScript template,...
Read more >@carto/cra-template-base-3-typescript - npm
If you aren't satisfied with the build tool and configuration choices, you can eject at any time. This command will remove the single...
Read more >How to import shared typescript code using create-react-app ...
How to import shared typescript code using create-react-app (no eject)? · Setting baseDir in ts-config. · Approaches based on react-app-rewired: ...
Read more >TypeScript and React using create-react-app - Level Up Coding
Initialize your React app with TypeScript. Invoke the create-react-app command with an additional TypeScript option to generate a React application using ...
Read more >Adding TypeScript - Create React App
npx create-react-app my-app --template typescript ... Global installs of create-react-app are no longer supported. To add TypeScript to an ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi, i wanted to use the cli for my own project and found out there is no TS support. If no one else is working on this I would like to open a PR.
I think an option like: –lang=typescript should be good with default like: –lang=javascript
sounds good?
I’m +1 on adding support for ts.