Skip to content

Clear dist only when the new files are ready #578

@etienne-dldc

Description

@etienne-dldc

Current Behavior

When working with a monorepo or with linked package if your package was build and you have another bundler using the files in dist. If you either build or start the compilation it will start by deleting the content of dist which does not make bundler happy. In most cases you have to restart the bundler.

Example:

Let say you have two packages app is a create-react-app and b is using tsdx. app is using b.

You build the b package, then start working on app (react-scripts start in app). But then you need to change something in b so you change some file then build b (tsdx build in b) at that point react-scripts will crash because one file is missing and it will not recover even when the file are back. You have to restart app to make it work again.

Desired Behavior

When tsdx build is run, it would be nice if the dist folder was not cleared until the next build output is ready. This way react-scripts and other bundlers would not fail.

Suggested Solution

I guess it should be possible to build to a temp directory then move the files at the end.

Who does this impact? Who is this for?

People working with Monorepo or with linked packages.

Describe alternatives you've considered

Just restart the script when it fail but it's annoying...

Metadata

Metadata

Assignees

No one assigned

    Labels

    PR welcomekind: featureNew feature or requestscope: integrationRelated to an integration, not necessarily to core (but could influence core)scope: upstreamIssue in upstream dependencysolution: duplicateThis issue or pull request already existssolution: unresolvedIssue has been closed by OP but root cause has not necessarily been resolvedtopic: monorepoRelated to Lerna monorepos

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions