From codeapps-toolkit
Deploys Code App to Power Platform with pre-deployment validation, build checks, and post-deployment verification. Ensures vite config base path is set.
How this skill is triggered — by the user, by Claude, or both
Slash command
/codeapps-toolkit:deploy-codeappThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Deploy your Code App to Power Platform with integrated validation, build checks, and deployment verification.
Deploy your Code App to Power Platform with integrated validation, build checks, and deployment verification.
pac code push)/deploy-codeapp
/deploy-codeapp MySolutionName
Deploy my Code App to Power Platform
Push this app to production
Deploy to the "Marketing Apps" solution
CRITICAL: Always validate BEFORE deploying to catch issues early.
Automatically check:
base: './' ← CRITICAL for asset loadingIf validation fails:
base: './' to vite.config.ts)Verify code quality:
If build validation fails:
npm run build
Expected Output:
vite v5.x.x building for production...
✓ XX modules transformed.
dist/index.html X.XX kB
dist/assets/index-xxxxx.js XX.XX kB
✓ built in X.Xs
Verify Build Success:
dist/ folder createddist/index.html existsdist/assets/ contains JS and CSS filesCheck that built HTML uses relative paths (not absolute):
# Check asset references in built index.html
cat dist/index.html | grep -E 'src=|href='
Expected: src="./assets/index-xxxxx.js" (relative path with ./)
Problematic: src="/assets/index-xxxxx.js" (absolute path)
If absolute paths found:
❌ ERROR: vite.config.ts missing base: './'
This will cause 404 errors when deployed. Assets won't load.
Fixing automatically...
Add base: './' to vite.config.ts and rebuild:
export default defineConfig({
plugins: [react()],
base: './', // ✅ Add this line
build: {
outDir: 'dist',
assetsDir: 'assets',
},
})
Then rebuild:
npm run build
# Verify authenticated
pac auth list
If not authenticated:
pac auth create
pac env select --environment <environmentId>
Option 1: Deploy to Preferred Solution (default)
pac code push
Option 2: Deploy to Specific Solution
pac code push --solutionName "$ARGUMENTS[0]"
Deployment Progress:
Uploading code app package...
Publishing to Power Platform...
Code app published successfully.
pac code list
Verify the app appears in the list with correct name and version.
Provide user with verification steps:
✅ Deployment Verification Checklist:
1. Open Power Apps portal:
https://make.powerapps.com
2. Navigate to Apps section
3. Find your app: $ARGUMENTS[0]
4. Click "Play" to launch the app
5. Verify in browser:
- [ ] App loads (no blank screen)
- [ ] No 404 errors in console (F12 → Console)
- [ ] CSS styles applied correctly
- [ ] JavaScript executes
- [ ] Data operations work (if using Dataverse/connectors)
6. Check browser console for errors:
- Open DevTools (F12)
- Check Console tab
- Check Network tab for failed requests
Issue: Blank screen
base: './' in vite.config.tsbase: './', rebuild, redeployIssue: Assets fail to load
GET .../assets/index-xxx.js 404base: './' in vite.config.tsIssue: MIME type errors
Refused to apply style ... MIME type ('application/json')base: './' configured and assets built correctly🎉 Deployment Successful!
📦 App Name: $ARGUMENTS[0]
🌐 Solution: <solution-name or "Default">
⏰ Deployed: <timestamp>
🔗 Quick Links:
- Power Apps Portal: https://make.powerapps.com
- App URL: <app-url from pac code list>
- Environment: <environment-name>
✅ Verification Status:
- Build: Success
- Upload: Success
- Publish: Success
📋 Next Steps:
1. Test app functionality in deployed environment
2. Verify data operations work correctly
3. Share app with users (Power Apps portal → Share)
4. Monitor for errors or issues
💡 To update the app:
1. Make changes to code
2. Run: /deploy-codeapp
Recommended Pattern: Dev → Test → Prod
# Deploy to Dev
pac env select --environment <dev-environment-id>
pac code push --solutionName "CodeApps-Dev"
# Export solution
pac solution export --path ./solution.zip --name "CodeApps-Dev"
# Import to Test
pac env select --environment <test-environment-id>
pac solution import --path ./solution.zip
# Update connection references in Test environment
# Test thoroughly, then promote to Prod
pac env select --environment <prod-environment-id>
pac solution import --path ./solution.zip
For better portability across environments, use connection references:
# Add data source with connection reference
pac code add-data-source -a <apiId> -cr <connectionReferenceLogicalName> -s <solutionID>
Symptom: pac code push fails with authentication error
Fix:
pac auth clear
pac auth create
pac env select --environment <environmentId>
pac code push
Symptom: Can't find specified solution
Fix:
pac solution listSymptom: npm run build exits with errors
Fix:
npm install if dependencies missingSymptom: Deployment fails with "size limit exceeded"
Fix:
ls -lh dist/assets/Symptom: pac code push fails with "power.config.json not found"
Fix:
pac code init --displayName "AppName"
If deployment causes issues:
# Checkout previous git commit
git checkout <previous-commit-hash>
# Rebuild and redeploy
npm run build
pac code push
This skill can be integrated into CI/CD pipelines:
- name: Deploy Code App
run: |
pac auth create --environment ${{ secrets.ENVIRONMENT_ID }}
npm run build
pac code push
- script: |
pac auth create
npm run build
pac code push
displayName: 'Deploy Code App'
Before allowing deployment, ensure:
npm run build succeedsdist/ folder contains built assetsIf ANY check fails: Stop deployment and fix issues first.
Deployment succeeds when:
pac code push exits successfullypac code list/init-codeapp/add-datasource/fix-codeapp-issuePro Tip: Always test in a Dev environment before deploying to Production. Use solutions and connection references for better ALM across environments.
Documentation: https://learn.microsoft.com/power-apps/developer/code-apps/
npx claudepluginhub ramakrishnan24689/codeapps-toolkit --plugin codeapps-toolkitCreates, edits, and verifies skills using a test-driven development approach with pressure scenarios and subagents.