adhocteam / pushup

Pushup is for making modern, page-oriented web apps in Go
https://pushup.adhoc.dev
MIT License
844 stars 30 forks source link

Ask before clearing out out-dir #83

Closed llimllib closed 1 year ago

llimllib commented 1 year ago
llimllib commented 1 year ago

Neither of those tools delete everything in the build dir, which is a very dangerous operation.

My worry is the first user who says "oh output-dir? I want my output in /usr/bin".

If you run zig build file.zig --cache-dir /usr/bin, what you'll get is a few new directories in /usr/bin that you probably don't want.

On the other hand, if you run pushup -out-dir /usr/bin <etc etc>, you'll silently erase your entire /usr/bin directory

Here's what a zig cache folder looks like after building two different binaries:

$ tree zig-cache/
zig-cache/
├── h
├── o
│   ├── 44d1925c83e24fb5b66ebebff916ac77
│   │   └── builtin.zig
│   └── 776651cd8468fc28abb2062cf0f1827e
│       └── builtin.zig
└── z
    ├── 1a8ca814016384106f75c92ca78ed220
    └── d35b7c44b39ce30aa92d0a5fd4c85e00

It creates two directories with a guid for each different binary that you build, and never deletes anything

llimllib commented 1 year ago

(updating the tool to not warn the user but to be safely non-destructive would be a fine alternative)

paulsmith commented 1 year ago

I wonder if the best thing to do in the short term is just emulate the zig cache behavior and not try to delete anything. Tests are a different story.

llimllib commented 1 year ago

Cool, I'll close this PR and we can aim for a nondestructive strategy - will update the issue