├── .gitignore ├── Controller └── Index │ └── Index.php ├── README.md ├── composer.json ├── etc ├── frontend │ ├── routes.xml │ └── sections.xml └── module.xml ├── reactapp ├── .env.development.template ├── .gitignore ├── README.md ├── config.js.template ├── config │ ├── env.js │ ├── jest │ │ ├── cssTransform.js │ │ └── fileTransform.js │ ├── modules.js │ ├── paths.js │ ├── pnpTs.js │ ├── polyfills.js │ ├── webpack.config.js │ └── webpackDevServer.config.js ├── package-lock.json ├── package.json ├── public │ ├── favicon.ico │ ├── index.html │ └── manifest.json ├── scripts │ ├── build.js │ ├── start.js │ └── test.js └── src │ ├── components │ ├── App │ │ ├── App.css │ │ ├── App.js │ │ ├── App.test.js │ │ └── index.js │ ├── Customer │ │ ├── Authorisation.js │ │ ├── Login.js │ │ ├── Logout.js │ │ ├── OrderHistory.js │ │ ├── Welcome.js │ │ └── index.js │ └── UI-Elements │ │ └── Table │ │ ├── Table.js │ │ ├── TableBody.js │ │ ├── TableFooter.js │ │ ├── TableHead.js │ │ └── index.js │ ├── config.js.template │ ├── index.css │ ├── index.js │ └── util │ ├── GraphqlComponent.js │ └── magento │ └── customerData.js ├── registration.php └── view └── frontend ├── layout └── reactapp_index_index.xml ├── requirejs-config.js ├── templates └── reactapp.phtml └── web ├── css ├── main.css └── main.css.map └── js ├── main.js └── main.js.map /.gitignore: -------------------------------------------------------------------------------- 1 | reactapp/.env.development 2 | reactapp/src/config.js 3 | 4 | -------------------------------------------------------------------------------- /Controller/Index/Index.php: -------------------------------------------------------------------------------- 1 | resultFactory->create(ResultFactory::TYPE_PAGE); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Integer_Net ReactApp 2 | 3 | [![Software License][ico-license]](LICENSE.md) 4 | 5 | This is a work in progress, but it's a first version of a bootstrap template module / reference to build React Apps that are loaded in to the Magento 2 (Venia/Blank) theme. 6 | 7 | ## Installation 8 | 9 | 1. Install via composer 10 | ``` 11 | composer require integer-net/magento2-reactapp 12 | ``` 13 | 2. Enable module 14 | ``` 15 | bin/magento setup:upgrade 16 | ``` 17 | 3. Visit http(s)://{base_url}/reactapp 18 | 19 | ## Configuration 20 | 21 | When starting development, rename and: 22 | - reactapp/.env.development.template to .env.development 23 | - reactapp/src/config.js.template to config.js. 24 | and set the right values in these files. 25 | 26 | More documentation on the way. 27 | 28 | ## Credits 29 | 30 | - [Willem Wigman][link-author] 31 | 32 | ## License 33 | 34 | The MIT License (MIT). Please see [License File](LICENSE.txt) for more information. 35 | 36 | [ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square 37 | 38 | [link-author]: https://github.com/wigman 39 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "integer-net/magento2-reactapp", 3 | "description": "Module for Magento 2 that serves as a boilerplate for React apps te be loaded in the Magento (Luma/Blank) frontend.", 4 | 5 | "type": "magento2-module", 6 | "version": "1.0.0", 7 | "license": [ 8 | "MIT" 9 | ], 10 | "authors": [ 11 | { 12 | "name": "Willem Wigman", 13 | "email": "ww@integer-net.de", 14 | "homepage": "https://www.integer-net.de/", 15 | "role": "M2 Developer" 16 | } 17 | ], 18 | "require": { 19 | "magento/framework": "^100.1|^101.0|^102.0", 20 | "magento/module-customer": "^101.0.0|^102.0.0", 21 | "magento/module-cms": "^101.0.0|^102.0.0|^103.0", 22 | "php": ">=7.1.0" 23 | }, 24 | "autoload": { 25 | "files": [ 26 | "registration.php" 27 | ], 28 | "psr-4": { 29 | "IntegerNet\\ReactApp\\": "" 30 | } 31 | } 32 | 33 | } -------------------------------------------------------------------------------- /etc/frontend/routes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /etc/frontend/sections.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 |
6 | 7 | 8 | -------------------------------------------------------------------------------- /etc/module.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /reactapp/.env.development.template: -------------------------------------------------------------------------------- 1 | # rename this file to .env.development.template 2 | HTTPS=true 3 | PROXY=https://magento.test 4 | REACT_APP_PROXY=yes -------------------------------------------------------------------------------- /reactapp/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | -------------------------------------------------------------------------------- /reactapp/README.md: -------------------------------------------------------------------------------- 1 | This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). 2 | 3 | ## Available Scripts 4 | 5 | In the project directory, you can run: 6 | 7 | ### `npm start` 8 | 9 | Runs the app in the development mode.
10 | Open [http://localhost:3000](http://localhost:3000) to view it in the browser. 11 | 12 | The page will reload if you make edits.
13 | You will also see any lint errors in the console. 14 | 15 | ### `npm test` 16 | 17 | Launches the test runner in the interactive watch mode.
18 | See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. 19 | 20 | ### `npm run build` 21 | 22 | Builds the app for production to the `build` folder.
23 | It correctly bundles React in production mode and optimizes the build for the best performance. 24 | 25 | The build is minified and the filenames include the hashes.
26 | Your app is ready to be deployed! 27 | 28 | See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. 29 | 30 | ### `npm run eject` 31 | 32 | **Note: this is a one-way operation. Once you `eject`, you can’t go back!** 33 | 34 | If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. 35 | 36 | Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. 37 | 38 | You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. 39 | 40 | ## Learn More 41 | 42 | You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). 43 | 44 | To learn React, check out the [React documentation](https://reactjs.org/). 45 | 46 | ### Code Splitting 47 | 48 | This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting 49 | 50 | ### Analyzing the Bundle Size 51 | 52 | This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size 53 | 54 | ### Making a Progressive Web App 55 | 56 | This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app 57 | 58 | ### Advanced Configuration 59 | 60 | This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration 61 | 62 | ### Deployment 63 | 64 | This section has moved here: https://facebook.github.io/create-react-app/docs/deployment 65 | 66 | ### `npm run build` fails to minify 67 | 68 | This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify 69 | -------------------------------------------------------------------------------- /reactapp/config.js.template: -------------------------------------------------------------------------------- 1 | /** 2 | * in development (npm run start) we use the PROXY env value, configured in .env.development 3 | * so make sure that file exists (see .env.development.example) 4 | * If the variable `REACT_APP_PROXY` is not set, it will use the fallback 5 | * 6 | * in production (npm run build) we use base_url from magento, set directly in 13 | -------------------------------------------------------------------------------- /view/frontend/web/css/main.css: -------------------------------------------------------------------------------- 1 | 2 | /*# sourceMappingURL=main.css.map */ -------------------------------------------------------------------------------- /view/frontend/web/css/main.css.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":[],"names":[],"mappings":"","file":"main.css"} --------------------------------------------------------------------------------