Skip to content

Commit 783ee42

Browse files
author
strausr
committed
docs(cli): add preset rules
1 parent a136e4c commit 783ee42

4 files changed

Lines changed: 28 additions & 11 deletions

File tree

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Scaffold a Cloudinary React + Vite + TypeScript project with interactive setup.
1111
- Node.js 18+ installed
1212
- A Cloudinary account (free tier available)
1313
- [Sign up for free](https://cloudinary.com/users/register/free)
14-
- Your cloud name is in your [dashboard](https://console.cloudinary.com)
14+
- Your cloud name is in your [dashboard](https://console.cloudinary.com/app/home/dashboard)
1515

1616
## Usage
1717

@@ -21,8 +21,8 @@ npx create-cloudinary-react
2121

2222
The CLI will prompt you for:
2323
- Project name
24-
- **Cloudinary cloud name** (found in your [dashboard](https://console.cloudinary.com))
25-
- Upload preset (optional)
24+
- **Cloudinary cloud name** (found in your [dashboard](https://console.cloudinary.com/app/home/dashboard))
25+
- Upload preset (optional - required for uploads, but transformations work without it)
2626
- AI coding assistant(s) you're using (Cursor, GitHub Copilot, Claude, etc.)
2727
- Whether to install dependencies
2828
- Whether to start dev server

cli.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,14 @@ async function main() {
5151
name: 'cloudName',
5252
message: 'Cloudinary Cloud Name:',
5353
description: chalk.gray(
54-
'Your cloud name is shown in your dashboard: https://console.cloudinary.com'
54+
'Your cloud name is shown in your dashboard: https://console.cloudinary.com/app/home/dashboard'
5555
),
5656
validate: (input) => {
5757
if (!input.trim()) {
5858
return chalk.yellow(
5959
'Cloud name is required.\n' +
6060
' → Sign up: https://cloudinary.com/users/register/free\n' +
61-
' → Find your cloud name: https://console.cloudinary.com'
61+
' → Find your cloud name: https://console.cloudinary.com/app/home/dashboard'
6262
);
6363
}
6464
if (!isValidCloudName(input)) {
@@ -70,8 +70,12 @@ async function main() {
7070
{
7171
type: 'confirm',
7272
name: 'hasUploadPreset',
73-
message: 'Do you have an unsigned upload preset?',
73+
message: 'Do you have an unsigned upload preset? (Required for uploads, optional for transformations)',
7474
default: false,
75+
description: chalk.gray(
76+
'Upload presets enable client-side uploads. You can set one up later at:\n' +
77+
'https://console.cloudinary.com/app/settings/upload/presets'
78+
),
7579
},
7680
{
7781
type: 'input',
@@ -232,8 +236,11 @@ async function main() {
232236
console.log(chalk.green('✅ Project created successfully!\n'));
233237

234238
if (!answers.hasUploadPreset) {
235-
console.log(chalk.yellow('📝 To create an upload preset:'));
236-
console.log(chalk.cyan(' 1. Go to https://cloudinary.com/console/settings/upload/presets'));
239+
console.log(chalk.yellow('\n📝 Note: Upload preset not configured'));
240+
console.log(chalk.gray(' • Transformations will work with sample images'));
241+
console.log(chalk.gray(' • Uploads require an unsigned upload preset'));
242+
console.log(chalk.cyan('\n To enable uploads:'));
243+
console.log(chalk.cyan(' 1. Go to https://console.cloudinary.com/app/settings/upload/presets'));
237244
console.log(chalk.cyan(' 2. Click "Add upload preset"'));
238245
console.log(chalk.cyan(' 3. Set it to "Unsigned" mode'));
239246
console.log(chalk.cyan(' 4. Add the preset name to your .env file\n'));

templates/.cursorrules.template

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@
2020
- ✅ CORRECT: `import.meta.env.VITE_CLOUDINARY_CLOUD_NAME` (not `process.env`)
2121
- Always restart dev server after adding/updating `.env` variables
2222

23+
## Upload Presets
24+
- **Unsigned upload presets are required for client-side uploads** - Transformations work without them, but uploads need an unsigned preset
25+
- ✅ Create unsigned upload preset: https://console.cloudinary.com/app/settings/upload/presets
26+
- ✅ Set preset in `.env`: `VITE_CLOUDINARY_UPLOAD_PRESET=your-preset-name`
27+
- ✅ Use in code: `import { uploadPreset } from './cloudinary/config'`
28+
- ⚠️ If upload preset is missing, the Upload Widget will show an error message
29+
- ⚠️ Upload presets must be set to "Unsigned" mode for client-side usage (no API key/secret needed)
30+
2331
## Import Patterns
2432
- ✅ Import Cloudinary instance: `import { cld } from './cloudinary/config'`
2533
- ✅ Import components: `import { AdvancedImage, AdvancedVideo } from '@cloudinary/react'`

templates/README.md.template

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ npm run dev
1212

1313
This project uses Cloudinary for image management. If you don't have a Cloudinary account yet:
1414
- [Sign up for free](https://cloudinary.com/users/register/free)
15-
- Find your cloud name in your [dashboard](https://console.cloudinary.com)
15+
- Find your cloud name in your [dashboard](https://console.cloudinary.com/app/home/dashboard)
1616

1717
## Environment Variables
1818

@@ -22,10 +22,12 @@ Your `.env` file has been pre-configured with:
2222
- `VITE_CLOUDINARY_UPLOAD_PRESET`: {{UPLOAD_PRESET}}
2323
{{/UPLOAD_PRESET}}
2424
{{^UPLOAD_PRESET}}
25-
- `VITE_CLOUDINARY_UPLOAD_PRESET`: (not set - create an unsigned upload preset)
25+
- `VITE_CLOUDINARY_UPLOAD_PRESET`: (not set - required for uploads)
26+
27+
**Note**: Transformations work without an upload preset (using sample images). Uploads require an unsigned upload preset.
2628

2729
To create an upload preset:
28-
1. Go to https://cloudinary.com/console/settings/upload/presets
30+
1. Go to https://console.cloudinary.com/app/settings/upload/presets
2931
2. Click "Add upload preset"
3032
3. Set it to "Unsigned" mode
3133
4. Add the preset name to your `.env` file

0 commit comments

Comments
 (0)