sanity icon indicating copy to clipboard operation
sanity copied to clipboard

[cli] Add `sanity init --bare` flag

Open rexxars opened this issue 3 years ago • 1 comments

Type of change (check at least one)

  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [x] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [ ] Documentation (fix or update to documentation)
  • [ ] Maintenance
  • [ ] Other, please describe:

Does this change require a documentation update? (Check one)

  • [x] Yes
  • [ ] No

Description

This PR allows a user to run sanity init --bare and only create a project and (optionally) a dataset. If the user chooses to, it will also create a folder with a sanity.json (containing project ID and dataset) and a package.json (containing @sanity/core as a dependency).

I didn't want to create even more "branches" in the init project code which is already a bit unwieldy, so I separated some logic into their own files for reuse between the "init bare" method and the "regular" init.

Note for release

Add --bare flag to CLI sanity init command, for cases where a studio is not needed.

Checklist

  • [x] I have read the Contributing Guidelines
  • [ ] The PR title includes a link to the relevant issue
  • [x] The PR title is appropriately formatted: [some-package] PR title (#123)
  • [x] The code is linted
  • [x] The test suite is passing
  • [ ] Corresponding changes to the documentation have been made

rexxars avatar Aug 31 '20 07:08 rexxars

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/sanity-io/test-studio/i2mn2ar9e
✅ Preview: https://test-studio-git-init-bare.sanity-io.vercel.app

vercel[bot] avatar Aug 31 '20 07:08 vercel[bot]

Will revisit this later.

rexxars avatar Aug 11 '22 06:08 rexxars