2
0
mirror of https://github.com/iconify/iconify.git synced 2025-01-26 00:28:28 +00:00

Update exports for SVG framework and React component, update build process for React component

This commit is contained in:
Vjacheslav Trushkin 2021-09-25 13:08:47 +03:00
parent bd18d8874e
commit cb8b5333be
7 changed files with 50 additions and 15 deletions

View File

@ -9,8 +9,8 @@
".": {
"require": "../dist/iconify.without-api.cjs",
"import": "../dist/iconify.without-api.mjs",
"default": "../dist/iconify.without-api.min.js",
"types": "../dist/iconify.without-api.d.ts"
"types": "../dist/iconify.without-api.d.ts",
"default": "../dist/iconify.without-api.min.js"
}
}
}

View File

@ -34,8 +34,8 @@
".": {
"require": "./dist/iconify.cjs",
"import": "./dist/iconify.mjs",
"default": "./dist/iconify.min.js",
"types": "./dist/iconify.d.ts"
"types": "./dist/iconify.d.ts",
"default": "./dist/iconify.min.js"
},
"./dist/iconify": {
"require": "./dist/iconify.cjs",
@ -46,26 +46,26 @@
"./dist/iconify.min": {
"require": "./dist/iconify.cjs",
"import": "./dist/iconify.mjs",
"default": "./dist/iconify.min.js",
"types": "./dist/iconify.d.ts"
"types": "./dist/iconify.d.ts",
"default": "./dist/iconify.min.js"
},
"./dist/iconify.without-api": {
"require": "./dist/iconify.without-api.cjs",
"import": "./dist/iconify.without-api.mjs",
"default": "./dist/iconify.without-api.min.js",
"types": "./dist/iconify.without-api.d.ts"
"types": "./dist/iconify.without-api.d.ts",
"default": "./dist/iconify.without-api.min.js"
},
"./dist/iconify.without-api.min": {
"require": "./dist/iconify.without-api.cjs",
"import": "./dist/iconify.without-api.mjs",
"default": "./dist/iconify.without-api.min.js",
"types": "./dist/iconify.without-api.d.ts"
"types": "./dist/iconify.without-api.d.ts",
"default": "./dist/iconify.without-api.min.js"
},
"./offline": {
"require": "./dist/iconify.without-api.cjs",
"import": "./dist/iconify.without-api.mjs",
"default": "./dist/iconify.without-api.min.js",
"types": "./dist/iconify.without-api.d.ts"
"types": "./dist/iconify.without-api.d.ts",
"default": "./dist/iconify.without-api.min.js"
}
},
"dependencies": {

View File

@ -0,0 +1,14 @@
{
"name": "@iconify/react/offline",
"main": "../dist/offline.js",
"types": "../dist/offline.d.ts",
"module": "../dist/offline.mjs",
"exports": {
"./*": "./*",
".": {
"import": "../dist/offline.mjs",
"types": "../dist/offline.d.ts",
"default": "../dist/offline.js"
}
}
}

View File

@ -0,0 +1,5 @@
# @iconify/react/offline
This sub-directory contains `package.json` with entry points for importing `@iconify/react/offline`.
There is a duplicate entry in `exports` section of `package.json` in the parent directory, but at moment of coding this, TypeScript does not support conditional exports properly, so this directory is used as a duplicate to make everything work with TypeScript.

View File

@ -22,6 +22,7 @@
"jest": "^26.6.3",
"react": "^17.0.2",
"react-test-renderer": "^17.0.2",
"rimraf": "^3.0.2",
"rollup": "^2.50.0",
"typescript": "^4.2.4"
},

View File

@ -13,17 +13,31 @@
"directory": "packages/react"
},
"scripts": {
"clean": "rimraf lib dist tsconfig.tsbuildinfo",
"prebuild": "npm run clean",
"build": "node build",
"build:lib": "tsc -b",
"build:dist": "rollup -c rollup.config.js",
"prebuild:api": "api-extractor run --local --verbose --config api-extractor.offline.json",
"build:api": "api-extractor run --local --verbose --config api-extractor.iconify.json",
"pretest": "npm run build",
"test": "jest"
},
"main": "dist/iconify.js",
"module": "dist/iconify.esm.js",
"module": "dist/iconify.mjs",
"types": "dist/iconify.d.ts",
"exports": {
"./*": "./*",
".": {
"import": "./dist/iconify.mjs",
"types": "./dist/iconify.d.ts",
"default": "./dist/iconify.js"
},
"./offline": {
"import": "./dist/offline.mjs",
"types": "./dist/offline.d.ts",
"default": "./dist/offline.js"
}
},
"devDependencies": {
"@babel/preset-env": "^7.14.2",
"@babel/preset-react": "^7.13.13",
@ -35,6 +49,7 @@
"jest": "^26.6.3",
"react": "^17.0.2",
"react-test-renderer": "^17.0.2",
"rimraf": "^3.0.2",
"rollup": "^2.50.0",
"typescript": "^4.2.4"
},

View File

@ -11,7 +11,7 @@ names.forEach((name) => {
input: `lib/${name}.js`,
output: [
{
file: `dist/${name}.esm.js`,
file: `dist/${name}.mjs`,
format: 'esm',
},
],