Skip to content

Commit

Permalink
feat: add the yes flag
Browse files Browse the repository at this point in the history
the yes flag will skip the confirm prompt

Signed-off-by: Raí Siqueira <[email protected]>
  • Loading branch information
raisiqueira committed Mar 4, 2023
1 parent c84b777 commit 3658ffb
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
11 changes: 9 additions & 2 deletions lib/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
## Usage

To initialize a new project, run the following command (with you prefered package manager)):
To initialize a new project, run the following command (with you preferred package manager)):

```bash
npm init eruption@latest
Expand All @@ -20,6 +20,12 @@ pnpm create eruption@latest

The CLI will ask you a few questions (_in interactive_ mode) and then create a new project for you, but you can also pass a few flags to skip the interactive mode.

to skip the interactive mode you can pass the `--name` and `--kit` flags:

```bash
npm init eruption@latest --name my-project --kit core --yes
```

## Available Kits

| Name | Description | Repository |
Expand All @@ -32,7 +38,8 @@ The CLI will ask you a few questions (_in interactive_ mode) and then create a n
| -------- | --------------------------------------------------------------------------------------------------------- | ----------- |
| `--name` | The name of the project. | `undefined` |
| `--kit` | The kit to use (e.g: core. The CLI will use the `https://github.com/eruptionjs/core` repository as base). | `undefined` |
| `git` | Whether to initialize a git repository. | `true` |
| `--yes` | Whether to skip the confirm prompt. | `false` |
| `--git` | Whether to initialize a git repository. | `true` |

## License

Expand Down
4 changes: 2 additions & 2 deletions lib/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-eruption",
"version": "0.1.5",
"version": "0.1.6",
"description": "The Eruption CLI 🌋",
"license": "MIT",
"author": "Raí Siqueira <[email protected]>",
Expand Down Expand Up @@ -52,4 +52,4 @@
"tiged": "^2.12.3",
"yargs-parser": "^21.1.1"
}
}
}
13 changes: 8 additions & 5 deletions lib/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export async function main() {
const cleanArgv = process.argv.filter((arg) => arg !== '--');
const args = parser(cleanArgv, {
string: ['name', 'kit'],
boolean: ['git'],
boolean: ['git', 'yes'],
default: {
git: true,
},
Expand Down Expand Up @@ -58,10 +58,13 @@ export async function main() {

handleCancelation(initGitRepo);

const install = await confirm({
message: 'Do you want to continue?',
initialValue: false,
});
const install =
'yes' in args
? args.yes
: await confirm({
message: 'Do you want to continue?',
initialValue: false,
});

handleCancelation(install);

Expand Down

0 comments on commit 3658ffb

Please sign in to comment.