fix(init): allow `@slicemachine/init` to run in Gatsby projects
Types of changes
- [x] Bug fix (a non-breaking change which fixes an issue)
- [ ] New feature (a non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
Description
This PR allows @slicemachine/init to be used in Gatsby project. Slice Machine itself does not fully support Gatsby, but @slicemachine/init should be usable in projects that have Gatsby installed. Gatsby projects can use Slice Machine in its framework-agnostic mode.
This PR treats Gatsby like other non-Next.js/Nuxt supported frameworks, including React, Svelte, and Vanilla JS.
Current behavior
Running npx @slicemachine/init today in a project with gatsby as a dependency displays the following error:
You're about to configure Slicemachine... Press ctrl + C to cancel
✔ Logged in as [email protected]
Error! Gatsby is currently not supported
Please run npx @slicemachine/init in a Nuxt or Next.js project
You can see this happening by testing the Gatsby Blog starter:
npx degit prismicio-community/gatsby-starter-prismic-blog your-project-name
cd your-project-name
npx @slicemachine/init
Alternatives
-
We could introduce an
--ignore-frameworkflag that bypasses the framework check:npx @slicemachine/init --ignore-framework -
We could read the
frameworkproperty insm.jsonto detect the framework.@slicemachine/initcurrently ignores theframeworkconfiguration property.
Checklist:
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly. (PR: #)
- [x] All new and existing tests are passing.