lukeed / pwa

(WIP) Universal PWA Builder
https://pwa.cafe
3.13k stars 100 forks source link

Feature Request - Init into existing Project #61

Closed beeeku closed 5 years ago

beeeku commented 5 years ago

Hi , I was wondering if it is possible to integrate pwa to existing react projects? If it exists can you guide me towards a solution? if the solution doesn't exist, would you be open to adding this to your feature roadmap? Thanks Bikash

lukeed commented 5 years ago

Hey, it's possible to integrate into existing projects, yes, but you should always be doing it manually.

An auto-scaffolder can't reliably or safely modify your project directory. This is why it doesn't by default. You can force it to with the --force flag (or answering Yes on the confirmation prompt) but it will overwrite/delete any conflicting files in your directory. Not good

I would scaffold a new project directory with pwa init and then manually copy & paste the relevant pieces into your actual project.

All that really matters is the contents of package.json and your src/ directory structure. You should have a src/pages and src/components directory, although it isn't required. That's it! Anything else beyond that is advanced customization you would have had to do anyway.

Any existing React/Preact/Vue/etc project can be changed to use PWA 👍

Hope that helps!