expressots-cli icon indicating copy to clipboard operation
expressots-cli copied to clipboard

Feat/experimetal transpile with swc

Open joaoneto opened this issue 2 years ago • 2 comments

Pull Request Guidelines

Our guidelines for submitting a pull request.

Before submitting a Pull Request, please make sure you have verified the following:

  • [ ] The commit message follows our guidelines:
    • A good commit message should be two things: meaningful and concise. It should not contain every single detail, describing each changed line—we can see all the changes in Git—but, at the same time, it should say enough to avoid ambiguity.
    • We use Microverse's commit message convention
    • The convention stablish that a commit message has to be in the present tense, imperative and lowercase.
    • Example: fix typo in README.md
  • [ ] Tests for the changes have been added (for bug fixes / features)
  • [ ] Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • [ ] Bugfix
  • [x] Feature
  • [ ] Code style update (formatting, local variables)
  • [ ] Refactoring (no functional changes, no api changes)
  • [ ] Build related changes
  • [ ] CI related changes
  • [ ] Other... Please describe:

What is the current behavior?

Please describe the current behavior that you are modifying, or link to a relevant issue.

Issue Number: N/A

What is the new behavior?

Describe the new behavior or link to a relevant issue.

Does this PR introduce a breaking change?

  • [ ] Yes
  • [x] No

If this PR contains a breaking change, please describe the impact and migration path for existing applications below.

Other information

Added experimental flag for templates (see: https://github.com/expressots/expressots-cli/pull/17)

An interactive stdout example: image

Added cli commands:

This pull request moves the dependencies that used to be in the templates to the CLI, making it essential for the build. This change simplifies the installation and maintenance of the templates, as they no longer need to have the same dependencies as the CLI. It also allows the CLI to have more control over the build process and use different tools for different tasks.

The pull request adds new dependencies to the expressots-cli package.json file:

  • @swc/cli
  • @swc/core
  • @swc/register
  • concurrently
  • nodemon
  • rimraf
  • ts-node-dev
  • tsconfig-paths

It also adds a new dev dependency:

  • @types/nodemon

The new dependencies can be removed from the templates.

The pull request also adds new commands to the expressots-cli bin file:

  • expressots dev: uses ts-node-dev to start the server and watch for changes in the ./src directory and reload, showing type errors.

  • expressots dev --experimental: uses nodemon in conjunction with tsc and eslint respectively to start the server and watch for changes in the ./src directory and reload and in parallel validate the typing and code style, showing errors.

  • expressots build: uses tsc that look for tsconfig.build.json to transpile a hole project in dist

  • expressots build --experimental: uses concurrently to start types, lint and build (with swc) in parallel, and if one of these tasks fail, the process exit code is an error

Any other information that is important to this PR.

joaoneto avatar Aug 21 '23 22:08 joaoneto

👇 Click on the image for a new way to code review

Review these changes using an interactive CodeSee Map

Legend

CodeSee Map legend

ghost avatar Aug 21 '23 22:08 ghost

As soon as @juliano-soares approve it, @rsaz may test it on Windows and merge.

Daniel-Boll avatar Aug 23 '23 12:08 Daniel-Boll

We are currently using tsx and tsc combined. With SWC we had few issues with compatibility, and didn't worth to fix as tsx + tsc deliver a good performance for the current system.

rsaz avatar Dec 03 '24 09:12 rsaz