git clone firstname.lastname@example.org:guardian/atom-renderer.git
Install node dependencies:
Install sbt dependencies
sbt compile. You need to have the pgp plugin installed globally.
Installing the node modules above should have installed what you need to run flow.
To check for any compile errors, run flow like this:
yarn run flow
More information on Getting Started with Flow.
Build the app
Build the JS code:
Build the Scala code:
Preview your changes
utils project provides a convenience application to quickly preview the rendering of an atom. Just go in that project and
run it, then hit http://localhost:9000. The app will ask you to select an atom type and type an atom ID, then will render it using the "article" rendering.
You need to publish your changes to NPM as a new version of the Atom Renderer package. Then, you need to open the Guardian's Frontend app on your local machine, require the updated Atom Renderer package and run Frontend.
package.jsonto something like
X.X.X-yourname.test.1Use the semver convention to increment the version number. The '-yourname.test.1' part on the end indicates that this is a version to be used for testing purposes, not for actual use.). Commit these changes.
Build the frontend:
Build the apps:
Make sure you a) have an account on NPMjs. and b) it is added to the Guardian group on npm. Ensure your machine is logged into this account. If not, run:
npm adduserand sign in
Publish your version to NPM:
npm publishThe version you just pushed should appear here: https://www.npmjs.com/package/@guardian/atom-renderer
In the (highly likely) scenario that you've made Scala code changes, that you'll want to test in Frontend (see below) you'll also need to publish your Scala changes locally. First, check that
atom-renderer/version.sbtis correct, i.e. make sure it ends with
-SNAPSHOT, then run
+is significant for cross-compilation of Scala versions - see
project/Dependencies.scalafor those) to add the updated library files to your local
.ivy2/local/com.gu/cache. This'll be tagged with the same version as shown in
In a local branch, tell the app to use the latest version of the atom-renderer:
yarn add @guardian/atom-renderer@X.X.X-yourname.test.1 -W
Recompile the frontend with the new version of Atom Renderer added:
Run the frontend code:
Open new terminal and run:
Switch into the article project, this will let you see the atom page:
You should be able to preview all atoms on this page: http://localhost:9000/open-platform/blog/related-content Here live: https://www.theguardian.com/open-platform/blog/related-content
Publish the library to NPM
Publish the library to Maven
Update Frontend to reference the new versions.
To publish to Maven
Open the sbt interactive shell:
Compile the code
Once the version has updated on Maven, go to the Frontend app, find the Dependencies.scala file and update the version number for Atom-Renderer. Run
./sbtto open the interactive console and then
compileto pull in the new dependency.
Adding a new Atom?
Make sure to add your new atom type in these two files in Atom-Renderer:
Contact us in #journalism-team if you have problems with the repo / readme.
* Yarn is used in these instructions, but you can use npm if you prefer