All Mac installation instructions assume you already have Homebrew installed.
# From https://github.com/creationix/nvm
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.1/install.sh | bashgit clone [email protected]:openstax/os-webview.git
cd os-webview
script/setupTo build the site for development and load it in your default web browser with BrowserSync, simply run:
. script/bootstrap
script/devThat will create a new dev directory from which the site is served. Changes should be made to files in the src directory. Webpack will automatically watch for changes in src, perform any compilation and transpilation necessary, and update the result in dev.
To run the linters and unit tests locally, enter:
script/build
script/testYou can also just run the linters (yarn lint) individually without rebuilding.
You can run individual tests by name (yarn jest layout.test).
Check code coverage by loading into your browser /coverage/index.html from the
root of the git repository.
Note: The unit tests require the dev build to be built (in the dev directory).
./script/build productionYou must configure your web server to host the files in the dist directory that gets created. No special configuration is required, although it is highly recommended to serve the site using HTTP/2.
The API_ORIGIN environment variable can be used to specify which CMS instance is used by os-webview. os-webview settings are loaded from the specified CMS instance's webview-settings API. The default API_ORIGIN for script/dev is https://dev.openstax.org
You can upgrade dependencies manually or you can upgrade all of them by running ./script/upgrade && ./script/test.
The version must be updated in each release to help prevent browser caching issues. The version is updated in 3 locations.
- version.js Update the constant.
- index.html Update the version on reference to main.css and bundle.js
- package.json Update the version element