Skip to content

Commit df0c9a5

Browse files
committed
Fixing dist missing styles.css
1 parent ec93808 commit df0c9a5

File tree

4 files changed

+71
-10
lines changed

4 files changed

+71
-10
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"README.md"
1414
],
1515
"scripts": {
16-
"build": "rollup -c",
16+
"build": "rollup -c && cp src/styles/Compare.css dist/styles.css",
1717
"dev": "rollup -c -w",
1818
"test": "jest",
1919
"test:watch": "jest --watch",

rollup.config.mjs

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,15 @@ export default [
3131
],
3232
plugins: [
3333
peerDepsExternal(),
34-
resolve(),
34+
resolve({
35+
preferBuiltins: false,
36+
extensions: ['.js', '.jsx', '.ts', '.tsx', '.css'],
37+
}),
3538
commonjs(),
36-
postcss(),
39+
postcss({
40+
extract: 'styles.css',
41+
minimize: true,
42+
}),
3743
typescript({ tsconfig: './tsconfig.json', declaration: false }),
3844
babel({
3945
babelHelpers: 'bundled',
@@ -49,6 +55,16 @@ export default [
4955
{
5056
input: 'src/index.ts',
5157
output: [{ file: 'dist/index.d.ts', format: 'es' }],
52-
plugins: [dts()],
58+
plugins: [
59+
postcss({
60+
extract: false,
61+
inject: false,
62+
}),
63+
dts(),
64+
],
65+
external: [
66+
...Object.keys(pkg.peerDependencies || {}),
67+
...Object.keys(pkg.dependencies || {}),
68+
],
5369
},
5470
];

src/stories/Compare.stories.tsx

Lines changed: 47 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,38 +10,77 @@ export default {
1010
title: 'Examples/All',
1111
};
1212

13-
export const SimpleParagraph = (args) => <SimpleParagraphExample {...args} />;
13+
interface SimpleParagraphArgs {
14+
original: string;
15+
modified: string;
16+
title: string;
17+
description?: string;
18+
}
19+
20+
export const SimpleParagraph = (args: SimpleParagraphArgs) => <SimpleParagraphExample {...args} />;
1421
SimpleParagraph.args = {
1522
original: "I am Captain Kirk, Captain of the USS Enterprise.",
1623
modified: "I am Captain Picard, Captain of the USS Enterprise.",
1724
title: "Example 1: Kirk vs Picard",
1825
description: 'Only "Kirk" and "Picard" should be highlighted',
1926
};
2027

21-
export const ComplexParagraph = (args) => <ComplexParagraphExample {...args} />;
28+
interface ComplexParagraphArgs {
29+
original: string;
30+
modified: string;
31+
title: string;
32+
description?: string;
33+
}
34+
35+
export const ComplexParagraph = (args: ComplexParagraphArgs) => <ComplexParagraphExample {...args} />;
2236
ComplexParagraph.args = {
2337
original: "I am Captain Kirk, Captain of the USS Enterprise.",
2438
modified: "I am Commander Benjamin Sisko, Commander of Deep Space 9.",
2539
title: "Example 2: Kirk vs Sisko",
2640
description: "Multiple changes highlighted",
2741
};
2842

29-
export const Array = (args) => <ArrayExample {...args} />;
43+
interface ExampleArgs {
44+
original: string;
45+
modified: string;
46+
title: string;
47+
description?: string;
48+
}
49+
50+
interface ArrayExampleArgs {
51+
original: string[];
52+
modified: string[];
53+
title: string;
54+
description?: string;
55+
}
56+
57+
interface CaseInsensitiveArgs extends ArrayExampleArgs {
58+
caseSensitive: boolean;
59+
}
60+
61+
export const Array = (args: ArrayExampleArgs) => <ArrayExample {...args} />;
3062
Array.args = {
3163
original: ['USS Enterprise', 'USS Voyager', 'USS Defiant'],
3264
modified: ['USS Discovery', 'USS Voyager', 'USS Cerritos'],
3365
title: "Example 3: Starship Array Comparison",
3466
};
3567

36-
export const Disordered = (args) => <DisorderedArray {...args} />;
68+
interface DisorderedArrayArgs {
69+
original: string[];
70+
modified: string[];
71+
title: string;
72+
description?: string;
73+
}
74+
75+
export const Disordered = (args: DisorderedArrayArgs) => <DisorderedArray {...args} />;
3776
Disordered.args = {
3877
original: ['Vulcan', 'Earth', 'Romulus'],
3978
modified: ['Earth', 'Romulus', 'Vulcan'],
4079
title: "Example 4: Disordered Array",
4180
description: "Order matters in this comparison",
4281
};
4382

44-
export const CaseInsensitive = (args) => <CaseInsensitiveExample {...args} />;
83+
export const CaseInsensitive = (args: CaseInsensitiveArgs) => <CaseInsensitiveExample {...args} />;
4584
CaseInsensitive.args = {
4685
original: ['Vulcan', 'Earth', 'Romulus'],
4786
modified: ['romulus', 'vulcan', 'earth'],
@@ -50,7 +89,9 @@ CaseInsensitive.args = {
5089
caseSensitive: false,
5190
};
5291

53-
export const OrderInsensitive = (args) => <OrderInsensitiveExample {...args} />;
92+
interface OrderInsensitiveArgs extends CaseInsensitiveArgs {}
93+
94+
export const OrderInsensitive = (args: OrderInsensitiveArgs) => <OrderInsensitiveExample {...args} />;
5495
OrderInsensitive.args = {
5596
original: ['Vulcan', 'Earth', 'Romulus'],
5697
modified: ['romulus', 'vulcan', 'earth'],

src/types/css.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
declare module '*.css' {
2+
const content: Record<string, string>;
3+
export default content;
4+
}

0 commit comments

Comments
 (0)