From 7890e907be9a14870754353bd25ce77d2f14a52a Mon Sep 17 00:00:00 2001 From: Gabrielle von Koss Date: Thu, 29 Nov 2018 15:37:23 +0000 Subject: [PATCH] update readme, add migration (#568) --- lib/tasks/boilerplate.js | 1 + templates/boilerplate.js | 1 + templates/component-boilerplate/migration.js | 17 ++++++++++ templates/component-boilerplate/read-me.js | 35 ++++++++------------ 4 files changed, 32 insertions(+), 22 deletions(-) create mode 100644 templates/component-boilerplate/migration.js diff --git a/lib/tasks/boilerplate.js b/lib/tasks/boilerplate.js index ad38588e..57121f89 100644 --- a/lib/tasks/boilerplate.js +++ b/lib/tasks/boilerplate.js @@ -14,6 +14,7 @@ const buildTree = (root, name) => { generate('/bower.json', template.bowerJson(name)), generate('/main.js', template.mainJs(name)), generate('/main.scss', template.mainScss(name)), + generate('/MIGRATION.md', template.migration(name)), generate('/origami.json', template.origamiJson(name)), generate('/package.json', template.packageJson()), generate('/README.md', template.readMe(name)), diff --git a/templates/boilerplate.js b/templates/boilerplate.js index 50bfa1a7..defb6a43 100644 --- a/templates/boilerplate.js +++ b/templates/boilerplate.js @@ -10,6 +10,7 @@ module.exports = { gitIgnore: require('./component-boilerplate/git-ignore'), mainJs: require('./component-boilerplate/main-js'), mainScss: require('./component-boilerplate/main-scss'), + migration: require('./component-boilerplate/migration'), origamiJson: require('./component-boilerplate/origami-json'), readMe: require('./component-boilerplate/read-me'), srcJs: require('./component-boilerplate/src-js'), diff --git a/templates/component-boilerplate/migration.js b/templates/component-boilerplate/migration.js new file mode 100644 index 00000000..02afb107 --- /dev/null +++ b/templates/component-boilerplate/migration.js @@ -0,0 +1,17 @@ +'use strict'; + +module.exports = (name) => { + return `_Migration guides are very important! Always include one for major releases. To create a codeblock that has diff highligting, use three backticks followed by the word diff_ + +### Migrating from 1.X.X to 2.X.X + +The 2.0.0 release changes the default behaviour of ${name.original}. + +\`\`\`diff +
+- remove this line ++ add this line +
+\`\`\` +`; +}; diff --git a/templates/component-boilerplate/read-me.js b/templates/component-boilerplate/read-me.js index cd51e433..bf0c4c4d 100644 --- a/templates/component-boilerplate/read-me.js +++ b/templates/component-boilerplate/read-me.js @@ -1,7 +1,7 @@ 'use strict'; module.exports = (name) => { - return `${name.original} [![Circle CI](https://circleci.com/gh/Financial-Times/${name.original}/tree/master.svg?style=svg)](https://circleci.com/gh/Financial-Times/${name.original}/tree/master) + return `${name.original} [![Circle CI](https://circleci.com/gh/Financial-Times/${name.original}/tree/master.svg?style=svg)](https://circleci.com/gh/Financial-Times/${name.original}/tree/master)[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](#licence) ================= _A short description of what this component does._ @@ -9,17 +9,16 @@ _A short description of what this component does._ _A table of contents to help people find things_ -- [Usage](#usage) - - [Markup](#markup) - - [JavaScript](#javascript) - - [Sass](#sass) + +- [Markup](#markup) +- [JavaScript](#javascript) +- [Sass](#sass) - [Troubleshooting](#troubleshooting) - [Contributing](#contributing) -- [Migration guide](#migration-guide) +- [Migration](#migration) - [Contact](#contact) - [Licence](#licence) -## Usage _Whatever usage instructions your component has. We've broken this down by Markup, JavaScript and Sass, but it depends how complex your component is._ ### Markup @@ -75,28 +74,20 @@ Fix it by turning it off and on again If your component is particularly complicated (image sets fall into this category) then a contributing section or even a contributing.md might be useful. -## Migration guide -_Migration guides are very important! Always include one for major releases. To create a codeblock that has diff highligting, use three backticks followed by the word diff_ - -### Migrating from 1.X.X to 2.X.X - -The 2.0.0 release changes the default behaviour of ${name.original}. +## Migration -\`\`\`diff -
-- remove this line -+ add this line -
-\`\`\` +_We use tables to represent our migration guides. Be sure to update it when there is a major release, and update MIGRATION.md, as well_ ---- +State | Major Version | Last Minor Release | Migration guide | +:---: | :---: | :---: | :---: +✨ active | 3 | N/A | [migrate to v3](MIGRATION.md#migrating-from-v2-to-v3) | +⚠ maintained | 2 | 2.0 | [migrate to v2](MIGRATION.md#migrating-from-v1-to-v2) | +╳ deprecated | 1 | 1.0 | N/A | ## Contact If you have any questions or comments about this component, or need help using it, please either [raise an issue](https://github.com/Financial-Times/${name.original}/issues), visit [#ft-origami](https://financialtimes.slack.com/messages/ft-origami/) or email [Origami Support](mailto:origami-support@ft.com). ----- - ## Licence This software is published by the Financial Times under the [MIT licence](http://opensource.org/licenses/MIT).`;