diff --git a/.eslintignore b/.eslintignore index de4d1f0..ec42a82 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,2 +1,3 @@ dist node_modules +sync-version.js diff --git a/composer.json b/composer.json index 7d881d4..05729f5 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "iconify/json", "description": "Iconify icons collection in JSON format", "type": "library", - "version": "1.1.423", + "version": "2.0.0-beta.3", "license": "MIT", "homepage": "https://iconify.design/icon-sets/", "autoload": { diff --git a/package.json b/package.json index d6f8e41..10d5b07 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "@iconify/json", "description": "Iconify icons collection in JSON format", "license": "MIT", - "version": "2.0.0-beta.2", + "version": "2.0.0-beta.3", "publishConfig": { "tag": "next" }, @@ -13,6 +13,7 @@ "url": "git+ssh://git@github.com/iconify/collections-json.git" }, "exports": { + "./*": "./*", ".": { "require": "./dist/index.js", "import": "./dist/index.mjs" @@ -24,7 +25,7 @@ "lib", "collections.json", "collections.md", - "composer.md", + "composer.json", "readme.md" ], "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-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", - "prepublishOnly": "npm run build" + "version": "node sync-version", + "prepublishOnly": "npm run build && npm run version" }, "dependencies": { "@iconify/types": "^1.0.9", diff --git a/sync-version.js b/sync-version.js new file mode 100644 index 0000000..0f25a1e --- /dev/null +++ b/sync-version.js @@ -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]); + } +}