optimizely-setuplisted
Install: claude install-skill tgardner18/optitech-nextjs
# Setup Optimizely CMS SDK
Guide the user through setting up the Optimizely CMS JavaScript SDK in their project.
## Steps
1. **Detect package manager** - Check which package manager is used (npm, pnpm, yarn)
2. **Install packages** - Install @optimizely/cms-sdk and @optimizely/cms-cli
3. **Create .env file** - Create environment variables file with placeholders
4. **Create config file** - Create optimizely.config.mjs with basic configuration
5. **Add .env to .gitignore** - Ensure .env is not committed
6. **Verify installation** - Test the CLI connection
## Implementation
### 1. Detect Package Manager
Check for lock files to determine the package manager:
```bash
if [ -f "pnpm-lock.yaml" ]; then
echo "pnpm"
elif [ -f "yarn.lock" ]; then
echo "yarn"
elif [ -f "package-lock.json" ]; then
echo "npm"
else
echo "npm"
fi
```
### 2. Install Packages
Based on the detected package manager, install the required packages:
- **pnpm**: `pnpm add @optimizely/cms-sdk && pnpm add -D @optimizely/cms-cli`
- **yarn**: `yarn add @optimizely/cms-sdk && yarn add -D @optimizely/cms-cli`
- **npm**: `npm install @optimizely/cms-sdk && npm install -D @optimizely/cms-cli`
### 3. Create .env File
Create `.env` file if it doesn't exist, with Optimizely credentials:
```ini
OPTIMIZELY_CMS_CLIENT_ID=<your-client-id>
OPTIMIZELY_CMS_CLIENT_SECRET=<your-client-secret>
```
**Important**: Remind the user to:
- Get credentials from their CMS instance: Settings → API Keys → Create API key
- Re