feat(init): moving templates for init to new cli#290
Conversation
SDK-388 Migrate init command to new CLI
const helpText = `
Options
-y, --yes Use unattended mode, accepting defaults and using only flags for choices
--project <projectId> Project ID to use for the studio
--organization <organizationId> Organization ID to use for the project
--dataset <dataset> Dataset name for the studio
--dataset-default Set up a project with a public dataset named "production"
--output-path <path> Path to write studio project to
--template <template> Project template to use [default: "clean"]
--bare Skip the Studio initialization and only print the selected project ID and dataset name to stdout
--env <filename> Write environment variables to file [default: ".env"]
--provider <provider> Login provider to use
--visibility <mode> Visibility mode for dataset (public/private)
--create-project <name> Create a new project with the given name
--project-plan <name> Optionally select a plan for a new project
--coupon <name> Optionally select a coupon for a new project (cannot be used with --project-plan)
--no-typescript Do not use TypeScript for template files
--package-manager <name> Specify which package manager to use [allowed: ${allowedPackageManagersString}]
--no-auto-updates Disable auto updates of studio versions
Examples
# Initialize a new project, prompt for required information along the way
sanity init
# Initialize a new project with a public dataset named "production"
sanity init --dataset-default
# Initialize a project with the given project ID and dataset to the given path
sanity init -y --project abc123 --dataset production --output-path ~/myproj
# Initialize a project with the given project ID and dataset using the moviedb
# template to the given path
sanity init -y --project abc123 --dataset staging --template moviedb --output-path .
# Create a brand new project with name "Movies Unlimited"
sanity init -y \\
--create-project "Movies Unlimited" \\
--dataset moviedb \\
--visibility private \\
--template moviedb \\
--output-path /Users/espenh/movies-unlimited
` |
|
Claude finished @mttdnt's task in 2m 51s —— View job Review CompleteIssues Found1. CSS Bug in ExampleComponent.css (Line 51) The file has a CSS typo that was copied from the original templates: justify-container: center; // ❌ Invalid CSS propertyShould be: justify-content: center; // ✅ Correct propertyLocation: This bug existed in the original templates and was carried over during the move. It won't cause errors but the style won't apply. 2. Clarify package.json "files" field (Reviewer's comment) The commit message The
The current setup includes them from their source location, which seems correct. 3. Run Prettier on Templates (Reviewer's comment) As binoy14 noted, prettier needs to be run on the template files: cd packages/@sanity/cli && npx prettier --write templates/The lintstaged config was already updated to handle templates, but the files need an initial formatting pass. |
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||
binoy14
left a comment
There was a problem hiding this comment.
Need to run prettier against the templates. You can run this from the root cd packages/@sanity/cli && npx prettier --write templates/
packages/@sanity/cli/package.json
Outdated
| "scripts": { | ||
| "build": "swc --delete-dir-on-start --strip-leading-paths --out-dir dist/ src", | ||
| "postbuild": "pnpm run manifest:generate", | ||
| "postbuild": "pnpm run manifest:generate && cp -r templates dist/templates", |
There was a problem hiding this comment.
I don't think you need to copy the templates to dist if the files above is including it.
0b96744 to
c9ba48e
Compare
Description
Copied over any recent changes to templates, and moved them over, this is to make the final init pr 180 files smaller...