2
0
mirror of https://github.com/iconify/iconify.git synced 2024-11-09 14:50:56 +00:00

Web component: fix build scripts

This commit is contained in:
Vjacheslav Trushkin 2022-04-30 19:16:10 +03:00
parent 9043ec684f
commit f65d3de405
8 changed files with 101 additions and 429 deletions

View File

@ -1,8 +1,7 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"mainEntryPointFilePath": "lib/iconify.d.ts",
"mainEntryPointFilePath": "lib/index.d.ts",
"bundledPackages": [
"@iconify/types",
"@iconify/core",
"@iconify/utils",
"@cyberalien/redundancy",
@ -17,7 +16,7 @@
},
"dtsRollup": {
"enabled": true,
"untrimmedFilePath": "<projectFolder>/dist/iconify.d.ts"
"untrimmedFilePath": "<projectFolder>/dist/iconify-icon.d.ts"
},
"tsdocMetadata": {
"enabled": false

View File

@ -57,11 +57,11 @@ const fileExists = (file) => {
return true;
};
if (compile.dist && !fileExists(packagesDir + '/iconify/lib/iconify.js')) {
if (compile.dist && !fileExists(packagesDir + '/icon/lib/index.js')) {
compile.lib = true;
}
if (compile.api && !fileExists(packagesDir + '/iconify/lib/iconify.d.ts')) {
if (compile.api && !fileExists(packagesDir + '/icon/lib/index.d.ts')) {
compile.lib = true;
}
@ -78,11 +78,6 @@ if (compile.core) {
});
}
// Add api2
if (compile.api) {
compile.api2 = true;
}
// Compile other packages
Object.keys(compile).forEach((key) => {
if (key !== 'core' && compile[key]) {

View File

@ -8,10 +8,12 @@
"name": "iconify-icon",
"version": "0.0.1-dev",
"license": "MIT",
"dependencies": {
"@iconify/types": "^1.1.0"
},
"devDependencies": {
"@iconify/core": "^1.3.2",
"@microsoft/api-extractor": "^7.19.5",
"@rollup/plugin-buble": "^0.21.3",
"@rollup/plugin-node-resolve": "^13.1.3",
"@rollup/plugin-replace": "^4.0.0",
"@types/jest": "^27.4.1",
@ -620,8 +622,7 @@
"node_modules/@iconify/types": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@iconify/types/-/types-1.1.0.tgz",
"integrity": "sha512-Jh0llaK2LRXQoYsorIH8maClebsnzTcve+7U3rQUSnC11X4jtPnFuyatqFLvMxZ8MLG8dB4zfHsbPfuvxluONw==",
"dev": true
"integrity": "sha512-Jh0llaK2LRXQoYsorIH8maClebsnzTcve+7U3rQUSnC11X4jtPnFuyatqFLvMxZ8MLG8dB4zfHsbPfuvxluONw=="
},
"node_modules/@iconify/utils": {
"version": "1.0.32",
@ -1531,23 +1532,6 @@
"node": ">= 8"
}
},
"node_modules/@rollup/plugin-buble": {
"version": "0.21.3",
"resolved": "https://registry.npmjs.org/@rollup/plugin-buble/-/plugin-buble-0.21.3.tgz",
"integrity": "sha512-Iv8cCuFPnMdqV4pcyU+OrfjOfagPArRQ1PyQjx5KgHk3dARedI+8PNTLSMpJts0lQJr8yF2pAU4GxpxCBJ9HYw==",
"dev": true,
"dependencies": {
"@rollup/pluginutils": "^3.0.8",
"@types/buble": "^0.19.2",
"buble": "^0.20.0"
},
"engines": {
"node": ">= 8.0.0"
},
"peerDependencies": {
"rollup": "^1.20.0||^2.0.0"
}
},
"node_modules/@rollup/plugin-node-resolve": {
"version": "13.2.1",
"resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-13.2.1.tgz",
@ -1740,15 +1724,6 @@
"@babel/types": "^7.3.0"
}
},
"node_modules/@types/buble": {
"version": "0.19.2",
"resolved": "https://registry.npmjs.org/@types/buble/-/buble-0.19.2.tgz",
"integrity": "sha512-uUD8zIfXMKThmFkahTXDGI3CthFH1kMg2dOm3KLi4GlC5cbARA64bEcUMbbWdWdE73eoc/iBB9PiTMqH0dNS2Q==",
"dev": true,
"dependencies": {
"magic-string": "^0.25.0"
}
},
"node_modules/@types/estree": {
"version": "0.0.39",
"resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.39.tgz",
@ -2065,6 +2040,7 @@
"resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.2.tgz",
"integrity": "sha512-XtGIhXwF8YM8bJhGxG5kXgjkEuNGLTkoYqVE+KMR+aspr4KGYmKYg7yUe3KghyQ9yheNwLnjmzh/7+gfDBmHCQ==",
"dev": true,
"peer": true,
"bin": {
"acorn": "bin/acorn"
},
@ -2072,15 +2048,6 @@
"node": ">=0.4.0"
}
},
"node_modules/acorn-dynamic-import": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/acorn-dynamic-import/-/acorn-dynamic-import-4.0.0.tgz",
"integrity": "sha512-d3OEjQV4ROpoflsnUA8HozoIR504TFxNivYEUi6uwz0IYhBkTDXGuWlNdMtybRt3nqVx/L6XqMt0FxkXuWKZhw==",
"dev": true,
"peerDependencies": {
"acorn": "^6.0.0"
}
},
"node_modules/acorn-globals": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-6.0.0.tgz",
@ -2660,24 +2627,6 @@
"node-int64": "^0.4.0"
}
},
"node_modules/buble": {
"version": "0.20.0",
"resolved": "https://registry.npmjs.org/buble/-/buble-0.20.0.tgz",
"integrity": "sha512-/1gnaMQE8xvd5qsNBl+iTuyjJ9XxeaVxAMF86dQ4EyxFJOZtsgOS8Ra+7WHgZTam5IFDtt4BguN0sH0tVTKrOw==",
"dev": true,
"dependencies": {
"acorn": "^6.4.1",
"acorn-dynamic-import": "^4.0.0",
"acorn-jsx": "^5.2.0",
"chalk": "^2.4.2",
"magic-string": "^0.25.7",
"minimist": "^1.2.5",
"regexpu-core": "4.5.4"
},
"bin": {
"buble": "bin/buble"
}
},
"node_modules/buffer-from": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz",
@ -6591,12 +6540,6 @@
"node": "*"
}
},
"node_modules/minimist": {
"version": "1.2.6",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz",
"integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==",
"dev": true
},
"node_modules/ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
@ -6995,24 +6938,6 @@
"integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==",
"dev": true
},
"node_modules/regenerate": {
"version": "1.4.2",
"resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.2.tgz",
"integrity": "sha512-zrceR/XhGYU/d/opr2EKO7aRHUeiBI8qjtfHqADTwZd6Szfy16la6kqD0MIUs5z5hx6AaKa+PixpPrR289+I0A==",
"dev": true
},
"node_modules/regenerate-unicode-properties": {
"version": "8.2.0",
"resolved": "https://registry.npmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-8.2.0.tgz",
"integrity": "sha512-F9DjY1vKLo/tPePDycuH3dn9H1OTPIkVD9Kz4LODu+F2C75mgjAJ7x/gwy6ZcSNRAAkhNlJSOHRe8k3p+K9WhA==",
"dev": true,
"dependencies": {
"regenerate": "^1.4.0"
},
"engines": {
"node": ">=4"
}
},
"node_modules/regexpp": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz",
@ -7025,50 +6950,6 @@
"url": "https://github.com/sponsors/mysticatea"
}
},
"node_modules/regexpu-core": {
"version": "4.5.4",
"resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-4.5.4.tgz",
"integrity": "sha512-BtizvGtFQKGPUcTy56o3nk1bGRp4SZOTYrDtGNlqCQufptV5IkkLN6Emw+yunAJjzf+C9FQFtvq7IoA3+oMYHQ==",
"dev": true,
"dependencies": {
"regenerate": "^1.4.0",
"regenerate-unicode-properties": "^8.0.2",
"regjsgen": "^0.5.0",
"regjsparser": "^0.6.0",
"unicode-match-property-ecmascript": "^1.0.4",
"unicode-match-property-value-ecmascript": "^1.1.0"
},
"engines": {
"node": ">=4"
}
},
"node_modules/regjsgen": {
"version": "0.5.2",
"resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.5.2.tgz",
"integrity": "sha512-OFFT3MfrH90xIW8OOSyUrk6QHD5E9JOTeGodiJeBS3J6IwlgzJMNE/1bZklWz5oTg+9dCMyEetclvCVXOPoN3A==",
"dev": true
},
"node_modules/regjsparser": {
"version": "0.6.9",
"resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.6.9.tgz",
"integrity": "sha512-ZqbNRz1SNjLAiYuwY0zoXW8Ne675IX5q+YHioAGbCw4X96Mjl2+dcX9B2ciaeyYjViDAfvIjFpQjJgLttTEERQ==",
"dev": true,
"dependencies": {
"jsesc": "~0.5.0"
},
"bin": {
"regjsparser": "bin/parser"
}
},
"node_modules/regjsparser/node_modules/jsesc": {
"version": "0.5.0",
"resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz",
"integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=",
"dev": true,
"bin": {
"jsesc": "bin/jsesc"
}
},
"node_modules/require-directory": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
@ -7899,46 +7780,6 @@
"node": ">=4.2.0"
}
},
"node_modules/unicode-canonical-property-names-ecmascript": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-1.0.4.tgz",
"integrity": "sha512-jDrNnXWHd4oHiTZnx/ZG7gtUTVp+gCcTTKr8L0HjlwphROEW3+Him+IpvC+xcJEFegapiMZyZe02CyuOnRmbnQ==",
"dev": true,
"engines": {
"node": ">=4"
}
},
"node_modules/unicode-match-property-ecmascript": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/unicode-match-property-ecmascript/-/unicode-match-property-ecmascript-1.0.4.tgz",
"integrity": "sha512-L4Qoh15vTfntsn4P1zqnHulG0LdXgjSO035fEpdtp6YxXhMT51Q6vgM5lYdG/5X3MjS+k/Y9Xw4SFCY9IkR0rg==",
"dev": true,
"dependencies": {
"unicode-canonical-property-names-ecmascript": "^1.0.4",
"unicode-property-aliases-ecmascript": "^1.0.4"
},
"engines": {
"node": ">=4"
}
},
"node_modules/unicode-match-property-value-ecmascript": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-1.2.0.tgz",
"integrity": "sha512-wjuQHGQVofmSJv1uVISKLE5zO2rNGzM/KCYZch/QQvez7C1hUhBIuZ701fYXExuufJFMPhv2SyL8CyoIfMLbIQ==",
"dev": true,
"engines": {
"node": ">=4"
}
},
"node_modules/unicode-property-aliases-ecmascript": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-1.1.0.tgz",
"integrity": "sha512-PqSoPh/pWetQ2phoj5RLiaqIk4kCNwoV3CI+LfGmWLKI3rE3kl1h59XpX2BjgDrmbxD9ARtQobPGU1SguCYuQg==",
"dev": true,
"engines": {
"node": ">=4"
}
},
"node_modules/universalify": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz",
@ -8733,8 +8574,7 @@
"@iconify/types": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@iconify/types/-/types-1.1.0.tgz",
"integrity": "sha512-Jh0llaK2LRXQoYsorIH8maClebsnzTcve+7U3rQUSnC11X4jtPnFuyatqFLvMxZ8MLG8dB4zfHsbPfuvxluONw==",
"dev": true
"integrity": "sha512-Jh0llaK2LRXQoYsorIH8maClebsnzTcve+7U3rQUSnC11X4jtPnFuyatqFLvMxZ8MLG8dB4zfHsbPfuvxluONw=="
},
"@iconify/utils": {
"version": "1.0.32",
@ -9438,17 +9278,6 @@
"fastq": "^1.6.0"
}
},
"@rollup/plugin-buble": {
"version": "0.21.3",
"resolved": "https://registry.npmjs.org/@rollup/plugin-buble/-/plugin-buble-0.21.3.tgz",
"integrity": "sha512-Iv8cCuFPnMdqV4pcyU+OrfjOfagPArRQ1PyQjx5KgHk3dARedI+8PNTLSMpJts0lQJr8yF2pAU4GxpxCBJ9HYw==",
"dev": true,
"requires": {
"@rollup/pluginutils": "^3.0.8",
"@types/buble": "^0.19.2",
"buble": "^0.20.0"
}
},
"@rollup/plugin-node-resolve": {
"version": "13.2.1",
"resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-13.2.1.tgz",
@ -9621,15 +9450,6 @@
"@babel/types": "^7.3.0"
}
},
"@types/buble": {
"version": "0.19.2",
"resolved": "https://registry.npmjs.org/@types/buble/-/buble-0.19.2.tgz",
"integrity": "sha512-uUD8zIfXMKThmFkahTXDGI3CthFH1kMg2dOm3KLi4GlC5cbARA64bEcUMbbWdWdE73eoc/iBB9PiTMqH0dNS2Q==",
"dev": true,
"requires": {
"magic-string": "^0.25.0"
}
},
"@types/estree": {
"version": "0.0.39",
"resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.39.tgz",
@ -9856,14 +9676,8 @@
"version": "6.4.2",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.2.tgz",
"integrity": "sha512-XtGIhXwF8YM8bJhGxG5kXgjkEuNGLTkoYqVE+KMR+aspr4KGYmKYg7yUe3KghyQ9yheNwLnjmzh/7+gfDBmHCQ==",
"dev": true
},
"acorn-dynamic-import": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/acorn-dynamic-import/-/acorn-dynamic-import-4.0.0.tgz",
"integrity": "sha512-d3OEjQV4ROpoflsnUA8HozoIR504TFxNivYEUi6uwz0IYhBkTDXGuWlNdMtybRt3nqVx/L6XqMt0FxkXuWKZhw==",
"dev": true,
"requires": {}
"peer": true
},
"acorn-globals": {
"version": "6.0.0",
@ -10320,21 +10134,6 @@
"node-int64": "^0.4.0"
}
},
"buble": {
"version": "0.20.0",
"resolved": "https://registry.npmjs.org/buble/-/buble-0.20.0.tgz",
"integrity": "sha512-/1gnaMQE8xvd5qsNBl+iTuyjJ9XxeaVxAMF86dQ4EyxFJOZtsgOS8Ra+7WHgZTam5IFDtt4BguN0sH0tVTKrOw==",
"dev": true,
"requires": {
"acorn": "^6.4.1",
"acorn-dynamic-import": "^4.0.0",
"acorn-jsx": "^5.2.0",
"chalk": "^2.4.2",
"magic-string": "^0.25.7",
"minimist": "^1.2.5",
"regexpu-core": "4.5.4"
}
},
"buffer-from": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz",
@ -13269,12 +13068,6 @@
"brace-expansion": "^1.1.7"
}
},
"minimist": {
"version": "1.2.6",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz",
"integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==",
"dev": true
},
"ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
@ -13567,64 +13360,12 @@
"integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==",
"dev": true
},
"regenerate": {
"version": "1.4.2",
"resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.2.tgz",
"integrity": "sha512-zrceR/XhGYU/d/opr2EKO7aRHUeiBI8qjtfHqADTwZd6Szfy16la6kqD0MIUs5z5hx6AaKa+PixpPrR289+I0A==",
"dev": true
},
"regenerate-unicode-properties": {
"version": "8.2.0",
"resolved": "https://registry.npmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-8.2.0.tgz",
"integrity": "sha512-F9DjY1vKLo/tPePDycuH3dn9H1OTPIkVD9Kz4LODu+F2C75mgjAJ7x/gwy6ZcSNRAAkhNlJSOHRe8k3p+K9WhA==",
"dev": true,
"requires": {
"regenerate": "^1.4.0"
}
},
"regexpp": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz",
"integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==",
"dev": true
},
"regexpu-core": {
"version": "4.5.4",
"resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-4.5.4.tgz",
"integrity": "sha512-BtizvGtFQKGPUcTy56o3nk1bGRp4SZOTYrDtGNlqCQufptV5IkkLN6Emw+yunAJjzf+C9FQFtvq7IoA3+oMYHQ==",
"dev": true,
"requires": {
"regenerate": "^1.4.0",
"regenerate-unicode-properties": "^8.0.2",
"regjsgen": "^0.5.0",
"regjsparser": "^0.6.0",
"unicode-match-property-ecmascript": "^1.0.4",
"unicode-match-property-value-ecmascript": "^1.1.0"
}
},
"regjsgen": {
"version": "0.5.2",
"resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.5.2.tgz",
"integrity": "sha512-OFFT3MfrH90xIW8OOSyUrk6QHD5E9JOTeGodiJeBS3J6IwlgzJMNE/1bZklWz5oTg+9dCMyEetclvCVXOPoN3A==",
"dev": true
},
"regjsparser": {
"version": "0.6.9",
"resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.6.9.tgz",
"integrity": "sha512-ZqbNRz1SNjLAiYuwY0zoXW8Ne675IX5q+YHioAGbCw4X96Mjl2+dcX9B2ciaeyYjViDAfvIjFpQjJgLttTEERQ==",
"dev": true,
"requires": {
"jsesc": "~0.5.0"
},
"dependencies": {
"jsesc": {
"version": "0.5.0",
"resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz",
"integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=",
"dev": true
}
}
},
"require-directory": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
@ -14223,34 +13964,6 @@
"integrity": "sha512-yNIatDa5iaofVozS/uQJEl3JRWLKKGJKh6Yaiv0GLGSuhpFJe7P3SbHZ8/yjAHRQwKRoA6YZqlfjXWmVzoVSMw==",
"dev": true
},
"unicode-canonical-property-names-ecmascript": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-1.0.4.tgz",
"integrity": "sha512-jDrNnXWHd4oHiTZnx/ZG7gtUTVp+gCcTTKr8L0HjlwphROEW3+Him+IpvC+xcJEFegapiMZyZe02CyuOnRmbnQ==",
"dev": true
},
"unicode-match-property-ecmascript": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/unicode-match-property-ecmascript/-/unicode-match-property-ecmascript-1.0.4.tgz",
"integrity": "sha512-L4Qoh15vTfntsn4P1zqnHulG0LdXgjSO035fEpdtp6YxXhMT51Q6vgM5lYdG/5X3MjS+k/Y9Xw4SFCY9IkR0rg==",
"dev": true,
"requires": {
"unicode-canonical-property-names-ecmascript": "^1.0.4",
"unicode-property-aliases-ecmascript": "^1.0.4"
}
},
"unicode-match-property-value-ecmascript": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-1.2.0.tgz",
"integrity": "sha512-wjuQHGQVofmSJv1uVISKLE5zO2rNGzM/KCYZch/QQvez7C1hUhBIuZ701fYXExuufJFMPhv2SyL8CyoIfMLbIQ==",
"dev": true
},
"unicode-property-aliases-ecmascript": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-1.1.0.tgz",
"integrity": "sha512-PqSoPh/pWetQ2phoj5RLiaqIk4kCNwoV3CI+LfGmWLKI3rE3kl1h59XpX2BjgDrmbxD9ARtQobPGU1SguCYuQg==",
"dev": true
},
"universalify": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz",

