Commit Graph

10 Commits

Author SHA1 Message Date
Rishabh
8d5f5febaa Added access control headers in dev mode
no refs

- adds `access-control-allow-origin: *` headers for dev mode
- portal script will be loaded with `cross-origin=anonymous`, access control header is needed to allow script to load
- mimics unpkg which already adds `access-control-allow-origin: *`
2021-06-22 12:16:49 +05:30
Rishabh
885fe178dd Updated local start mode script
no issues

- adds new start-combined script which combines all chunks in `yarn start` for local portal development
- allows easier loading of local portal bundle in ghost via load-portal script, which needs to inject single script
- updates `yarn start:dev` to use updated script which uses the combined mode for better local development

refs
https://gist.github.com/simpixelated/90a3c16c3ed268fe24f5e5c9585ced2f
2021-06-16 20:58:44 +05:30
Rishabh
6e2952901a Updated Portal build script to use rewired webpack config
no issues

- updates Portal build script to use rewired react-scripts config
- updated config handles css embed as well as output location/name for portal bundle as part of cra build
- makes extra webpack bundling redundant for now
- updates dev mode to map the portal source map useful for testing build version locally
- updates custom webpack config with copy plugin for future use

refs -
https://github.com/facebook/create-react-app/issues/5306#issuecomment-603772477
https://gist.github.com/phdesign/3fd306db2bc53f6368e6f0f73bbeff19
2021-06-16 20:58:44 +05:30
Rishabh
7c5cb61ee5 Updated Ghost config URL for dev mode script
no refs

- updates portal url for Ghost config to use a dynamic URL to work same as start mode script
2021-06-16 20:58:44 +05:30
Rishabh
a4afeba183 Updated dev mode script to serve on static URL
no refs

- adds static serve path for portal dev mode script same as start mode
2021-06-11 19:55:43 +05:30
Rishabh
f0ba337659 Cleaned dev mode script
no refs

Cleans up dev mode script for lint errors
2021-06-10 15:05:33 +05:30
Rishabh
47c6509bea Added experimental start mode script for local development
no refs

Adds a new `yarn start:dev` command to start portal in development mode that allows development script to be used directly on Ghost site without needing a build for each change. Allows faster development on Portal locally.
2021-06-10 15:05:08 +05:30
Rishabh
0b2af14567 Added dev script for Portal development
no refs

The new dev script allows running `yarn dev` on the Portal code to make Portal development easier as well as integrate more easily with Ghost config. The script runs a local development server that serves portal bundle, which allows for static `portal` config to be used in Ghost for pointing to Portal script. It also watches the files for any changes, and auto re-builds and bundles latest Portal code.
2021-06-07 14:22:31 +05:30
Rish
0ff2f9df9e Fixed lint in build script
no issue
2020-06-07 01:26:58 +05:30
Rish
c23a80e6f0 Updated build process for single minified script
no issue

By default, CRAs build process creates chunked script files and adds them to default index.html. The updated build process uses `rewire` and `webpack` to -

- Tweak CRAs default behavior by switching off chunking, which leads to a single script
- Uses webpack locally to combine JS and CSS built by above step into a single `bundle.min.js`
2020-03-24 18:49:04 +05:30