2
0
mirror of https://github.com/iconify/iconify.git synced 2024-11-05 21:07:51 +00:00

chore(react): add client only to components

This commit is contained in:
Vjacheslav Trushkin 2024-05-24 13:15:15 +03:00
parent a1e3c0fb98
commit 2ca5eac92b
3 changed files with 25 additions and 1 deletions

View File

@ -13,6 +13,8 @@ const compile = {
dist: true,
// Generate TypeScript definitions in dist
api: true,
// Clean up
cleanup: true,
};
process.argv.slice(2).forEach((cmd) => {

View File

@ -0,0 +1,21 @@
/* eslint-disable */
const { readFileSync, writeFileSync } = require('fs');
// Text to ad
const text = "'use client'";
// List of files to fix
['iconify', 'offline'].forEach((prefix) => {
['js', 'cjs', 'mjs'].forEach((ext) => {
const file = `dist/${prefix}.${ext}`;
try {
const content = readFileSync(file, 'utf8');
if (!content.startsWith(text)) {
writeFileSync(file, text + '\n\n' + content, 'utf8');
console.log('Added client only statement to ' + file);
}
} catch {
//
}
});
});

View File

@ -2,7 +2,7 @@
"name": "@iconify/react",
"description": "Iconify icon component for React.",
"author": "Vjacheslav Trushkin",
"version": "5.0.0-beta.2",
"version": "5.0.0-beta.3",
"publishConfig": {
"access": "public",
"tag": "next"
@ -24,6 +24,7 @@
"build:dist": "rollup -c rollup.config.mjs",
"prebuild:api": "api-extractor run --local --verbose --config api-extractor.offline.json",
"build:api": "api-extractor run --local --verbose --config api-extractor.iconify.json",
"build:cleanup": "node cleanup",
"test": "jest --runInBand"
},
"main": "dist/iconify.js",