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

Starter kit modules updates #1541

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Changes from all 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
64 changes: 63 additions & 1 deletion content/collections/docs/creating-a-starter-kit.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ modules:

### Nesting Modules

Finally, you can also nest modules where it makes sense to do so. Simply nest a `modules` object within any module.
If it makes sense to do so, you can nest modules to control prompt flow. Simply nest a `modules` object within any module.

```yaml
modules:
Expand All @@ -228,6 +228,68 @@ modules:

In this example, the second `sitemap` module prompt will only be presented to the user, if they agree to installing the parent `seo` module.

### Importing Module Folders

You can also extract modules to their own dedicated folders and import them in your starter kit config. There are a few ways to do this:

1. Import folder based module configs with `@import`.

```yaml
modules:
seo: '@import' # imports from modules/seo/module.yaml
js:
options:
vue: '@import' # imports from modules/js/vue/module.yaml
react: '@import' # imports from modules/js/react/module.yaml
```

As you can see, the hierarchy in your `modules` folder should match the heirarchy in your main `starter-kit.yaml` config.

2. Customize prompt flow at the parent level, and implicitly import config from a folder based module.

```yaml
modules:
seo:
prompt: 'Would you like some awesome SEO with that!?'
# implicitly imports from modules/seo/module.yaml
js:
prompt: 'Would you care for some JS?'
skip_option: 'No, thank you!'
options:
vue:
label: 'VueJS'
# implicitly imports from modules/js/vue/module.yaml
react:
label: 'ReactJS'
# implicitly imports from modules/js/react/module.yaml
```

The installer will implicitly attempt to import from a `module.yaml` config within your `modules` folder, again following the same hierarchy defined in your parent `starter-kit.yaml` config.

These configs are merged when imported, with the parent config taking precedence.

### Importing External Starter Kits

Finally, if you with to get even more _modular_, you can extract out to a standard standalone starter kit and import that whole kit as a module. Again, there are a few ways to do this:

1. Import an external starter kit as a module with `vendor/package`.

```yaml
modules:
seo: 'your/starter-kit'
```

2. Customize prompt flow, and `import` an external `vendor/package`.

```yaml
modules:
seo:
prompt: 'Would you like some awesome SEO with that!?'
import: 'your/starter-kit'
```

Like with [module folders](#importing-module-folders), these configs are merged when imported, with the parent config taking precedence.


## Post-Install Hooks

Expand Down