Skip to content

Commit 62c5502

Browse files
committed
trim bundle size even more
1 parent 0d43874 commit 62c5502

File tree

5 files changed

+53
-35
lines changed

5 files changed

+53
-35
lines changed

packages/dev/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"serve": "serve public"
1010
},
1111
"dependencies": {
12-
"@patternfly/quickstarts": "1.0.0-rc.19",
12+
"@patternfly/quickstarts": "1.0.0-rc.20",
1313
"@patternfly/react-core": "^4.101.3",
1414
"asciidoctor": "^2.2.1",
1515
"react": "^16.14.0",

packages/module/package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@patternfly/quickstarts",
3-
"version": "1.0.0-rc.19",
3+
"version": "1.0.0-rc.20",
44
"description": "PatternFly quick starts",
55
"files": [
66
"dist"
@@ -37,6 +37,7 @@
3737
"@patternfly/patternfly": ">=4.90.5",
3838
"@patternfly/react-catalog-view-extension": ">=4.10.13",
3939
"@patternfly/react-core": ">=4.101.3",
40+
"@patternfly/react-icons": ">=4.9.5",
4041
"react": ">=16.8.0",
4142
"react-dom": ">=16.8.0",
4243
"showdown": ">=1.8.6"
@@ -45,11 +46,11 @@
4546
"@patternfly/patternfly": "^4.90.5",
4647
"@patternfly/react-catalog-view-extension": "^4.10.13",
4748
"@patternfly/react-core": "^4.101.3",
49+
"@patternfly/react-icons": "^4.9.5",
4850
"bootstrap-sass": "^3.3.7",
4951
"classnames": "^2.2.6",
5052
"dompurify": "^2.2.6",
5153
"history": "^5.0.0",
52-
"lodash-es": "^4.17.20",
5354
"showdown": "1.8.6"
5455
},
5556
"devDependencies": {
@@ -88,7 +89,7 @@
8889
"rollup-plugin-peer-deps-external": "^2.2.4",
8990
"rollup-plugin-scss": "^2.6.1",
9091
"rollup-plugin-typescript2": "^0.29.0",
91-
"rollup-plugin-visualizer": "^4.2.0",
92+
"rollup-plugin-visualizer": "^5.5.0",
9293
"tslib": "^2.0.3",
9394
"typescript": "^4.3.2"
9495
}

packages/module/rollup.config.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1+
import analyze from "rollup-plugin-analyzer";
12
import commonjs from '@rollup/plugin-commonjs';
2-
import resolve from '@rollup/plugin-node-resolve';
3+
import json from '@rollup/plugin-json';
34
import peerDepsExternal from 'rollup-plugin-peer-deps-external';
4-
import typescript from 'rollup-plugin-typescript2';
5+
import resolve from '@rollup/plugin-node-resolve';
56
import scss from './rollup-plugin-scss';
6-
import json from '@rollup/plugin-json';
7+
import typescript from 'rollup-plugin-typescript2';
78
import visualizer from 'rollup-plugin-visualizer';
8-
import analyze from "rollup-plugin-analyzer";
99

1010
import packageJson from './package.json';
1111

1212
const plugins = (esBundle) => {
1313
return [
1414
scss({
15-
output: esBundle ? false : 'dist/quickstarts.css',
15+
output: 'dist/quickstarts.css',
1616
includePaths: ['../../node_modules/'],
1717
importer(path) {
1818
return { file: path[0] !== '~' ? path : path.slice(1) };
@@ -35,21 +35,21 @@ const plugins = (esBundle) => {
3535
}),
3636
json(),
3737
analyze({ summaryOnly: true, limit: 5 }),
38-
visualizer(),
38+
visualizer({ template: 'treemap' }), // sunburst, treemap, network
3939
];
4040
};
4141

4242
export default [
43-
{
44-
input: 'src/index.ts',
45-
output: {
46-
file: packageJson.main,
47-
format: 'cjs',
48-
sourcemap: true,
49-
},
50-
external: ['react', 'react-dom'],
51-
plugins: plugins(false),
52-
},
43+
// {
44+
// input: 'src/index.ts',
45+
// output: {
46+
// file: packageJson.main,
47+
// format: 'cjs',
48+
// sourcemap: true,
49+
// },
50+
// external: ['react', 'react-dom'],
51+
// plugins: plugins(false),
52+
// },
5353
{
5454
input: 'src/index.ts',
5555
output: {

packages/module/src/ConsoleInternal/components/markdown-view.tsx

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import * as React from 'react';
22
import { Converter } from 'showdown';
33
import { QuickStartContext, QuickStartContextValues } from '../../utils/quick-start-context';
4-
import _truncate from 'lodash-es/truncate.js';
5-
import _uniqueId from 'lodash-es/uniqueId.js';
4+
// import _truncate from 'lodash-es/truncate.js';
5+
// import _uniqueId from 'lodash-es/uniqueId.js';
66
import cx from 'classnames';
77

88
import './_markdown-view.scss';
@@ -72,7 +72,7 @@ type SyncMarkdownProps = {
7272
content?: string;
7373
emptyMsg?: string;
7474
exactHeight?: boolean;
75-
truncateContent?: boolean;
75+
/*truncateContent?: boolean;*/
7676
extensions?: ShowdownExtension[];
7777
renderExtension?: (contentDocument: HTMLDocument, rootSelector: string) => React.ReactNode;
7878
inline?: boolean;
@@ -86,7 +86,7 @@ type InnerSyncMarkdownProps = Pick<SyncMarkdownProps, 'renderExtension' | 'exact
8686
};
8787

8888
export const SyncMarkdownView: React.FC<SyncMarkdownProps> = ({
89-
truncateContent,
89+
// truncateContent,
9090
content,
9191
emptyMsg,
9292
extensions,
@@ -97,32 +97,44 @@ export const SyncMarkdownView: React.FC<SyncMarkdownProps> = ({
9797
}) => {
9898
const { getResource } = React.useContext<QuickStartContextValues>(QuickStartContext);
9999
const markup = React.useMemo(() => {
100-
const truncatedContent = truncateContent
100+
const truncatedContent = /*truncateContent
101101
? _truncate(content, {
102102
length: 256,
103103
separator: ' ',
104104
omission: '\u2026',
105105
})
106-
: content;
107-
return markdownConvert(truncatedContent || emptyMsg || getResource('Not available'), extensions);
108-
}, [content, emptyMsg, extensions, getResource, truncateContent]);
106+
: */ content;
107+
return markdownConvert(
108+
truncatedContent || emptyMsg || getResource('Not available'),
109+
extensions,
110+
);
111+
}, [content, emptyMsg, extensions, getResource /*, truncateContent*/]);
109112
const innerProps: InnerSyncMarkdownProps = {
110113
renderExtension: extensions?.length > 0 ? renderExtension : undefined,
111114
exactHeight,
112115
markup,
113116
isEmpty: !content,
114-
className
117+
className,
115118
};
116119
return inline ? <InlineMarkdownView {...innerProps} /> : <IFrameMarkdownView {...innerProps} />;
117120
};
118121

122+
const uniqueId = (function () {
123+
let num = 0;
124+
return function (prefix) {
125+
prefix = String(prefix) || '';
126+
num += 1;
127+
return prefix + num;
128+
};
129+
})();
130+
119131
const InlineMarkdownView: React.FC<InnerSyncMarkdownProps> = ({
120132
markup,
121133
isEmpty,
122134
renderExtension,
123135
className,
124136
}) => {
125-
const id = React.useMemo(() => _uniqueId('markdown'), []);
137+
const id = React.useMemo(() => uniqueId('markdown'), []);
126138
return (
127139
<div className={cx('co-markdown-view', { ['is-empty']: isEmpty }, className)} id={id}>
128140
<div dangerouslySetInnerHTML={{ __html: markup }} />
@@ -176,7 +188,7 @@ const IFrameMarkdownView: React.FC<InnerSyncMarkdownProps> = ({
176188

177189
// Find the app's stylesheets and inject them into the frame to ensure consistent styling.
178190
const filteredLinks = Array.from(document.getElementsByTagName('link')).filter((l) =>
179-
l.href.includes('app-bundle')
191+
l.href.includes('app-bundle'),
180192
);
181193

182194
const linkRefs = filteredLinks.reduce(

yarn.lock

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,11 @@
194194
resolved "https://registry.yarnpkg.com/@patternfly/react-icons/-/react-icons-4.10.7.tgz#fe2eabf88512afe7dab0c0e7c71142ec6e594664"
195195
integrity sha512-CiHYDOS8jrxNiy/KIxv9vPqg3cie4SzsbQKh+eW8lj41x68IrgILiw3VvjcJeVXXJDRW36T7u3IPKjMI6zuoyA==
196196

197+
"@patternfly/react-icons@^4.9.5":
198+
version "4.11.0"
199+
resolved "https://registry.yarnpkg.com/@patternfly/react-icons/-/react-icons-4.11.0.tgz#26790eeff22dc3204aa8cd094470f0a2f915634a"
200+
integrity sha512-WsIX34bO9rhVRmPG0jlV3GoFGfYgPC64TscNV0lxQosiVRnYIA6Z3nBSArtJsxo5Yn6c63glIefC/YTy6D/ZYg==
201+
197202
"@patternfly/react-styles@^4.10.7", "@patternfly/react-styles@^4.7.22":
198203
version "4.10.7"
199204
resolved "https://registry.yarnpkg.com/@patternfly/react-styles/-/react-styles-4.10.7.tgz#3b0ce38f3e12a69cdcbaf1ada163a5b114b919bd"
@@ -10028,10 +10033,10 @@ rollup-plugin-typescript2@^0.29.0:
1002810033
resolve "1.17.0"
1002910034
tslib "2.0.1"
1003010035

10031-
rollup-plugin-visualizer@^4.2.0:
10032-
version "4.2.2"
10033-
resolved "https://registry.yarnpkg.com/rollup-plugin-visualizer/-/rollup-plugin-visualizer-4.2.2.tgz#edeb8b3fc6f49b3c95f6cc668f4eba57c6112099"
10034-
integrity sha512-10/TsugsaQL5rdynl0lrklBngTtkRBESZdxUJy+3fN+xKqNdg5cr7JQU1OoPx4p5mhQ+nspa6EvX3qc8SsBvnA==
10036+
rollup-plugin-visualizer@^5.5.0:
10037+
version "5.5.0"
10038+
resolved "https://registry.yarnpkg.com/rollup-plugin-visualizer/-/rollup-plugin-visualizer-5.5.0.tgz#dbe9daa3a46576fb697eb62b19ed251112b85d1e"
10039+
integrity sha512-QUd0ZHGYn6rgogS+yzG08AvMk9J4kR1lO1cpLJCIAQhbyIGSBdqCddKWtxDsdmsxhkY/GCGw8CvoSB3MwMQOIQ==
1003510040
dependencies:
1003610041
nanoid "^3.1.22"
1003710042
open "^7.4.2"

0 commit comments

Comments
 (0)