Skip to content

Conversation

Copy link

Copilot AI commented Jun 29, 2025

The SWA CLI scripts across Angular, React, Svelte, and Vue had several configuration issues that prevented them from working correctly. This PR addresses all identified problems:

Issues Fixed

1. Missing Dependencies

  • Angular & React: Added missing concurrently dependency that was being used in scripts but not declared in devDependencies

2. Incorrect Script References

  • Angular: Fixed scripts referencing non-existent dev command, changed to use correct start script
    - "start-angular-fastify": "concurrently \"npm run fastify-dev\" \"VITE_API=http://0.0.0.0:3000/api npm run dev\""
    + "start-angular-fastify": "concurrently \"npm run fastify-dev\" \"npm run start\""

3. Port Conflicts

  • React: Resolved port conflict where both React app and Fastify API tried to use port 3000
    • React app now uses port 3001 when running with Fastify
    • API server stays on port 3000
    - "start-react-fastify-swa": "...start http://0.0.0.0:3000 --api-devserver-url http://0.0.0.0:3000..."
    + "start-react-fastify-swa": "...start http://localhost:3001 --api-devserver-url http://localhost:3000 --run 'PORT=3001 npm run start'"

4. Inappropriate Environment Variables

  • Angular, React, Vue: Removed VITE_API environment variables from frameworks that don't use Vite
  • Svelte: Kept VITE_API since it appropriately uses Vite

5. Host Configuration Cleanup

  • Standardized all scripts to use localhost instead of inconsistent 0.0.0.0 addressing
  • Removed unnecessary --host flags for better cross-platform compatibility

Validated Scripts

All SWA CLI scripts now work correctly across all frameworks:

Framework Azure Functions Fastify API Direct Fastify
Angular start-angular-func-swa start-angular-fastify-swa start-angular-fastify
React start-react-func-swa start-react-fastify-swa start-react-fastify
Svelte start-svelte-func-swa start-svelte-fastify-swa start-svelte-fastify
Vue start-vue-func-swa start-vue-fastify-swa start-vue-fastify

Testing

  • Verified all package.json scripts parse correctly
  • Tested script execution to ensure SWA CLI invocation works
  • Confirmed concurrently dependency resolution
  • Validated port configurations prevent conflicts

Fixes #78.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] check scripts Fix SWA CLI scripts across all 4 web frameworks Jun 29, 2025
Copilot AI requested a review from johnpapa June 29, 2025 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

check scripts

2 participants