2
0
mirror of https://github.com/iconify/iconify.git synced 2024-09-19 16:59:02 +00:00

Automatically update version in readme

This commit is contained in:
Vjacheslav Trushkin 2020-06-02 00:20:11 +03:00
parent ff7552abda
commit eb758c4fde
2 changed files with 29 additions and 5 deletions

View File

@ -18,7 +18,7 @@ Iconify uses a new innovative approach to loading icons. Unlike fonts and SVG fr
Iconify SVG framework is designed to be as easy to use as possible.
Add this line to your page to load Iconify SVG framework (you can add it to `<head>` section of page or before `</body>`):
Add this line to your page to load Iconify SVG framework (you can add it to `<head>` section of the page or before `</body>`):
```html
<script src="https://code.iconify.design/2/2.0.0-beta.2/iconify.min.js"></script>
@ -251,7 +251,7 @@ Possible values for `data-rotate`: 90deg, 180deg, 270deg.
If you use both flip and rotation, the icon is flipped first, then rotated.
To use custom transformations use CSS transform rule. Add `!important` after rule to override the SVG inline style (inline style exists to fix a SVG rendering bug in Firefox browser).
To use custom transformations use CSS transform rule. Add `!important` after rule to override the SVG inline style (inline style exists to fix an SVG rendering bug in Firefox browser).
```html
<span data-icon="twemoji-helicopter" class="iconify icon-helicopter"></span>

View File

@ -1,4 +1,4 @@
import { readFileSync } from 'fs';
import { readFileSync, writeFileSync } from 'fs';
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import buble from '@rollup/plugin-buble';
@ -10,7 +10,7 @@ const global = 'Iconify';
// Wrapper to export module as global and as ES module
const header = `/**
* (c) Vjacheslav Trushkin <cyberalien@gmail.com>
* (c) Iconify
*
* For the full copyright and license information, please view the license.txt or license.gpl.txt
* files at https://github.com/iconify/iconify
@ -45,9 +45,33 @@ const replacements = {};
const packageJSON = JSON.parse(readFileSync('package.json', 'utf8'));
replacements['__iconify_version__'] = packageJSON.version;
// Update README.md
let readme = readFileSync('README.md', 'utf8');
const oldReadme = readme;
const replaceCodeLink = (search) => {
let start = 0;
let pos;
while ((pos = readme.indexOf(search, start)) !== -1) {
start = pos + search.length;
let pos2 = readme.indexOf('/', start);
if (pos2 === -1) {
return;
}
readme =
readme.slice(0, start) + packageJSON.version + readme.slice(pos2);
}
};
replaceCodeLink('/code.iconify.design/2/');
replaceCodeLink('/@iconify/iconify@');
if (readme !== oldReadme) {
console.log('Updatead README');
writeFileSync('README.md', readme, 'utf8');
}
// Export configuration
const config = [];
[false, true].forEach(compress => {
[false, true].forEach((compress) => {
const item = {
input: `lib/${name}.js`,
output: [