Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for running Node.js apps, officially? (vs. just building libraries) #654

Closed
kaleabmelkie opened this issue Mar 29, 2020 · 4 comments
Labels
kind: feature New feature or request solution: unresolved Issue has been closed by OP but root cause has not necessarily been resolved

Comments

@kaleabmelkie
Copy link

I understand this library is meant to help build other libraries in TypeScript.

However, besides missing console functions at the root level (#478), are there any limitations or reasoning for not running Node.js server apps using this?

It'd be nice to have a zeo-confg setup for running Node.js apps too.

(As far as I can tell, running node . after tsdx build works well for running apps, even for console.log at the root)

@agilgur5
Copy link
Collaborator

However, besides missing console functions at the root level (#478)

Sorry I think you misunderstood something, that issue is a user error where the user was confused why there was no logging during build (your code isn't run during build, it's just compiled).
I don't know what you mean by "missing console functions at root level", console.log works in all environments.

are there any limitations or reasoning for not running Node.js server apps using this?

Per the docs, there is a --target node and there are some people using TSDX for running Lambdas (#6 (comment)), but those are separate use cases.
If you're writing an app, you don't need the same tools or to support multiple environments with different CJS, ESM, UMD, dev/prod, etc builds -- there's only one use with an app.

You can probably just use ts-node or just tsc and then node (usually faster than the former). You didn't give a use case for this so I'm not sure why that wouldn't be enough

@kaleabmelkie
Copy link
Author

kaleabmelkie commented Mar 29, 2020

I don't know what you mean by "missing console functions at root level", console.log works in all environments.

My simple use case is similar to running lambads.

This issue is, having just the following line in src/index.ts:

console.log(`something`)

It is not logged during tsdx watch.

But it logs on the console after running tsdx build && node .

I wanted to see my console logs during tsdx watch, because that's how I do most of my debugging.

You can probably just use ts-node or just tsc and then node

Yes, this is what I usually use. But I thought it'd be nice if I could just bootsrap a running app quickly using tsdx, instead of configuring package.json scripts, test, and tsconfig.json everytime.

I understand this feature request might be out of scope for the library, and that's okay for me.. I just wanted to know.

@agilgur5
Copy link
Collaborator

agilgur5 commented Mar 29, 2020

It is not logged during tsdx watch.

But it logs on the console after running tsdx build && node .

Ok, sure, that's the same user error as #478. tsdx watch doesn't run any code, it just compiles it in watch mode (similar to tsc --watch)

You might be able to achieve something similar with tsdx watch --onSuccess node .

But again, that'll probably be much slower and use much more memory than plain tsc --watch, TSDX runs Rollup and Babel and many other plugins (on top of rpts2 being much slower and using more memory than tsc alone: ezolenko/rollup-plugin-typescript2#189)

But I thought it'd be nice if I could just bootsrap a running app quickly using tsdx, instead of configuring package.json scripts, test, and tsconfig.json everytime.

I understand this feature request might be out of scope for the library, and that's okay for me.. I just wanted to know.

Thanks for providing a use case. I think the use case is reasonable, but the key features of TSDX are unnecessary for that.
tsdx build is by far the biggest feature of TSDX and you don't need it (and therefore don't need all the dependency bloat either).

Could make a far simpler library to just handle running Node.js apps. We could in the future support this and re-use code between the two I suppose.

Creating a template for this could be possible too. There is also #238 around a similar topic.

I won't say it's entirely out-of-scope, but it's enough so that it doesn't really have any priority, so I can't say this is on my roadmap at all

@kaleabmelkie
Copy link
Author

Okay, thanks for the quick clarification.

@agilgur5 agilgur5 added the kind: feature New feature or request label Mar 29, 2020
@agilgur5 agilgur5 changed the title Support for running Node.js apps, officially? Support for running Node.js apps, officially? (vs. just building libraries) Mar 29, 2020
@agilgur5 agilgur5 added the solution: unresolved Issue has been closed by OP but root cause has not necessarily been resolved label Apr 4, 2020
@agilgur5 agilgur5 added this to the Future Non-breaking milestone Oct 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: feature New feature or request solution: unresolved Issue has been closed by OP but root cause has not necessarily been resolved
Projects
None yet
Development

No branches or pull requests

2 participants