Skip to content

Create start and dev Commands with Improved Implementation & Move to tsx #15

@Daniel-Boll

Description

@Daniel-Boll

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:

  • Start: node -r dotenv/config -r ./dist/register-path.js ./dist/src/main.js
  • Development: tsnd -r dotenv/config -r tsconfig-paths/register ./src/main.ts

The proposal is to replace these with two simple commands, start and dev, and change the underlying package from ts-node-dev to tsx.

Proposed Changes

  1. Replace Start Command: Introduce a start command to replace the current complex command.
  2. Replace Development Command: Introduce a dev command for development, replacing the existing command.
  3. Move from ts-node-dev to tsx: As ts-node-dev has not been actively maintained and tsx (https://github.com/esbuild-kit/tsx) has been more broadly used, it is suggested to migrate to tsx, which may provide better performance and compatibility.

Implementation Details

start Command:

The start command can replace the current command for running the application.

expressots start
dev Command:

The dev command can replace the current command for running the development server.

expressots dev
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
  • ts-node-dev: The ts-node-dev package has not been actively maintained, with the latest updates showing a lack of consistent development. This poses a risk of running into unsupported issues or bugs that might not be addressed promptly.
  • tsx: In contrast, tsx is an actively maintained package with regular updates, ensuring that it keeps up with the latest TypeScript features and best practices. This active maintenance promotes stability and support for future enhancements.
Performance
  • Faster Compilation: tsx uses esbuild, known for its remarkable compilation speed. This speed can make the development process more efficient, particularly in large codebases.
  • Reduced Startup Time: tsx optimizes the startup time, enabling quicker iterations during development. This can save valuable time for developers and streamline the workflow.
Compatibility
  • Latest TypeScript Features: tsx supports the latest TypeScript features, ensuring compatibility with modern development practices and tools.
  • Flexibility with Configuration: tsx provides a flexible configuration system, allowing customization and fine-tuning to fit the specific needs of the project.
Community Adoption
  • Wider Usage: tsx has seen more extensive adoption within the community, reflecting a positive reception and trust in the package.
  • Contributions: Being a more popular package, tsx benefits from community contributions, resulting in a more refined and robust solution.
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

  • Simplicity: Simplifies the commands to start and develop the project.
  • Maintainability: Utilizes a well-maintained and widely-used package (tsx) over ts-node-dev.
  • Performance: Potentially provides improved speed with tsx.

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.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type
No fields configured for issues without a type.

Projects

Status

Approved

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions