Skip to content

Commit fcb9ab5

Browse files
authored
Merge pull request #277 from rvsia/transformIcons
Use tranform pluging to transform PF4 icons
2 parents d0870b9 + 59ad11f commit fcb9ab5

File tree

7 files changed

+72
-17
lines changed

7 files changed

+72
-17
lines changed

babel.config.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
1+
const createIconsTransformPlugin = [
2+
'transform-imports',
3+
{
4+
'@patternfly/react-icons': {
5+
transform: (importName) =>
6+
`@patternfly/react-icons/dist/js/icons/${importName.split(/(?=[A-Z])/).join('-').toLowerCase()}`,
7+
preventFullImport: true,
8+
},
9+
},
10+
];
11+
12+
113
module.exports = {
214
"presets": ["@babel/preset-env", "@babel/preset-react"],
3-
"plugins": ["@babel/plugin-syntax-dynamic-import", "lodash", "@babel/plugin-proposal-class-properties" ]
15+
"plugins": ["@babel/plugin-syntax-dynamic-import", "lodash", "@babel/plugin-proposal-class-properties", createIconsTransformPlugin ]
416
}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
"@semantic-release/github": "^5.5.5",
4242
"@semantic-release/npm": "^5.1.4",
4343
"atob-lite": "^2.0.0",
44+
"babel-plugin-transform-imports": "^2.0.0",
4445
"identity-obj-proxy": "^3.0.0",
4546
"jest": "^24.8.0",
4647
"lerna": "^3.13.1",

packages/react-renderer-demo/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"@mdx-js/react": "^1.4.5",
3232
"@next/mdx": "^9.1.2",
3333
"@patternfly/patternfly-next": "^1.0.175",
34-
"@patternfly/react-core": "~3.16.10",
34+
"@patternfly/react-core": "~3.129.3",
3535
"@patternfly/react-tokens": "^2.5.1",
3636
"brace": "^0.11.1",
3737
"clsx": "^1.0.4",

packages/react-renderer-demo/src/app/.babelrc

Lines changed: 0 additions & 14 deletions
This file was deleted.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
const createIconsTransformPlugin = [
2+
'transform-imports',
3+
{
4+
'@patternfly/react-icons': {
5+
transform: (importName) =>
6+
`@patternfly/react-icons/dist/js/icons/${importName.split(/(?=[A-Z])/).join('-').toLowerCase()}`,
7+
preventFullImport: true,
8+
},
9+
},
10+
];
11+
12+
module.exports = {
13+
presets: [
14+
[
15+
'next/babel',
16+
{
17+
'transform-runtime': {
18+
useESModules: false,
19+
},
20+
},
21+
],
22+
],
23+
plugins: [ createIconsTransformPlugin ],
24+
};

packages/react-renderer-demo/src/app/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,9 @@
5858
"@mdx-js/react": "^1.4.5",
5959
"@next/mdx": "^9.0.5",
6060
"@patternfly/patternfly-next": "^1.0.175",
61-
"@patternfly/react-core": "~3.16.10",
61+
"@patternfly/react-core": "~3.129.3",
6262
"@patternfly/react-tokens": "^2.5.1",
63+
"babel-plugin-transform-imports": "^2.0.0",
6364
"brace": "^0.11.1",
6465
"clsx": "^1.0.4",
6566
"docsearch.js": "^2.6.3",

yarn.lock

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -870,6 +870,15 @@
870870
lodash "^4.17.13"
871871
to-fast-properties "^2.0.0"
872872

873+
"@babel/types@^7.4":
874+
version "7.7.4"
875+
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.7.4.tgz#516570d539e44ddf308c07569c258ff94fde9193"
876+
integrity sha512-cz5Ji23KCi4T+YIE/BolWosrJuSmoZeN1EFnRtBwF+KKLi8GG/Z2c2hOJJeCXPk4mwk4QFvTmwIodJowXgttRA==
877+
dependencies:
878+
esutils "^2.0.2"
879+
lodash "^4.17.13"
880+
to-fast-properties "^2.0.0"
881+
873882
"@cnakazawa/watch@^1.0.3":
874883
version "1.0.3"
875884
resolved "https://registry.yarnpkg.com/@cnakazawa/watch/-/watch-1.0.3.tgz#099139eaec7ebf07a27c1786a3ff64f39464d2ef"
@@ -4184,6 +4193,14 @@ babel-plugin-transform-flow-strip-types@^6.8.0:
41844193
babel-plugin-syntax-flow "^6.18.0"
41854194
babel-runtime "^6.22.0"
41864195

4196+
babel-plugin-transform-imports@^2.0.0:
4197+
version "2.0.0"
4198+
resolved "https://registry.yarnpkg.com/babel-plugin-transform-imports/-/babel-plugin-transform-imports-2.0.0.tgz#9e5f49f751a9d34ba8f4bb988c7e48ed2419c6b6"
4199+
integrity sha512-65ewumYJ85QiXdcB/jmiU0y0jg6eL6CdnDqQAqQ8JMOKh1E52VPG3NJzbVKWcgovUR5GBH8IWpCXQ7I8Q3wjgw==
4200+
dependencies:
4201+
"@babel/types" "^7.4"
4202+
is-valid-path "^0.1.1"
4203+
41874204
babel-plugin-transform-object-rest-spread@^6.8.0:
41884205
version "6.26.0"
41894206
resolved "https://registry.yarnpkg.com/babel-plugin-transform-object-rest-spread/-/babel-plugin-transform-object-rest-spread-6.26.0.tgz#0f36692d50fef6b7e2d4b3ac1478137a963b7b06"
@@ -9677,6 +9694,13 @@ is-installed-globally@^0.1.0:
96779694
global-dirs "^0.1.0"
96789695
is-path-inside "^1.0.0"
96799696

9697+
is-invalid-path@^0.1.0:
9698+
version "0.1.0"
9699+
resolved "https://registry.yarnpkg.com/is-invalid-path/-/is-invalid-path-0.1.0.tgz#307a855b3cf1a938b44ea70d2c61106053714f34"
9700+
integrity sha1-MHqFWzzxqTi0TqcNLGEQYFNxTzQ=
9701+
dependencies:
9702+
is-glob "^2.0.0"
9703+
96809704
is-module@^1.0.0:
96819705
version "1.0.0"
96829706
resolved "https://registry.yarnpkg.com/is-module/-/is-module-1.0.0.tgz#3258fb69f78c14d5b815d664336b4cffb6441591"
@@ -9861,6 +9885,13 @@ is-utf8@^0.2.0, is-utf8@^0.2.1:
98619885
version "0.2.1"
98629886
resolved "https://registry.yarnpkg.com/is-utf8/-/is-utf8-0.2.1.tgz#4b0da1442104d1b336340e80797e865cf39f7d72"
98639887

9888+
is-valid-path@^0.1.1:
9889+
version "0.1.1"
9890+
resolved "https://registry.yarnpkg.com/is-valid-path/-/is-valid-path-0.1.1.tgz#110f9ff74c37f663e1ec7915eb451f2db93ac9df"
9891+
integrity sha1-EQ+f90w39mPh7HkV60UfLbk6yd8=
9892+
dependencies:
9893+
is-invalid-path "^0.1.0"
9894+
98649895
is-whitespace-character@^1.0.0:
98659896
version "1.0.3"
98669897
resolved "https://registry.yarnpkg.com/is-whitespace-character/-/is-whitespace-character-1.0.3.tgz#b3ad9546d916d7d3ffa78204bca0c26b56257fac"

0 commit comments

Comments
 (0)