question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support for TypeScript template and eject command

See original GitHub issue

Hi, 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 to package.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 to build (or dist) 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:closed
  • Created 5 years ago
  • Reactions:12
  • Comments:26 (19 by maintainers)

github_iconTop GitHub Comments

5reactions
alemagiocommented, Feb 20, 2020

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?

2reactions
mcollinacommented, Nov 19, 2018

I’m +1 on adding support for ts.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found