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

make the clean task remove directories instead of emptying them #11

Merged
merged 3 commits into from
May 21, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ gro format # formats all of the source files using Prettier
gro format --check # checks that all source files are formatted
```

```bash
gro clean # deletes all build artifacts from the filesystem
```

```bash
gro serve # staticly serves the current directory (or a configured one)
```
Expand Down
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Gro changelog

## unreleased
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you know what the this release version this will be in? Any reason to not just preemptively set it here?

Copy link
Owner Author

@ryanatkn ryanatkn May 21, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ya it'll be 0.1.6, I did that as a workflow thing copying another project I saw, but my reasoning was flimsy - basically didn't want to confuse that 0.1.6 could already be released. But that's not really an issue for us. Certainly easier to just put the version that it should be and not worry about changing it in the future. I'll just put the target version going forward unless you have any thoughts?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm, there's got to be some sort of best practice for updating the version in the changelog and releasing at the same time but it escapes me at the moment. But I think the confusion is better than forgetting to do another PR to update the version on release.

Copy link
Owner Author

@ryanatkn ryanatkn May 21, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, I agree about the confusion is the better of the tradeoffs. Sounds like something we should/could eventually automate, probably trivial to do in preversion, maybe with a simple task.


- change `gro clean` to delete directories instead of emptying them

## 0.1.5

- add `gro format` and `gro format --check` and format generated code
Expand Down
10 changes: 5 additions & 5 deletions src/project/clean.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {pathExists, emptyDir} from '../fs/nodeFs.js';
import {pathExists, remove} from '../fs/nodeFs.js';
import {paths} from '../paths.js';
import {SystemLogger} from '../utils/log.js';
import {printPath} from '../utils/print.js';
Expand All @@ -11,14 +11,14 @@ export const clean = async (log: SystemLogger) => {
// Checking `pathExists` avoids creating the directory if it doesn't exist.
export const cleanBuild = async (log: SystemLogger) => {
if (await pathExists(paths.build)) {
log.info('emptying', printPath(paths.build));
await emptyDir(paths.build);
log.info('removing', printPath(paths.build));
await remove(paths.build);
}
};

export const cleanDist = async (log: SystemLogger) => {
if (await pathExists(paths.dist)) {
log.info('emptying', printPath(paths.dist));
await emptyDir(paths.dist);
log.info('removing', printPath(paths.dist));
await remove(paths.dist);
}
};