@stack-dev/react-styled-components 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +81 -0
- package/dist/index.d.cts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +13 -0
- package/dist/index.mjs +13 -0
- package/eslint.config.mjs +10 -0
- package/package.json +51 -0
- package/prettier.config.mjs +3 -0
- package/src/button.spec.tsx +27 -0
- package/src/button.tsx +21 -0
- package/src/index.ts +1 -0
- package/tsconfig.json +7 -0
- package/tsup.config.ts +16 -0
- package/vitest.config.ts +15 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
> @stack-dev/react-styled-components@0.1.0 build /home/benmclean/projects/stack-dev/packages/react-styled-components
|
|
4
|
+
> tsup
|
|
5
|
+
|
|
6
|
+
[33mâ² [43;33m[[43;30mWARNING[43;33m][0m [1mThe condition "types" here will never be used as it comes after both "import" and "require"[0m [package.json]
|
|
7
|
+
|
|
8
|
+
package.json:13:6:
|
|
9
|
+
[37m 13 â [32m"types"[37m: "./dist/index.d.ts"
|
|
10
|
+
âµ [32m~~~~~~~[0m
|
|
11
|
+
|
|
12
|
+
The "import" condition comes earlier and will be used for all "import" statements:
|
|
13
|
+
|
|
14
|
+
package.json:11:6:
|
|
15
|
+
[37m 11 â [32m"import"[37m: "./dist/index.mjs",
|
|
16
|
+
âµ [32m~~~~~~~~[0m
|
|
17
|
+
|
|
18
|
+
The "require" condition comes earlier and will be used for all "require" calls:
|
|
19
|
+
|
|
20
|
+
package.json:12:6:
|
|
21
|
+
[37m 12 â [32m"require"[37m: "./dist/index.js",
|
|
22
|
+
âµ [32m~~~~~~~~~[0m
|
|
23
|
+
|
|
24
|
+
[34mCLI[39m Building entry: src/index.ts
|
|
25
|
+
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
26
|
+
[34mCLI[39m tsup v8.5.1
|
|
27
|
+
[34mCLI[39m Using tsup config: /home/benmclean/projects/stack-dev/packages/react-styled-components/tsup.config.ts
|
|
28
|
+
[34mCLI[39m Target: esnext
|
|
29
|
+
[34mCLI[39m Cleaning output folder
|
|
30
|
+
[34mCJS[39m Build start
|
|
31
|
+
[34mESM[39m Build start
|
|
32
|
+
|
|
33
|
+
[43m[30m WARN [39m[49m [33mâ² [43;33m[[43;30mWARNING[43;33m][0m [1mThe condition "types" here will never be used as it comes after both "import" and "require"[0m [package.json] [90m10:12:34 p.m.[39m
|
|
34
|
+
|
|
35
|
+
package.json:13:6:
|
|
36
|
+
[37m 13 â [32m"types"[37m: "./dist/index.d.ts"
|
|
37
|
+
âµ [32m~~~~~~~[0m
|
|
38
|
+
|
|
39
|
+
The "import" condition comes earlier and will be used for all "import" statements:
|
|
40
|
+
|
|
41
|
+
package.json:11:6:
|
|
42
|
+
[37m 11 â [32m"import"[37m: "./dist/index.mjs",
|
|
43
|
+
âµ [32m~~~~~~~~[0m
|
|
44
|
+
|
|
45
|
+
The "require" condition comes earlier and will be used for all "require" calls:
|
|
46
|
+
|
|
47
|
+
package.json:12:6:
|
|
48
|
+
[37m 12 â [32m"require"[37m: "./dist/index.js",
|
|
49
|
+
âµ [32m~~~~~~~~~[0m
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
[43m[30m WARN [39m[49m [33mâ² [43;33m[[43;30mWARNING[43;33m][0m [1mThe condition "types" here will never be used as it comes after both "import" and "require"[0m [package.json] [90m10:12:34 p.m.[39m
|
|
55
|
+
|
|
56
|
+
package.json:13:6:
|
|
57
|
+
[37m 13 â [32m"types"[37m: "./dist/index.d.ts"
|
|
58
|
+
âµ [32m~~~~~~~[0m
|
|
59
|
+
|
|
60
|
+
The "import" condition comes earlier and will be used for all "import" statements:
|
|
61
|
+
|
|
62
|
+
package.json:11:6:
|
|
63
|
+
[37m 11 â [32m"import"[37m: "./dist/index.mjs",
|
|
64
|
+
âµ [32m~~~~~~~~[0m
|
|
65
|
+
|
|
66
|
+
The "require" condition comes earlier and will be used for all "require" calls:
|
|
67
|
+
|
|
68
|
+
package.json:12:6:
|
|
69
|
+
[37m 12 â [32m"require"[37m: "./dist/index.js",
|
|
70
|
+
âµ [32m~~~~~~~~~[0m
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
[32mCJS[39m [1mdist/index.js [22m[32m973.00 B[39m
|
|
75
|
+
[32mCJS[39m âĦï¸ Build success in 43ms
|
|
76
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m336.00 B[39m
|
|
77
|
+
[32mESM[39m âĦï¸ Build success in 44ms
|
|
78
|
+
DTS Build start
|
|
79
|
+
DTS âĦï¸ Build success in 2014ms
|
|
80
|
+
DTS dist/index.d.cts 215.00 B
|
|
81
|
+
DTS dist/index.d.ts 215.00 B
|
package/dist/index.d.cts
ADDED
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";var i=Object.create;var e=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var l=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty;var m=(o,t)=>{for(var r in t)e(o,r,{get:t[r],enumerable:!0})},p=(o,t,r,u)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of f(t))!s.call(o,n)&&n!==r&&e(o,n,{get:()=>t[n],enumerable:!(u=c(t,n))||u.enumerable});return o};var x=(o,t,r)=>(r=o!=null?i(l(o)):{},p(t||!o||!o.__esModule?e(r,"default",{value:o,enumerable:!0}):r,o)),a=o=>p(e({},"__esModule",{value:!0}),o);var H={};m(H,{Button:()=>B});module.exports=a(H);var b=x(require("styled-components"),1),d=require("react/jsx-runtime"),g=b.default.button`
|
|
2
|
+
background-color: #007bff;
|
|
3
|
+
color: white;
|
|
4
|
+
padding: 10px 20px;
|
|
5
|
+
border: none;
|
|
6
|
+
border-radius: 4px;
|
|
7
|
+
cursor: pointer;
|
|
8
|
+
font-size: 16px;
|
|
9
|
+
|
|
10
|
+
&:hover {
|
|
11
|
+
background-color: #0056b3;
|
|
12
|
+
}
|
|
13
|
+
`;function B(o){return(0,d.jsx)(g,{...o})}0&&(module.exports={Button});
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import t from"styled-components";import{jsx as n}from"react/jsx-runtime";var r=t.button`
|
|
2
|
+
background-color: #007bff;
|
|
3
|
+
color: white;
|
|
4
|
+
padding: 10px 20px;
|
|
5
|
+
border: none;
|
|
6
|
+
border-radius: 4px;
|
|
7
|
+
cursor: pointer;
|
|
8
|
+
font-size: 16px;
|
|
9
|
+
|
|
10
|
+
&:hover {
|
|
11
|
+
background-color: #0056b3;
|
|
12
|
+
}
|
|
13
|
+
`;function u(o){return n(r,{...o})}export{u as Button};
|
package/package.json
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@stack-dev/react-styled-components",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/index.mjs",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"development": "./src/index.ts",
|
|
11
|
+
"import": "./dist/index.mjs",
|
|
12
|
+
"require": "./dist/index.js",
|
|
13
|
+
"types": "./dist/index.d.ts"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"peerDependencies": {
|
|
17
|
+
"react": ">=18",
|
|
18
|
+
"react-dom": ">=18",
|
|
19
|
+
"styled-components": ">=6"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@testing-library/jest-dom": "^6.0.0",
|
|
23
|
+
"@testing-library/react": "^16.0.0",
|
|
24
|
+
"@types/react": "^18.3.1",
|
|
25
|
+
"@types/react-dom": "^18.3.1",
|
|
26
|
+
"@types/styled-components": "^5.1.34",
|
|
27
|
+
"@vitest/coverage-v8": "^3.2.4",
|
|
28
|
+
"eslint": "^9.32.0",
|
|
29
|
+
"jsdom": "^25.0.0",
|
|
30
|
+
"prettier": "^3.6.2",
|
|
31
|
+
"prettier-plugin-organize-imports": "^4.2.0",
|
|
32
|
+
"react": "^18.3.1",
|
|
33
|
+
"react-dom": "^18.3.1",
|
|
34
|
+
"styled-components": "^6.1.13",
|
|
35
|
+
"tsup": "^8.0.0",
|
|
36
|
+
"vitest": "^3.2.4",
|
|
37
|
+
"@stack-dev/eslint-config": "0.1.0",
|
|
38
|
+
"@stack-dev/prettier-config": "0.1.0",
|
|
39
|
+
"@stack-dev/typescript-config": "0.1.0"
|
|
40
|
+
},
|
|
41
|
+
"type": "module",
|
|
42
|
+
"sideEffects": false,
|
|
43
|
+
"scripts": {
|
|
44
|
+
"build": "tsup",
|
|
45
|
+
"dev": "tsup --watch",
|
|
46
|
+
"lint": "eslint .",
|
|
47
|
+
"format": "prettier . --write",
|
|
48
|
+
"test": "vitest run",
|
|
49
|
+
"test:watch": "vitest"
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { render, screen } from '@testing-library/react';
|
|
2
|
+
import { Button } from './button';
|
|
3
|
+
|
|
4
|
+
import { describe, expect, it } from 'vitest';
|
|
5
|
+
|
|
6
|
+
describe('Button', () => {
|
|
7
|
+
it('renders the label correctly', () => {
|
|
8
|
+
render(<Button>Click Me</Button>);
|
|
9
|
+
expect(screen.getByText('Click Me')).toBeDefined();
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it('is a button element', () => {
|
|
13
|
+
render(<Button>Submit</Button>);
|
|
14
|
+
const buttonElement = screen.getByRole('button');
|
|
15
|
+
expect(buttonElement.tagName).toBe('BUTTON');
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
/* Note: Testing for specific CSS classes with CSS Modules is tricky
|
|
19
|
+
because class names are mangled (e.g., _styledButton_123).
|
|
20
|
+
Usually, we just test that the class attribute exists.
|
|
21
|
+
*/
|
|
22
|
+
it('applies a class name', () => {
|
|
23
|
+
render(<Button>Styled</Button>);
|
|
24
|
+
const buttonElement = screen.getByRole('button');
|
|
25
|
+
expect(buttonElement.className).toBeTruthy();
|
|
26
|
+
});
|
|
27
|
+
});
|
package/src/button.tsx
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { HTMLAttributes } from 'react';
|
|
2
|
+
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
|
|
5
|
+
const StyledButton = styled.button`
|
|
6
|
+
background-color: #007bff;
|
|
7
|
+
color: white;
|
|
8
|
+
padding: 10px 20px;
|
|
9
|
+
border: none;
|
|
10
|
+
border-radius: 4px;
|
|
11
|
+
cursor: pointer;
|
|
12
|
+
font-size: 16px;
|
|
13
|
+
|
|
14
|
+
&:hover {
|
|
15
|
+
background-color: #0056b3;
|
|
16
|
+
}
|
|
17
|
+
`;
|
|
18
|
+
|
|
19
|
+
export function Button(props: HTMLAttributes<HTMLButtonElement>) {
|
|
20
|
+
return <StyledButton {...props} />;
|
|
21
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './button';
|
package/tsconfig.json
ADDED
package/tsup.config.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { defineConfig } from 'tsup';
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
entry: ['src/index.ts'],
|
|
5
|
+
format: ['cjs', 'esm'],
|
|
6
|
+
dts: true,
|
|
7
|
+
minify: true,
|
|
8
|
+
clean: true,
|
|
9
|
+
splitting: false,
|
|
10
|
+
external: ['react', 'react-dom', 'styled-components'],
|
|
11
|
+
outExtension({ format }) {
|
|
12
|
+
return {
|
|
13
|
+
js: format === 'esm' ? '.mjs' : '.js',
|
|
14
|
+
};
|
|
15
|
+
},
|
|
16
|
+
});
|
package/vitest.config.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { defineConfig } from 'vitest/config';
|
|
2
|
+
import react from '@vitejs/plugin-react';
|
|
3
|
+
|
|
4
|
+
export default defineConfig({
|
|
5
|
+
plugins: [react()],
|
|
6
|
+
test: {
|
|
7
|
+
globals: true,
|
|
8
|
+
environment: 'jsdom',
|
|
9
|
+
coverage: {
|
|
10
|
+
provider: 'v8',
|
|
11
|
+
reporter: ['text', 'json', 'html'],
|
|
12
|
+
},
|
|
13
|
+
css: true,
|
|
14
|
+
},
|
|
15
|
+
});
|