Skip to content

Commit

Permalink
add sync and no-sync args to gro build
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanatkn committed Jul 20, 2024
1 parent 64029a2 commit 9df775c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/rude-numbers-smell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@ryanatkn/gro": patch
---

add `sync` and `no-sync` args to `gro build`
9 changes: 6 additions & 3 deletions src/lib/build.task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import {clean_fs} from './clean_fs.js';

export const Args = z
.object({
sync: z.boolean({description: 'dual of no-sync'}).default(true),
'no-sync': z.boolean({description: 'opt out of gro sync'}).default(false),
install: z.boolean({description: 'dual of no-install'}).default(true),
'no-install': z // convenience, same as `gro build -- gro sync --no-install` but the latter takes precedence
.boolean({description: 'opt out of `npm install` before building'})
Expand All @@ -19,10 +21,11 @@ export const task: Task<Args> = {
Args,
run: async (ctx): Promise<void> => {
const {args, invoke_task} = ctx;
const {install} = args;
const {sync, install} = args;

// By default `gro build` installs, opposite of `gro sync`, so that arg needs special handling.
await invoke_task('sync', {install});
if (sync) {
await invoke_task('sync', {install});
}

// TODO possibly detect if the git workspace is clean, and ask for confirmation if not,
// because we're not doing things like `gro gen` here because that's a dev/CI concern
Expand Down

0 comments on commit 9df775c

Please sign in to comment.