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

Add clean command #28

Open
aomarks opened this issue Mar 22, 2022 · 8 comments
Open

Add clean command #28

aomarks opened this issue Mar 22, 2022 · 8 comments
Assignees

Comments

@aomarks
Copy link
Member

aomarks commented Mar 22, 2022

No description provided.

@aomarks aomarks self-assigned this Mar 22, 2022
@aomarks aomarks changed the title Add clean command Add purge command Apr 1, 2022
@aomarks aomarks changed the title Add purge command Add clean command May 15, 2022
@jpzwarte
Copy link

jpzwarte commented Jun 1, 2022

How could you do this without having to create a wireit cli script? (wireit clean)

I just created a custom clean script:

    "clean": {
      "command": "rimraf \"**/*.tsbuildinfo\" \"**/.wireit\" dist docs/dist \"packages/*/dist\" \"packages/*/dist-docs\""
    },

@aomarks
Copy link
Member Author

aomarks commented Jun 1, 2022

It could be invoked like this:

npm run build clean

@jpzwarte
Copy link

jpzwarte commented Jun 1, 2022

I know the watch syntax is similar, but it kinda looks weird? Why not npm run build --clean, so "build" is different from the clean argument?

@aomarks
Copy link
Member Author

aomarks commented Jun 1, 2022

There are a few things that "clean" could mean, by the way:

  1. Bust the cache for the given script (i.e. delete .wireit directory, or part of it), to force an execution.

  2. Delete all declared output files for the given script.

  3. Delete every file that isn't tracked by Git. Wireit won't do this, but git clean -dfx is a good way to do it generally.

And then for any of those options, there is the question of whether it should apply just to the given script, or also to all transitive dependencies.

I'm currently thinking that npm run foo clean should be both [1] and [2]. I'm unsure about whether it should be recursive. Perhaps a --recursive flag to make it recursive.

@aomarks
Copy link
Member Author

aomarks commented Jun 1, 2022

I know the watch syntax is similar, but it kinda looks weird? Why not npm run build --clean, so "build" is different from the clean argument?

It's because npm treats arguments without a leading dash as arguments for the underlying command. npm run build foo will pass foo to the command, but npm run build --foo will interpret --foo as an argument to npm itself. So the options were either npm run build watch or npm run build -- --watch, and the former seemed much nicer.

@aomarks aomarks self-assigned this Jan 18, 2023
@alyahmedaly
Copy link

I found myself using 1 and 2 most of the time

@vdegenne
Copy link

I am rather new to wireit and this is the first missing feature I ran into.
Just to add to what was said, npm run build --clean was the first thing I typed in the terminal to see if that feature was implemented because I saw npm run build --watch in the doc.
My goal was to just delete the files referenced in the output option, and this is what most user would expect.
So maybe --clean would be the best choice to implement [2].
And then for [1] and [3] have variant arguments (e.g. --clean-cache).

Just sharing some ideas.

@cefn
Copy link

cefn commented Apr 17, 2023

My pipeline has a target qa which runs all the things, a target qa:watch which does the same with a watch and a target qa:clean which removes all the .wireit caches, like this...

    "qa": "wireit",
    "qa:clean": "find . -iname '.wireit' -type d | xargs -I{} rm -rf {}",
    "qa:watch": "npm run qa --watch",

I don't feel the need for anything else, particularly, since I can clean out non-versioned files (dist, coverage etc.) with a git clean -fdx.

I am most often running npm run qa:clean && npm run qa while finalising a feature. I will let the qa run without a clean a lot of the time, until it's time to finalise and release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants