gruntjs / gruntjs/grunt

Multitask option to set the default behavior when a subtask is not specified

Open
#815 27 comments 3 reactions 0 assignees View on GitHub
Component: tasks
Dominant language
JavaScript
Stars
12.2k
Forks
1.5k
PR merge metrics
No merged PRs in 30d

Description

Sometimes it's dangerous or undesired to run all of a multitask's subtasks by default.

Proposal: an option to set the default behavior when a subtask is not specified instead of iterating through all the subtasks.

Default `deploy` to use `dev` when a subtask is not specified:

```
deploy: {
options: {
default: 'dev'
},
dev: { .. },
qa: { .. },
prod: { .. }
}
```

```
$ grunt deploy # only runs deploy:dev instead of all of them
```

Example:
Don't run any bump subtasks if the subtask is not specified.

```
bump: {
options: {
default: false
},
major: { .. },
minor: { .. },
patch: { .. },
build: { .. }
}
```

```
$ grunt bump # returns an error that the bump subtask was not specified
```

Contributor guide

Open the contributing guide

Research direction

No source file, test, or entry point is named. Start by tracing how Grunt resolves multitask invocations and handles omitted subtasks, then review existing multitask tests. Done means configurations can select a default subtask or explicitly reject an omitted subtask without changing existing behavior unexpectedly.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.