Posted on by Origami.
TL;DR: We have released new versions of Origami components which bring full NPM support and drops support for Bower. This post explains the changes and how to migrate products to the new version.
We have completed our migration of Origami components from Bower to the NPM registry (see January’s announcement). Component releases on Bower are now deprecated and we recommend all products migrate to the new implementation to keep up-to-date with future releases to Origami.
The FT Bower Registry has now been placed into a maintenance only mode for 12 months, until 1st July 2022, when we will look to decommission the service completely.
Moving Origami from Bower to NPM provides many benefits, such as:
We’re already seeing the benefits with our work on a new autocomplete Origami component, which has been requested by several different FT products. By making this an npm-only component, we’ve been able to benefit from autocomplete packages which already exist on NPM, such as the one made by Gov UK named accessible-autocomplete. This has greatly reduced the amount of code we would have had to write ourselves and meant we could create a prototype for products to trial in a shorter turnaround then previously possible.
The code for Origami components has remained largely the same, aiming to make the migration simpler for our users. The one change we had to make was making the package name for all components now start with @financial-times/
, as they are published under the financial-times namespace on npm. This change means that when importing the javascript and/or sass of a component, you will need to prepend @financial-times/
to the imported package name.
If using Origami components via NPM, it is required to use NPM version 7, this is because version 7 ensures that Origami components are only installed once and no conflicting versions are installed. Origami components do not support using older versions of NPM.
Those changes don’t affect projects which include Origami components using the Origami Build Service, but there is a new version of the Origami Build Service projects must upgrade to.
See the below migration guides for more details.
The following 3 guides show how to migrate to the new npm-only Origami component releases depending on how your project currently includes components:
Use the Origami Build Service URL Updater to guide you through the following process.
Your migration to npm Origami components is finished! 🎉
node_modules
and any built artefactspackage-lock.json
and/or npm-shrinkwrap.json
files and run npm install
again. There is a known issue with upgrading to NPM version 7 and those files becoming corrupted.node_modules
and any built artefactsbower.json
file. All the components are under the @financialt-times
namespace on NPM. I.E. To install o-table, npm install @financial-times/o-table
.bower.json
file, try and find the corresponding package on the NPM registry.bower.json
file and .bowerrc
file if it exists. E.G. rm -f .bowerrc bower.json
bower_components
directory. rm -rf bower_components
bower
from the package.json
file. E.G. npm uninstall bower
includePath
configuration to include node_modules
and remove bower_components
.@financial-times
namespace. E.G. @import 'o-icons/main';
becomes @import '@financial-times/o-icons/main';
node_modules/@financial-times
to your compiler’s includePath
configuration. This will resolve Sass published under @financial-times
without specifying a namespace. We don’t recommend this because it will require all dependent projects do the same. However, this step is required temporarily if your team is not updating to the latest version of Origami components on npm.@financial-times
namespace. E.G. import oTracking from 'o-tracking';
becomes import oTracking from '@financial-times/o-tracking';
and import 'o-layout';
becomes import '@financial-times/o-layout';
Your migration to npm Origami components is finished! 🎉
If your project already installs Origami components via NPM, these were experimental releases which were published to Bower and NPM.
package-lock.json
and/or npm-shrinkwrap.json
files and run npm install
again. There is a known issue with upgrading to NPM version 7 and those files becoming corrupted.lockspot
or is-origami-flat
, these should be removed as they are no longer needed when using NPM version 7. npm uninstall lockspot is-origami-flat
Your migration to npm Origami components is finished! 🎉
We can detect when the relevant repos have been updated to remove Bower. Using that data, we will update:
Below is a breakdown of how many systems and repositories will need to be migrated, split by group:
Group | Systems to migrate | Repositories to migrate |
---|---|---|
Customer Products | 25 | 74 |
FT Core | 2 | 10 |
FT Professional | 4 | 6 |
Internal Products | 4 | 2 |
Operations & Reliability | 3 | 41 |
Make sure your project has upgraded to the latest component released to Bower before attempting to migrate to the NPM-only releases. Here is a table of Bower component releases for reference: