mirror of
https://github.com/Mibew/simple-icons.git
synced 2025-01-31 14:24:45 +03:00
Minify _data/simple-icons.json
on publish (#11903)
This commit is contained in:
parent
14ccea31a8
commit
3fa891560b
2
.github/workflows/publish.yml
vendored
2
.github/workflows/publish.yml
vendored
@ -46,6 +46,8 @@ jobs:
|
||||
run: node scripts/release/reformat-markdown.js "${{ steps.get-version.outputs.version }}"
|
||||
- name: Update SDK Typescript definitions
|
||||
run: node scripts/release/update-sdk-ts-defs.js
|
||||
- name: Minify icons data file
|
||||
run: node scripts/release/minify-icons-data.js
|
||||
- name: Build NodeJS package
|
||||
run: npm run build
|
||||
- name: Deploy to NPM
|
||||
|
9
scripts/release/minify-icons-data.js
Normal file
9
scripts/release/minify-icons-data.js
Normal file
@ -0,0 +1,9 @@
|
||||
/**
|
||||
* @file
|
||||
* Minify _data/simple-icons.json file.
|
||||
*/
|
||||
import {getIconsData} from '../../sdk.mjs';
|
||||
import {writeIconsData} from '../utils.js';
|
||||
|
||||
const icons = await getIconsData();
|
||||
await writeIconsData({icons}, undefined, true);
|
@ -32,14 +32,16 @@ export const getJsonSchemaData = async (
|
||||
* Write icons data to _data/simple-icons.json.
|
||||
* @param {{icons: IconData[]}} iconsData Icons data object.
|
||||
* @param {string} rootDirectory Path to the root directory of the project.
|
||||
* @param {boolean} minify Whether to minify the JSON output.
|
||||
*/
|
||||
export const writeIconsData = async (
|
||||
iconsData,
|
||||
rootDirectory = path.resolve(__dirname, '..'),
|
||||
minify,
|
||||
) => {
|
||||
await fs.writeFile(
|
||||
getIconDataPath(rootDirectory),
|
||||
`${JSON.stringify(iconsData, null, 4)}\n`,
|
||||
`${JSON.stringify(iconsData, null, minify ? 0 : 4)}\n`,
|
||||
'utf8',
|
||||
);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user