View File

@ -4,6 +4,10 @@
"author": "Vjacheslav Trushkin <cyberalien@gmail.com> (https://iconify.design)",
"version": "0.0.1-dev",
"license": "MIT",
"main": "./dist/iconify-icon.cjs",
"types": "./dist/iconify-icon.d.ts",
"browser": "./dist/iconify-icon.min.js",
"module": "./dist/iconify-icon.mjs",
"bugs": "https://github.com/iconify/iconify/issues",
"homepage": "https://iconify.design/",
"funding": "http://github.com/sponsors/cyberalien",
@ -17,16 +21,40 @@
"lint": "eslint src/**/*.ts",
"prebuild": "npm run lint && npm run clean",
"build": "node build",
"build:api": "api-extractor run --local --verbose",
"build:lib": "tsc -b",
"build:dist": "rollup -c rollup.config.js",
"test:jest": "jest --runInBand",
"test:mjs": "echo \"TODO...\"",
"test": "npm run test:jest && npm run test:mjs"
},
"exports": {
"./*": "./*",
".": {
"require": "./dist/iconify-icon.cjs",
"import": "./dist/iconify-icon.mjs",
"types": "./dist/iconify-icon.d.ts",
"default": "./dist/iconify-icon.min.js"
},
"./dist/iconify": {
"require": "./dist/iconify-icon.cjs",
"import": "./dist/iconify-icon.mjs",
"types": "./dist/iconify-icon.d.ts",
"default": "./dist/iconify-icon.min.js"
},
"./dist/iconify.min": {
"require": "./dist/iconify-icon.cjs",
"import": "./dist/iconify-icon.mjs",
"types": "./dist/iconify-icon.d.ts",
"default": "./dist/iconify-icon.min.js"
}
},
"dependencies": {
"@iconify/types": "^1.1.0"
},
"devDependencies": {
"@iconify/core": "^1.3.2",
"@microsoft/api-extractor": "^7.19.5",
"@rollup/plugin-buble": "^0.21.3",
"@rollup/plugin-node-resolve": "^13.1.3",
"@rollup/plugin-replace": "^4.0.0",
"@types/jest": "^27.4.1",

View File

@ -1,51 +1,21 @@
import { readFileSync, writeFileSync } from 'fs';
import { readFileSync } from 'fs';
import resolve from '@rollup/plugin-node-resolve';
import buble from '@rollup/plugin-buble';
import { terser } from 'rollup-plugin-terser';
import replace from '@rollup/plugin-replace';
const names = ['iconify', 'iconify.without-api'];
const global = 'Iconify';
// Wrapper to export module as global and as ES module
// Header
const header = `/**
* (c) Iconify
*
* For the full copyright and license information, please view the license.txt or license.gpl.txt
* For the full copyright and license information, please view the license.txt
* files at https://github.com/iconify/iconify
*
* Licensed under Apache 2.0 or GPL 2.0 at your option.
* If derivative product is not compatible with one of licenses, you can pick one of licenses.
* Licensed under MIT.
*
* @license Apache 2.0
* @license GPL 2.0
* @license MIT
* @version __iconify_version__
*/`;
const defaultFooter = `
// Export to window or web worker
try {
if (self.Iconify === void 0) {
self.Iconify = Iconify;
}
} catch (err) {
}`;
const iifeFooter = `
// Export as ES module
if (typeof exports === 'object') {
try {
exports.__esModule = true;
exports.default = Iconify;
for (var key in Iconify) {
exports[key] = Iconify[key];
}
} catch (err) {
}
}
${defaultFooter}`;
// Get replacements
const replacements = {
preventAssignment: true,
@ -53,93 +23,57 @@ 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 = [];
names.forEach((name) => {
// Full and minified
[false, true].forEach((minify) => {
// Parse all formats
['js', 'cjs', 'mjs'].forEach((ext) => {
if (minify && ext !== 'js') {
// Minify only .js files
return;
}
// Get export format and footer
let format = ext;
let footer = defaultFooter;
switch (ext) {
case 'js':
format = 'iife';
footer = iifeFooter;
break;
// Full and minified
[false, true].forEach((minify) => {
// Parse all formats
['js', 'cjs', 'mjs'].forEach((ext) => {
if (minify && ext !== 'js') {
// Minify only .js files
return;
}
case 'mjs':
format = 'es';
break;
}
// Get export format
let format = ext;
let input = 'lib/index.js';
let exportType = 'named';
switch (ext) {
case 'js':
format = 'iife';
exportType = void 0;
input = 'lib/script.js';
break;
const item = {
input: `lib/${name}.js`,
output: [
{
file: `dist/${name}${minify ? '.min' : ''}.${ext}`,
format,
exports: 'named',
name: global,
banner: header,
footer,
},
],
plugins: [
resolve({
browser: true,
}),
replace(replacements),
],
};
case 'mjs':
format = 'es';
break;
}
if (ext === 'js') {
// Support old browsers only in .js files.
// Other files are for modern browsers that don't need it or
// for bundlers that should handle old browser support themselves.
item.plugins.push(
buble({
objectAssign: 'Object.assign',
})
);
}
const item = {
input,
output: [
{
file: `dist/iconify-icon${minify ? '.min' : ''}.${ext}`,
format,
exports: exportType,
banner: header,
},
],
plugins: [
resolve({
browser: true,
}),
replace(replacements),
],
};
if (minify) {
item.plugins.push(terser());
}
if (minify) {
item.plugins.push(terser());
}
config.push(item);
});
config.push(item);
});
});

View File

@ -332,8 +332,3 @@ export function defineIconifyIcon(
return IconifyIcon as IconifyIconHTMLElementClass;
}
/**
* Create exported data: either component instance or functions
*/
export const IconifyIconComponent = defineIconifyIcon() || exportFunctions();

View File

@ -41,8 +41,12 @@ import type {
} from '@iconify/core/lib/browser-storage/functions';
// Component
import type { IconifyIconAttributes } from './attributes/types';
import { IconifyIconComponent } from './component';
import type {
IconifyIconAttributes,
IconifyRenderMode,
} from './attributes/types';
import { defineIconifyIcon } from './component';
import { exportFunctions } from './functions';
/**
* Export used types
@ -88,12 +92,12 @@ export { IconifyIconBuildResult };
export { IconifyBrowserCacheType };
// Component types
export { IconifyIconAttributes };
export { IconifyIconAttributes, IconifyRenderMode };
/**
* Export component
* Create exported data: either component instance or functions
*/
export { IconifyIconComponent };
export const IconifyIconComponent = defineIconifyIcon() || exportFunctions();
/**
* Export functions

View File

@ -0,0 +1,4 @@
import { defineIconifyIcon } from './component';
// Register component
defineIconifyIcon();