-
Notifications
You must be signed in to change notification settings - Fork 312
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Environment for local development with remote server #58
Comments
Not currently near a PC, but what is needed:
I will take a look at this, and probably share a docker-compose as soon as I will be available :) |
Here is my nginx config. What I do:
replace |
Sorry no time for docker-compose to prepare, but please use this to proceed. If feeling brave - contribute the docker-compose for such setup, will be very-very happy to merge in! |
@alfredsgenkins Thanks for the info. FYI: I'm not using any of the docker instances, as I already have a dev server, where Varnsh etc all set up. And in my local I've the code base, therefore modified only the Webpack config for the correct path, and used the nginx routing what you given to me. (Nginx runs locally on my machine already) I've found this setup easier in our case. |
And what needs to be changed in const projectRoot = path.resolve(__dirname, '..', '..'); // stays the same
const magentoRoot = path.resolve(projectRoot, '..', '..', '..', '..', '..'); // not needed !
const fallbackRoot = path.resolve(magentoRoot, 'vendor', 'scandipwa', 'source'); // clone the same version of the theme as is installed on server, and point the "fallbackRoot" into it : I do belive this setup is easier when developing the FE. For BE development it is required to have Magento running locally - this is were the development server might help :) |
@imso077 , i had the same objective as you : working with a remote magento and with minimal tools. Here is the result of my analysis : https://github.com/astik/scandipwa-init-front. First step, you initialize a project (with init.sh), then you follow guidelines from README.md which are quite standard for node relative project (npm install, npm run ...). It is working with ScandiPWA base-theme v2, i didn't try yet with v3. @alfredsgenkins having those kind of setup is great as it is fast to setup and very light to run. To really go further with a great developer experience, i can see 2 things to enhance:
|
Oh, my god, how did I miss your comment? @astik amazing job! Let me look through and publish similar solution! Great job! 👏 |
I tried some iterations over a custom react-script (from create-react-app). FWIW here are the results of the analysis: Goals towards custom create-react-app
To achieve this goal:
For allow extending base-theme:
For i18n:
In index.html:
Ideal file structurei18n folderKeys defined in this folder will override existing one in the base theme. Public folderIt contains static file that should not be bundled. src folderIt contains every application file: JS, CSS/SCSS, images, ... that goe through the bundling process src-magento folderIt contains every files relative to Magento theme definition. Retro engineering for current dev process
|
Looking at v3-stable, there is some big changes that get us farther away from create-react-app:
Having a tool similar to CRA with scandipwa will need way more work than what i was expecting ='( All the custom features should be well documented in order to easily maintain the build tools. |
I found a project that could be of help on using create-react-app: https://github.com/gsoft-inc/craco |
Soo. V3 indeed is very dependant on composer. We are not the storefront in the end of the day. Extensions install directly from composer and require a single modification in Following must be done to install V3 properly:
As seen we need We are not a store-front. We are Magento theme. I am think if the composer plugins (not npm) was a right choice for us, but in the long run it means code installed from a single source. Both for BE and FE. What do you think? |
Theoretically, it can be packed into a single command. We are already working on similar command for docker-install, with single command it will run you the whole stack. The question is, do we need the same on local, without docker? We might make a questionnaire in Slack group. |
Most not experienced devs work on servers without deploy => they would want watcher-file-generator, which is actually really easy to make. Actually we should do it ASAP, even though this is bad approach people would love it. |
@alfredsgenkins, the idea is to remove magento specificities as much as possible from frontend developers. Having a specific folder structure following magento / composer convention is ok, no problem. Asking a frontend dev to install Magento, php, ... it's a lot i would prefer to avoid (to say the least). if you look at https://github.com/astik/scandipwa-init-front, you'll find a very simple way to init a project. It is working (tested with scandipwapmrev.indvp.com as backend):
It is pretty straightforward and easy to setup. So far, i'm running it correctly with base theme v2 but still got issue when replacing with v3 in my init script. One thing with current code state, a lot of files relative to tooling (src/config and custom configuration .eslintrc, .stylelintrc). It might be interesting to find a way to externalize this in a separate npm dependencies (even though it is hidden behind a CLI) |
I just push new code on master to handle v3 (v2 has its own branch). I also add some specificities:
(Disclaimer: i'm no php developer) For composer, i though i could run composer install from the theme project but i get an error:
As i want to work with frontend stuff only, i though i would remove all composer backend reference and only keep the frontend one defined in scandipwa.json (this means scandipwa/paypal-graphql):
But here again i get a similar error:
In the meantime i will continue without the composer dependencies. As i have something that seem to work, i will give up v2 to focus on v3 with its new middleware feature =) |
Currently it is not straightforward to work/develop on the PWA theme when we have an already running Magento instance in a remote server.
Would be noce to have an enviroment where we run the PWA theme locally, and we connect it to the remote server (graphql etc...)
I think this will help when migrations are done, where the PWA have to built in specifc store, with specific set of products cms pages etc.
The text was updated successfully, but these errors were encountered: