create-rslib 0.0.14 → 0.0.16

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.
Files changed (111) hide show
  1. package/dist/index.js +141 -9
  2. package/package.json +10 -7
  3. package/template-[node-dual]-[]-js/src/index.js +1 -0
  4. package/{template-node-dual-ts → template-[node-dual]-[]-ts}/package.json +1 -0
  5. package/template-[node-dual]-[]-ts/rslib.config.ts +16 -0
  6. package/template-[node-dual]-[]-ts/src/index.ts +1 -0
  7. package/{template-node-dual-ts → template-[node-dual]-[]-ts}/tsconfig.json +1 -2
  8. package/template-[node-dual]-[vitest]-js/package.json +25 -0
  9. package/{template-node-dual-ts/rslib.config.ts → template-[node-dual]-[vitest]-js/rslib.config.mjs} +0 -1
  10. package/template-[node-dual]-[vitest]-js/src/index.js +1 -0
  11. package/template-[node-dual]-[vitest]-js/tests/index.test.js +7 -0
  12. package/template-[node-dual]-[vitest]-js/vitest.config.js +8 -0
  13. package/template-[node-dual]-[vitest]-ts/package.json +29 -0
  14. package/template-[node-dual]-[vitest]-ts/rslib.config.ts +16 -0
  15. package/template-[node-dual]-[vitest]-ts/src/index.ts +1 -0
  16. package/template-[node-dual]-[vitest]-ts/tests/index.test.ts +7 -0
  17. package/{template-node-esm-ts → template-[node-dual]-[vitest]-ts}/tsconfig.json +1 -2
  18. package/template-[node-dual]-[vitest]-ts/vitest.config.ts +6 -0
  19. package/template-[node-esm]-[]-js/src/index.js +1 -0
  20. package/{template-node-esm-ts → template-[node-esm]-[]-ts}/package.json +1 -0
  21. package/template-[node-esm]-[]-ts/rslib.config.ts +12 -0
  22. package/template-[node-esm]-[]-ts/src/index.ts +1 -0
  23. package/template-[node-esm]-[]-ts/tsconfig.json +15 -0
  24. package/template-[node-esm]-[vitest]-js/package.json +23 -0
  25. package/{template-node-esm-ts/rslib.config.ts → template-[node-esm]-[vitest]-js/rslib.config.mjs} +0 -1
  26. package/template-[node-esm]-[vitest]-js/src/index.js +1 -0
  27. package/template-[node-esm]-[vitest]-js/tests/index.test.js +7 -0
  28. package/template-[node-esm]-[vitest]-js/vitest.config.js +8 -0
  29. package/template-[node-esm]-[vitest]-ts/package.json +27 -0
  30. package/template-[node-esm]-[vitest]-ts/rslib.config.ts +12 -0
  31. package/template-[node-esm]-[vitest]-ts/src/index.ts +1 -0
  32. package/template-[node-esm]-[vitest]-ts/tests/index.test.ts +7 -0
  33. package/template-[node-esm]-[vitest]-ts/tsconfig.json +15 -0
  34. package/template-[node-esm]-[vitest]-ts/vitest.config.ts +6 -0
  35. package/template-[react]-[]-js/package.json +27 -0
  36. package/template-[react]-[]-js/rslib.config.mjs +23 -0
  37. package/template-[react]-[]-js/src/Button.jsx +22 -0
  38. package/template-[react]-[]-js/src/button.css +34 -0
  39. package/template-[react]-[]-js/src/index.jsx +1 -0
  40. package/template-[react]-[]-ts/package.json +31 -0
  41. package/template-[react]-[]-ts/rslib.config.ts +24 -0
  42. package/template-[react]-[]-ts/src/Button.tsx +30 -0
  43. package/template-[react]-[]-ts/src/button.css +34 -0
  44. package/template-[react]-[]-ts/src/index.tsx +1 -0
  45. package/template-[react]-[]-ts/tsconfig.json +14 -0
  46. package/template-[react]-[storybook,vitest]-js/.storybook/main.js +36 -0
  47. package/template-[react]-[storybook,vitest]-js/.storybook/preview.js +12 -0
  48. package/template-[react]-[storybook,vitest]-js/package.json +45 -0
  49. package/template-[react]-[storybook,vitest]-js/rslib.config.mjs +23 -0
  50. package/template-[react]-[storybook,vitest]-js/src/Button.jsx +22 -0
  51. package/template-[react]-[storybook,vitest]-js/src/button.css +34 -0
  52. package/template-[react]-[storybook,vitest]-js/src/index.jsx +1 -0
  53. package/template-[react]-[storybook,vitest]-js/stories/Button.stories.jsx +50 -0
  54. package/template-[react]-[storybook,vitest]-js/tests/index.test.jsx +12 -0
  55. package/template-[react]-[storybook,vitest]-js/vitest.config.js +11 -0
  56. package/template-[react]-[storybook,vitest]-js/vitest.setup.js +1 -0
  57. package/template-[react]-[storybook,vitest]-ts/.storybook/main.ts +37 -0
  58. package/template-[react]-[storybook,vitest]-ts/.storybook/preview.ts +14 -0
  59. package/template-[react]-[storybook,vitest]-ts/package.json +49 -0
  60. package/template-[react]-[storybook,vitest]-ts/rslib.config.ts +24 -0
  61. package/template-[react]-[storybook,vitest]-ts/src/Button.tsx +30 -0
  62. package/template-[react]-[storybook,vitest]-ts/src/button.css +34 -0
  63. package/template-[react]-[storybook,vitest]-ts/src/index.tsx +1 -0
  64. package/template-[react]-[storybook,vitest]-ts/stories/Button.stories.ts +52 -0
  65. package/template-[react]-[storybook,vitest]-ts/tests/index.test.tsx +12 -0
  66. package/template-[react]-[storybook,vitest]-ts/tsconfig.json +14 -0
  67. package/template-[react]-[storybook,vitest]-ts/vitest.config.ts +9 -0
  68. package/template-[react]-[storybook,vitest]-ts/vitest.setup.ts +1 -0
  69. package/template-[react]-[storybook]-js/.storybook/main.js +36 -0
  70. package/template-[react]-[storybook]-js/.storybook/preview.js +12 -0
  71. package/template-[react]-[storybook]-js/package.json +40 -0
  72. package/template-[react]-[storybook]-js/rslib.config.mjs +23 -0
  73. package/template-[react]-[storybook]-js/src/Button.jsx +22 -0
  74. package/template-[react]-[storybook]-js/src/button.css +34 -0
  75. package/template-[react]-[storybook]-js/src/index.jsx +1 -0
  76. package/template-[react]-[storybook]-js/stories/Button.stories.jsx +50 -0
  77. package/template-[react]-[storybook]-ts/.storybook/main.ts +37 -0
  78. package/template-[react]-[storybook]-ts/.storybook/preview.ts +14 -0
  79. package/template-[react]-[storybook]-ts/package.json +44 -0
  80. package/template-[react]-[storybook]-ts/rslib.config.ts +24 -0
  81. package/template-[react]-[storybook]-ts/src/Button.tsx +30 -0
  82. package/template-[react]-[storybook]-ts/src/button.css +34 -0
  83. package/template-[react]-[storybook]-ts/src/index.tsx +1 -0
  84. package/template-[react]-[storybook]-ts/stories/Button.stories.ts +52 -0
  85. package/template-[react]-[storybook]-ts/tsconfig.json +14 -0
  86. package/template-[react]-[vitest]-js/package.json +32 -0
  87. package/template-[react]-[vitest]-js/rslib.config.mjs +23 -0
  88. package/template-[react]-[vitest]-js/src/Button.jsx +22 -0
  89. package/template-[react]-[vitest]-js/src/button.css +34 -0
  90. package/template-[react]-[vitest]-js/src/index.jsx +1 -0
  91. package/template-[react]-[vitest]-js/tests/index.test.jsx +12 -0
  92. package/template-[react]-[vitest]-js/vitest.config.js +11 -0
  93. package/template-[react]-[vitest]-js/vitest.setup.js +1 -0
  94. package/template-[react]-[vitest]-ts/package.json +36 -0
  95. package/template-[react]-[vitest]-ts/rslib.config.ts +24 -0
  96. package/template-[react]-[vitest]-ts/src/Button.tsx +30 -0
  97. package/template-[react]-[vitest]-ts/src/button.css +34 -0
  98. package/template-[react]-[vitest]-ts/src/index.tsx +1 -0
  99. package/template-[react]-[vitest]-ts/tests/index.test.tsx +12 -0
  100. package/template-[react]-[vitest]-ts/tsconfig.json +14 -0
  101. package/template-[react]-[vitest]-ts/vitest.config.ts +9 -0
  102. package/template-[react]-[vitest]-ts/vitest.setup.ts +1 -0
  103. package/template-common/README.md +1 -1
  104. package/template-node-dual-js/src/index.js +0 -3
  105. package/template-node-dual-ts/src/index.ts +0 -3
  106. package/template-node-esm-js/src/index.js +0 -3
  107. package/template-node-esm-ts/src/index.ts +0 -3
  108. /package/{template-node-dual-js → template-[node-dual]-[]-js}/package.json +0 -0
  109. /package/{template-node-dual-js → template-[node-dual]-[]-js}/rslib.config.mjs +0 -0
  110. /package/{template-node-esm-js → template-[node-esm]-[]-js}/package.json +0 -0
  111. /package/{template-node-esm-js → template-[node-esm]-[]-js}/rslib.config.mjs +0 -0
