guardian / content-atom   3.4.4

Apache License 2.0 GitHub

Schema for a content atom

Scala versions: 2.13 2.12 2.11 2.10
sbt plugins: 0.13

Content Atom Model Definition

This is the Thrift definition of the Content Atom model, and the published versions of this repository are built from the autogenerated code in various languages.

Maven Central

Adding a new atom type

In order for the scala code generated from the thrift definitions to be packaged correctly a scala namespace needs to be included. For example for the chart atom this would be: #@namespace scala com.gu.contentatom.thrift.atom.chart

How to release

A note on version numbers

The version field in package.json should be kept in sync with the version in version.sbt

Prerequisites

Prior to releasing, you will need to ensure that:

  • tsc is installed on your machine (e.g. brew install typescript)
  • npm is installed on your machine
  • you have an NPM account which is part of the @guardian org
  • you have configured an NPM access token to publish to @guardian; a convenient way to set this up is to execute npm login locally and follow the prompts; this will create/append to an ~/.npmrc file with the sufficient config
  • you have the followed the guide for publishing to Maven and Sonatype

Releasing

To release to Maven Central:

release cross

This will release these artifacts:

  • content-atom-model-thrift-$version.jar contains only the Thrift files
  • content-atom-model_2.13-$version.jar contains the Thrift files and Scrooge-generated Scala 2.13 classes
  • content-atom-model_2.12-$version.jar contains the Thrift files and Scrooge-generated Scala 2.12 classes

Note that support for scala 2.11 ended with scrooge 21.3, so we won't output

  • content-atom-model_2.11-$version.jar any more.

To release to NPM:

project typescriptClasses
releaseNpm <version released to Maven>

If you need to make a beta release build available for testing elsewhere, start sbt with

$ sbt -DRELEASE_TYPE=beta

then follow the above release steps as usual. You'll be prompted that this is a BETA release and for a version number that looks like 1.2.3-beta.n where n is the beta version number you'll specify. This isn't really tracked so make sure it's a new build by checking Maven and NPM first.

When releasing the typescript classes to NPM, you'll manually type the version number to match what you released to Sonatype/Maven for Scala. Our sbt-scrooge-typescript sbt plugin takes care of applying a --tag beta to the NPM release when the RELEASE_TYPE=beta system property is available.

To cross release locally use

$ sbt '+publishLocal'