2
0
mirror of https://github.com/iconify/collections-json.git synced 2024-11-24 05:37:41 +00:00

Automatically update version in composer.json

This commit is contained in:
Vjacheslav Trushkin 2021-11-09 10:40:15 +02:00
parent 2e5b6c8693
commit 2ec60be269
4 changed files with 26 additions and 4 deletions

View File

@ -1,2 +1,3 @@
dist dist
node_modules node_modules
sync-version.js

View File

@ -2,7 +2,7 @@
"name": "iconify/json", "name": "iconify/json",
"description": "Iconify icons collection in JSON format", "description": "Iconify icons collection in JSON format",
"type": "library", "type": "library",
"version": "1.1.423", "version": "2.0.0-beta.3",
"license": "MIT", "license": "MIT",
"homepage": "https://iconify.design/icon-sets/", "homepage": "https://iconify.design/icon-sets/",
"autoload": { "autoload": {

View File

@ -2,7 +2,7 @@
"name": "@iconify/json", "name": "@iconify/json",
"description": "Iconify icons collection in JSON format", "description": "Iconify icons collection in JSON format",
"license": "MIT", "license": "MIT",
"version": "2.0.0-beta.2", "version": "2.0.0-beta.3",
"publishConfig": { "publishConfig": {
"tag": "next" "tag": "next"
}, },
@ -13,6 +13,7 @@
"url": "git+ssh://git@github.com/iconify/collections-json.git" "url": "git+ssh://git@github.com/iconify/collections-json.git"
}, },
"exports": { "exports": {
"./*": "./*",
".": { ".": {
"require": "./dist/index.js", "require": "./dist/index.js",
"import": "./dist/index.mjs" "import": "./dist/index.mjs"
@ -24,7 +25,7 @@
"lib", "lib",
"collections.json", "collections.json",
"collections.md", "collections.md",
"composer.md", "composer.json",
"readme.md" "readme.md"
], ],
"main": "dist/index.js", "main": "dist/index.js",
@ -37,7 +38,8 @@
"test-locate-esm": "jest --clearCache && cross-env NODE_OPTIONS=--experimental-vm-modules npx jest --config=jest.esm.config.ts src/locate.esm.test.ts -i", "test-locate-esm": "jest --clearCache && cross-env NODE_OPTIONS=--experimental-vm-modules npx jest --config=jest.esm.config.ts src/locate.esm.test.ts -i",
"test-locate-cjs": "npm run build && jest --clearCache && jest --config=jest.cjs.config.ts src/locate.cjs.test.ts -i", "test-locate-cjs": "npm run build && jest --clearCache && jest --config=jest.cjs.config.ts src/locate.cjs.test.ts -i",
"test": "npm run test-esm && npm run test-cjs && npm run test-locate-esm && npm run test-locate-cjs", "test": "npm run test-esm && npm run test-cjs && npm run test-locate-esm && npm run test-locate-cjs",
"prepublishOnly": "npm run build" "version": "node sync-version",
"prepublishOnly": "npm run build && npm run version"
}, },
"dependencies": { "dependencies": {
"@iconify/types": "^1.0.9", "@iconify/types": "^1.0.9",

19
sync-version.js Normal file
View File

@ -0,0 +1,19 @@
const fs = require('fs');
// Get version number from package.json
const version = JSON.parse(
fs.readFileSync(__dirname + '/package.json', 'utf8')
).version;
// Files to update
const files = ['composer.json'];
for (let i = 0; i < files.length; i++) {
const filename = __dirname + '/' + files[i];
const content = JSON.parse(fs.readFileSync(filename, 'utf8'));
if (content.version !== version) {
content.version = version;
const newContent = JSON.stringify(content, null, '\t');
fs.writeFileSync(filename, newContent, 'utf8');
console.log('Updated version in', files[i]);
}
}