apify / actor-templates

This project is the :house: home of Apify actor template projects to help users quickly get started.
https://apify.com/
26 stars 18 forks source link

Add hello world ts v2 #84

Closed petrpatek closed 3 years ago

petrpatek commented 3 years ago

Created typescript template with the multistage build. Inspired by #7 and internal typescript projects.

pocesar commented 3 years ago

hey @petrpatek that's nice to have TS as first-class citizen in templates ❤️
there are a couple of things with the current approach:

using the start script as node -r ts-node/register/transpile-only src/main.ts solves both of those issues, ts-node adds the sourcemap support out-of-the-box, but adds another 2 issues: bundle size and extra dependencies, and typescript dependency itself is 60MB, an extra second downloading through NPM. IMHO, for the SDK being a runtime, it's worth this dependency hassle. 😄

on the other hand, the side-by-side sourcemaps can be generated using tsconfig.json settings, but every change requires rebuilding, it's very easy to forget doing this when not using the watch mode, and as actors can't have a "hot module replacement" like React or Angular, tsc -w isn't really suitable

petrpatek commented 3 years ago

@B4nan Can I merge it like this?

B4nan commented 3 years ago

Let's see what others think, it looks good to me, and we can iterate on that before sdk v3 gets out.

petrpatek commented 3 years ago

@vladfrangu Thanks for catching this!