This PR sets the environment to enable previews on deploy when we send pull requests.
Why
medium-zoom is now hosted on Netlify. It would be nice to create previews for each pull request. It would avoid to pull the code locally and check that the new code works.
Problem
However, Netlify currently serves /examples/javascript as index. The javascript folder contains the default index.html which is the demo, development/index.html for development purpose and preview/index.html to preview a pull request (hopefully).
Since the /examples/javascript folder is not the root, we can't access /dist which contains all the built library. We therefore need to copy these files to /examples/javascript/preview before previewing the changes. Thus, the new script npm run preview.
Solution
In the javascript example:
Create a local development environment
Create a public preview environment which gets populated when Netlify triggers a deploy for pull requests (available at the route /preview)
Add logs in the console in development and preview modes
Add instructions in the README
To run on Netlify:
Create a script npm run preview that builds the library and populates
the preview environment
Hopefully this will work and trigger a preview for each PR at [name].netlify.com/preview.
This PR sets the environment to enable previews on deploy when we send pull requests.
Why
medium-zoom is now hosted on Netlify. It would be nice to create previews for each pull request. It would avoid to pull the code locally and check that the new code works.
Problem
However, Netlify currently serves
/examples/javascript
as index. Thejavascript
folder contains the defaultindex.html
which is the demo,development/index.html
for development purpose andpreview/index.html
to preview a pull request (hopefully).Since the
/examples/javascript
folder is not the root, we can't access/dist
which contains all the built library. We therefore need to copy these files to/examples/javascript/preview
before previewing the changes. Thus, the new scriptnpm run preview
.Solution
In the
javascript
example:development
environmentpreview
environment which gets populated when Netlify triggers a deploy for pull requests (available at the route/preview
)development
andpreview
modesTo run on Netlify:
npm run preview
that builds the library and populates the preview environmentHopefully this will work and trigger a preview for each PR at
[name].netlify.com/preview
.