-
Notifications
You must be signed in to change notification settings - Fork 4
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
Create start
and dev
Commands with Improved Implementation & Move to tsx
#15
Comments
If you are referring to the commands in the templates, the correct commands are these ones: "build": "tsc -p tsconfig.build.json && cp -R ./register-path.js tsconfig.build.json package.json ./dist",
"dev": "tsnd -r dotenv/config -r tsconfig-paths/register ./src/main.ts",
"prod": "node -r dotenv/config -r ./dist/register-path.js ./dist/src/main.js", These commands above are project bind commands, they are not available globally from the Are you suggesting to add these commands to the CLI and then change the signature of the project command of the templates to possibly:
Is this the correct understanding? If this is what you are trying to achieve, I think is a good idea however you need to have in mind that we gonna be generating a dependency from the template to the CLI. And any change in the template that involves commands will have to change CLI as well. Please, create a POC to demonstrate this proposal to understand the impact, the dependencies that will be included, dependency sizes, as well as a comparison between tsnd versus tsx performance during development. Attach your code and send a link to your POC to be appreciated. |
@rsaz I've been attempting to integrate |
@Daniel-Boll can you respond please to the questions above mentioned in the previous message? This will help us to understand how do you intend to implement and resolve those issues mentioned above. |
Yes, that's the plan. Instead of using |
For now, I'd say we stick with |
@joaoneto as mentioned we are in the stage 2. Let us know, or discuss with @Daniel-Boll so that you guys can POC these two scenarios: 1 - Change the commands from "build": "tsc -p tsconfig.build.json && cp -R ./register-path.js tsconfig.build.json package.json ./dist",
"dev": "tsnd -r dotenv/config -r tsconfig-paths/register ./src/main.ts",
"prod": "node -r dotenv/config -r ./dist/register-path.js ./dist/src/main.js", To expressots build
expressots dev
expressots prod 2 - Your proposal #16 The changes that I propose are the following: Add a command option, for example: --experimental, --use-swc, so that the template uses the build with SWC Waiting feedback! |
Nice! A suggestion to proceed with the two changes, would be to create in the cli the bin scripts of the package.json, that will trigger: expressots build
expressots dev
expressots prod once we opt to use the swc transpiler, we would pass a flag: expressots build --experimental
expressots dev --experimental
expressots prod --experimental I created a basic funcional project that uses expressots with the build/test/etc.. tools in the swc's performant environment called expressots-opinionated-experimental so that we can have some insights too, what do you think? |
@joaoneto, the progress appears promising, and your approach seems solid. The next logical step might be to conduct a benchmark, comparing the performance with and without the integration of SWC in the build process. It would be beneficial to document these findings in the README file itself, providing clear insight for anyone exploring the repository. Rest assured, I'll be monitoring the changes in the repo by subscribing to the changes look forward to seeing the results. Best Regards, |
@joaoneto to your points: Should we separate bin expressots scripts?
Should we create templates for experimental?
Few things to consider:
Configuration: SWC has its own configuration file (.swcrc), which is separate from TypeScript's tsconfig.json. You will have to configure SWC separately to ensure that it understands your project's needs. Now we gonna have 2 configuration files, we need to clearly define where the user should use one rather than the other, or for swc just use .swcrc file Compatibility: SWC aims to support most TypeScript syntax and features, but there might be subtle differences or unsupported edge cases. It's a good idea to thoroughly test the templates/application Yeah, lets proceed and observe these points. Once you get a branch send me out to test as well. Keep up the good work! |
@rsaz Very well observed! Let me see if I understand. I imagine that for the script bin Unfortunately, swc currently does not support tsconfig.json, so .swcrc would have to be kept only for transpiling. It doesn’t need to change, and tsconfig.json would be the source of truth, that validate types with (tsc --noEmit). Those who opt to use the experimental template should accept the risks of possibly not being compatible with some extreme case without swc support. We should have a very clear warning that this is a tradeoff between optimizing build time and the features you intend to use. |
Currently the CLI already supports the commands inferred: "build": "expressots run build",
"dev": "expressots run dev",
"prod": "expressots run prod", I will create a ticket to compress even more to: "build": "expressots build",
"dev": "expressots dev",
"prod": "expressots prod", Also allow parameters to be passed as well as to change the ts-node-dev dependency out of the picture, Alternatives to be compared:
|
At the time I tried |
Introduction
The existing CLI commands for starting the application and running in development mode could be simplified and optimized. Currently, the following commands are used:
node -r dotenv/config -r ./dist/register-path.js ./dist/src/main.js
tsnd -r dotenv/config -r tsconfig-paths/register ./src/main.ts
The proposal is to replace these with two simple commands,
start
anddev
, and change the underlying package from ts-node-dev to tsx.Proposed Changes
start
command to replace the current complex command.dev
command for development, replacing the existing command.Implementation Details
start
Command:The
start
command can replace the current command for running the application.dev
Command:The
dev
command can replace the current command for running the development server.Use
tsx
:Move from ts-node-dev to
tsx
Overview
I'm proposing to migrate from ts-node-dev to tsx (https://github.com/esbuild-kit/tsx) for running TypeScript files. This change is driven by the following critical factors:
Active Maintenance
Performance
Compatibility
Community Adoption
Conclusion
The migration from ts-node-dev to tsx offers substantial benefits, including enhanced performance, active maintenance, and compatibility with modern development practices. Aligning with a package that enjoys broader community support will contribute to the project's long-term success and maintainability. Therefore, transitioning to tsx is a strategic move that we believe will positively impact the development experience in ExpressoTS.
Benefits
tsx
) over ts-node-dev.Conclusion
These changes aim to enhance the CLI experience by providing more straightforward commands and migrating to a more efficient and actively maintained package. Feedback are welcome for this proposed update.
The text was updated successfully, but these errors were encountered: