{"action":"created","issue":{"url":"https://api.github.com/repos/fastify/fastify-cli/issues/131","repository_url":"https://api.github.com/repos/fastify/fastify-cli","labels_url":"https://api.github.com/repos/fastify/fastify-cli/issues/131/labels{/name}","comments_url":"https://api.github.com/repos/fastify/fastify-cli/issues/131/comments","events_url":"https://api.github.com/repos/fastify/fastify-cli/issues/131/events","html_url":"https://github.com/fastify/fastify-cli/issues/131","id":382278214,"node_id":"MDU6SXNzdWUzODIyNzgyMTQ=","number":131,"title":"Support for TypeScript template and eject command ","user":{"login":"fox1t","id":1620916,"node_id":"MDQ6VXNlcjE2MjA5MTY=","avatar_url":"https://avatars0.githubusercontent.com/u/1620916?v=4","gravatar_id":"","url":"https://api.github.com/users/fox1t","html_url":"https://github.com/fox1t","followers_url":"https://api.github.com/users/fox1t/followers","following_url":"https://api.github.com/users/fox1t/following{/other_user}","gists_url":"https://api.github.com/users/fox1t/gists{/gist_id}","starred_url":"https://api.github.com/users/fox1t/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fox1t/subscriptions","organizations_url":"https://api.github.com/users/fox1t/orgs","repos_url":"https://api.github.com/users/fox1t/repos","events_url":"https://api.github.com/users/fox1t/events{/privacy}","received_events_url":"https://api.github.com/users/fox1t/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2018-11-19T15:54:25Z","updated_at":"2018-11-19T20:40:30Z","closed_at":null,"author_association":"NONE","body":"Hi, guys. It will be nice to include in fastify-cli support for TypeScript projects. \r\nIn order to generate a TS  project we need to change some of the current fastify-cli's commands and to add one new:\r\n * `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.\r\n  * `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.\r\n  * `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.\r\n\r\nIn 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.\r\n\r\nI am looking forward for ideas and I am ready to implement this feature,"},"comment":{"url":"https://api.github.com/repos/fastify/fastify-cli/issues/comments/440034329","html_url":"https://github.com/fastify/fastify-cli/issues/131#issuecomment-440034329","issue_url":"https://api.github.com/repos/fastify/fastify-cli/issues/131","id":440034329,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0MDAzNDMyOQ==","user":{"login":"delvedor","id":4865608,"node_id":"MDQ6VXNlcjQ4NjU2MDg=","avatar_url":"https://avatars0.githubusercontent.com/u/4865608?v=4","gravatar_id":"","url":"https://api.github.com/users/delvedor","html_url":"https://github.com/delvedor","followers_url":"https://api.github.com/users/delvedor/followers","following_url":"https://api.github.com/users/delvedor/following{/other_user}","gists_url":"https://api.github.com/users/delvedor/gists{/gist_id}","starred_url":"https://api.github.com/users/delvedor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/delvedor/subscriptions","organizations_url":"https://api.github.com/users/delvedor/orgs","repos_url":"https://api.github.com/users/delvedor/repos","events_url":"https://api.github.com/users/delvedor/events{/privacy}","received_events_url":"https://api.github.com/users/delvedor/received_events","type":"User","site_admin":false},"created_at":"2018-11-19T20:40:30Z","updated_at":"2018-11-19T20:40:30Z","author_association":"MEMBER","body":"> Ok we can use just --typescript (and maybe --ts?) then.\r\n\r\nI'll go with `--typescript` :)\r\n\r\n> If we want to support fastify start with .ts in production, we need to run always .js fils. This implies that we can't use ts-node to compile on the fly TS code and we have to rely on build folder with .js files. This is not a big problem, but usually in TS projects you really build to js files only on linting/testing/before pushing fase and inside CI env, before Docker image build, for example. Eject is just helper to do automatically what you say here https://github.com/fox1t/fastify-cli#migrating-out-of-fastify-cli-start so we can implement it also without ts-node and TS specific stuff.\r\n\r\nMaybe `npm run dev` could use `ts-node`, while `npm start` is prod only.\r\nI'm not entirely sure that we would need eject to run the project even with typescript.\r\n\r\nRegarding the `debug` script we remove the default linter (the old `npm run lint` command) because it was too opinionated, I fear this script could fall in the same category.\r\n\r\nI didn't say this in my first comment, I'm definitely 👍 on typescript support :)"}}
{"actor":{"display_login":"delvedor"}}