@@ -0,0 +1,34 @@
1
+ .demo-button {
2
+ font-weight: 700;
3
+ border: 0;
4
+ border-radius: 3em;
5
+ cursor: pointer;
6
+ display: inline-block;
7
+ line-height: 1;
8
+ }
9
+
10
+ .demo-button--primary {
11
+ color: white;
12
+ background-color: #1ea7fd;
13
+ }
14
+
15
+ .demo-button--secondary {
16
+ color: #333;
17
+ background-color: transparent;
18
+ box-shadow: rgba(0, 0, 0, 0.15) 0px 0px 0px 1px inset;
19
+ }
20
+
21
+ .demo-button--small {
22
+ font-size: 12px;
23
+ padding: 10px 16px;
24
+ }
25
+
26
+ .demo-button--medium {
27
+ font-size: 14px;
28
+ padding: 11px 20px;
29
+ }
30
+
31
+ .demo-button--large {
32
+ font-size: 16px;
33
+ padding: 12px 24px;
34
+ }
@@ -0,0 +1 @@
1
+ export { Button } from './Button';
@@ -0,0 +1,12 @@
1
+ import { render, screen } from '@testing-library/react';
2
+ import React from 'react';
3
+ import { expect, test } from 'vitest';
4
+ import { Button } from '../src/Button';
5
+
6
+ test('The button should have correct background color', async () => {
7
+ render(<Button backgroundColor="#ccc" label="Demo Button" />);
8
+ const button = screen.getByText('Demo Button');
9
+ expect(button).toHaveStyle({
10
+ backgroundColor: '#ccc',
11
+ });
12
+ });
@@ -0,0 +1,11 @@
1
+ /// <reference types="vitest/config" />
2
+
3
+ import { defineConfig } from 'vitest/config';
4
+
5
+ export default defineConfig({
6
+ // Configure Vitest (https://vitest.dev/config/)
7
+ test: {
8
+ environment: 'jsdom',
9
+ setupFiles: './vitest.setup.js',
10
+ },
11
+ });
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom/vitest';
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "rslib-react-ts",
3
+ "version": "0.0.0",
4
+ "type": "module",
5
+ "exports": {
6
+ ".": {
7
+ "types": "./dist/index.d.ts",
8
+ "import": "./dist/index.js"
9
+ }
10
+ },
11
+ "module": "./dist/index.js",
12
+ "types": "./dist/index.d.ts",
13
+ "files": [
14
+ "dist"
15
+ ],
16
+ "scripts": {
17
+ "build": "rslib build",
18
+ "dev": "rslib build --watch",
19
+ "test": "vitest run"
20
+ },
21
+ "devDependencies": {
22
+ "@rsbuild/plugin-react": "^1.0.6",
23
+ "@rslib/core": "workspace:*",
24
+ "@testing-library/jest-dom": "^6.6.3",
25
+ "@testing-library/react": "^16.0.1",
26
+ "@types/react": "^18.3.12",
27
+ "jsdom": "^25.0.1",
28
+ "react": "^18.3.1",
29
+ "typescript": "^5.6.3",
30
+ "vitest": "^2.1.4"
31
+ },
32
+ "peerDependencies": {
33
+ "react": ">=16.9.0",
34
+ "react-dom": ">=16.9.0"
35
+ }
36
+ }
@@ -0,0 +1,24 @@
1
+ import { pluginReact } from '@rsbuild/plugin-react';
2
+ import { defineConfig } from '@rslib/core';
3
+
4
+ export default defineConfig({
5
+ source: {
6
+ entry: {
7
+ index: ['./src/**'],
8
+ },
9
+ },
10
+ lib: [
11
+ {
12
+ bundle: false,
13
+ dts: true,
14
+ format: 'esm',
15
+ },
16
+ ],
17
+ plugins: [
18
+ pluginReact({
19
+ swcReactOptions: {
20
+ runtime: 'classic',
21
+ },
22
+ }),
23
+ ],
24
+ });
@@ -0,0 +1,30 @@
1
+ import React from 'react';
2
+ import './button.css';
3
+
4
+ interface ButtonProps {
5
+ primary?: boolean;
6
+ backgroundColor?: string;
7
+ size?: 'small' | 'medium' | 'large';
8
+ label: string;
9
+ onClick?: () => void;
10
+ }
11
+
12
+ export const Button = ({
13
+ primary = false,
14
+ size = 'medium',
15
+ backgroundColor,
16
+ label,
17
+ ...props
18
+ }: ButtonProps) => {
19
+ const mode = primary ? 'demo-button--primary' : 'demo-button--secondary';
20
+ return (
21
+ <button
22
+ type="button"
23
+ className={['demo-button', `demo-button--${size}`, mode].join(' ')}
24
+ style={{ backgroundColor }}
25
+ {...props}
26
+ >
27
+ {label}
28
+ </button>
29
+ );
30
+ };
@@ -0,0 +1,34 @@
1
+ .demo-button {
2
+ font-weight: 700;
3
+ border: 0;
4
+ border-radius: 3em;
5
+ cursor: pointer;
6
+ display: inline-block;
7
+ line-height: 1;
8
+ }
9
+
10
+ .demo-button--primary {
11
+ color: white;
12
+ background-color: #1ea7fd;
13
+ }
14
+
15
+ .demo-button--secondary {
16
+ color: #333;
17
+ background-color: transparent;
18
+ box-shadow: rgba(0, 0, 0, 0.15) 0px 0px 0px 1px inset;
19
+ }
20
+
21
+ .demo-button--small {
22
+ font-size: 12px;
23
+ padding: 10px 16px;
24
+ }
25
+
26
+ .demo-button--medium {
27
+ font-size: 14px;
28
+ padding: 11px 20px;
29
+ }
30
+
31
+ .demo-button--large {
32
+ font-size: 16px;
33
+ padding: 12px 24px;
34
+ }
@@ -0,0 +1 @@
1
+ export { Button } from './Button';
@@ -0,0 +1,12 @@
1
+ import { render, screen } from '@testing-library/react';
2
+ import React from 'react';
3
+ import { expect, test } from 'vitest';
4
+ import { Button } from '../src/Button';
5
+
6
+ test('The button should have correct background color', async () => {
7
+ render(<Button backgroundColor="#ccc" label="Demo Button" />);
8
+ const button = screen.getByText('Demo Button');
9
+ expect(button).toHaveStyle({
10
+ backgroundColor: '#ccc',
11
+ });
12
+ });
@@ -0,0 +1,14 @@
1
+ {
2
+ "compilerOptions": {
3
+ "lib": ["DOM", "ES2021"],
4
+ "module": "ESNext",
5
+ "jsx": "react",
6
+ "strict": true,
7
+ "skipLibCheck": true,
8
+ "isolatedModules": true,
9
+ "resolveJsonModule": true,
10
+ "moduleResolution": "bundler",
11
+ "useDefineForClassFields": true
12
+ },
13
+ "include": ["src"]
14
+ }
@@ -0,0 +1,9 @@
1
+ import { defineConfig } from 'vitest/config';
2
+
3
+ export default defineConfig({
4
+ // Configure Vitest (https://vitest.dev/config/)
5
+ test: {
6
+ environment: 'jsdom',
7
+ setupFiles: './vitest.setup.ts',
8
+ },
9
+ });
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom/vitest';
@@ -19,5 +19,5 @@ pnpm build
19
19
  Build the library in watch mode:
20
20
 
21
21
  ```bash
22
- pnpm build --watch
22
+ pnpm dev
23
23
  ```
@@ -1,3 +0,0 @@
1
- export function example() {
2
- return 'hello world';
3
- }
@@ -1,3 +0,0 @@
1
- export function example(): string {
2
- return 'hello world';
3
- }
@@ -1,3 +0,0 @@
1
- export function example() {
2
- return 'hello world';
3
- }
@@ -1,3 +0,0 @@
1
- export function example(): string {
2
- return 'hello world';
3
- }