From 848f5707aad18e66a961d4fc55d158d3c2f3d23d Mon Sep 17 00:00:00 2001 From: Jesse Leite Date: Sun, 10 Nov 2024 19:14:35 -0500 Subject: [PATCH 1/2] Document importing of module folders & external starter kit modules. --- .../docs/creating-a-starter-kit.md | 64 ++++++++++++++++++- 1 file changed, 63 insertions(+), 1 deletion(-) diff --git a/content/collections/docs/creating-a-starter-kit.md b/content/collections/docs/creating-a-starter-kit.md index 65596ddce..343d1989d 100644 --- a/content/collections/docs/creating-a-starter-kit.md +++ b/content/collections/docs/creating-a-starter-kit.md @@ -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: @@ -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' # import from modules/seo/module.yaml + js: + options: + vue: '@import' # import from modules/js/vue/module.yaml + react: '@import' # import 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, and `import` config from a folder based module. + + ```yaml + modules: + seo: + prompt: 'Would you like some awesome SEO with that!?' + import: '@config' # import from modules/seo/module.yaml + js: + prompt: 'Would you care for some JS?' + skip_option: 'No, thank you!' + options: + vue: + label: 'VueJS' + import: '@config' # import from modules/js/vue/module.yaml + react: + label: 'ReactJS' + import: '@config' # import from modules/js/react/module.yaml + ``` + + If you wish, you can also move your prompt flow config into your module folder's `module.yaml` config. + + Ultimately, 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 From a00b1987c050a12522db0addabb4a5a9947be541 Mon Sep 17 00:00:00 2001 From: Jesse Leite Date: Mon, 11 Nov 2024 17:19:56 -0500 Subject: [PATCH 2/2] =?UTF-8?q?Remove=20`import:=20'@config=E2=80=99`=20sy?= =?UTF-8?q?ntax,=20and=20implicitly=20import=20instead.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../collections/docs/creating-a-starter-kit.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/content/collections/docs/creating-a-starter-kit.md b/content/collections/docs/creating-a-starter-kit.md index 343d1989d..681763dd4 100644 --- a/content/collections/docs/creating-a-starter-kit.md +++ b/content/collections/docs/creating-a-starter-kit.md @@ -236,37 +236,37 @@ You can also extract modules to their own dedicated folders and import them in y ```yaml modules: - seo: '@import' # import from modules/seo/module.yaml + seo: '@import' # imports from modules/seo/module.yaml js: options: - vue: '@import' # import from modules/js/vue/module.yaml - react: '@import' # import from modules/js/react/module.yaml + 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, and `import` config from a folder based module. +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!?' - import: '@config' # import from modules/seo/module.yaml + # implicitly imports from modules/seo/module.yaml js: prompt: 'Would you care for some JS?' skip_option: 'No, thank you!' options: vue: label: 'VueJS' - import: '@config' # import from modules/js/vue/module.yaml + # implicitly imports from modules/js/vue/module.yaml react: label: 'ReactJS' - import: '@config' # import from modules/js/react/module.yaml + # implicitly imports from modules/js/react/module.yaml ``` - If you wish, you can also move your prompt flow config into your module folder's `module.yaml` config. + 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. - Ultimately, these configs are merged when imported, with the parent config taking precedence. + These configs are merged when imported, with the parent config taking precedence. ### Importing External Starter Kits