create-rslib 0.7.1 → 0.9.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/dist/index.js +64 -5
- package/package.json +5 -5
- package/template-[node-dual]-[]-ts/package.json +1 -1
- package/template-[node-dual]-[vitest]-js/package.json +1 -1
- package/template-[node-dual]-[vitest]-ts/package.json +2 -2
- package/template-[node-esm]-[]-ts/package.json +1 -1
- package/template-[node-esm]-[vitest]-js/package.json +1 -1
- package/template-[node-esm]-[vitest]-ts/package.json +2 -2
- package/template-[react]-[]-ts/package.json +1 -1
- package/template-[react]-[storybook,vitest]-js/package.json +10 -10
- package/template-[react]-[storybook,vitest]-ts/package.json +11 -11
- package/template-[react]-[storybook]-js/package.json +9 -9
- package/template-[react]-[storybook]-ts/package.json +10 -10
- package/template-[react]-[vitest]-js/package.json +1 -1
- package/template-[react]-[vitest]-ts/package.json +2 -2
- package/template-[vue]-[]-js/package.json +27 -0
- package/template-[vue]-[]-js/rslib.config.ts +15 -0
- package/template-[vue]-[]-js/src/Button.vue +43 -0
- package/template-[vue]-[]-js/src/index.js +1 -0
- package/template-[vue]-[]-js/src/style.css +34 -0
- package/template-[vue]-[]-ts/package.json +29 -0
- package/template-[vue]-[]-ts/rslib.config.ts +15 -0
- package/template-[vue]-[]-ts/src/Button.vue +35 -0
- package/template-[vue]-[]-ts/src/index.ts +1 -0
- package/template-[vue]-[]-ts/src/style.css +34 -0
- package/template-[vue]-[]-ts/tsconfig.json +25 -0
- package/template-[vue]-[storybook,vitest]-js/.storybook/main.js +37 -0
- package/template-[vue]-[storybook,vitest]-js/.storybook/preview.js +12 -0
- package/template-[vue]-[storybook,vitest]-js/package.json +46 -0
- package/template-[vue]-[storybook,vitest]-js/rslib.config.ts +15 -0
- package/template-[vue]-[storybook,vitest]-js/src/Button.vue +43 -0
- package/template-[vue]-[storybook,vitest]-js/src/index.js +1 -0
- package/template-[vue]-[storybook,vitest]-js/src/style.css +34 -0
- package/template-[vue]-[storybook,vitest]-js/stories/Button.stories.js +50 -0
- package/template-[vue]-[storybook,vitest]-js/tests/index.test.js +16 -0
- package/template-[vue]-[storybook,vitest]-js/vitest.config.js +13 -0
- package/template-[vue]-[storybook,vitest]-js/vitest.setup.js +1 -0
- package/template-[vue]-[storybook,vitest]-ts/.storybook/main.ts +38 -0
- package/template-[vue]-[storybook,vitest]-ts/.storybook/preview.ts +12 -0
- package/template-[vue]-[storybook,vitest]-ts/package.json +48 -0
- package/template-[vue]-[storybook,vitest]-ts/rslib.config.ts +15 -0
- package/template-[vue]-[storybook,vitest]-ts/src/Button.vue +35 -0
- package/template-[vue]-[storybook,vitest]-ts/src/index.ts +1 -0
- package/template-[vue]-[storybook,vitest]-ts/src/style.css +34 -0
- package/template-[vue]-[storybook,vitest]-ts/stories/Button.stories.js +50 -0
- package/template-[vue]-[storybook,vitest]-ts/tests/index.test.ts +16 -0
- package/template-[vue]-[storybook,vitest]-ts/tsconfig.json +25 -0
- package/template-[vue]-[storybook,vitest]-ts/vitest.config.js +13 -0
- package/template-[vue]-[storybook,vitest]-ts/vitest.setup.js +1 -0
- package/template-[vue]-[storybook]-js/.storybook/main.js +37 -0
- package/template-[vue]-[storybook]-js/.storybook/preview.js +12 -0
- package/template-[vue]-[storybook]-js/package.json +40 -0
- package/template-[vue]-[storybook]-js/rslib.config.ts +15 -0
- package/template-[vue]-[storybook]-js/src/Button.vue +43 -0
- package/template-[vue]-[storybook]-js/src/index.js +1 -0
- package/template-[vue]-[storybook]-js/src/style.css +34 -0
- package/template-[vue]-[storybook]-js/stories/Button.stories.js +50 -0
- package/template-[vue]-[storybook]-ts/.storybook/main.ts +38 -0
- package/template-[vue]-[storybook]-ts/.storybook/preview.ts +12 -0
- package/template-[vue]-[storybook]-ts/package.json +42 -0
- package/template-[vue]-[storybook]-ts/rslib.config.ts +15 -0
- package/template-[vue]-[storybook]-ts/src/Button.vue +35 -0
- package/template-[vue]-[storybook]-ts/src/index.ts +1 -0
- package/template-[vue]-[storybook]-ts/src/style.css +34 -0
- package/template-[vue]-[storybook]-ts/stories/Button.stories.js +50 -0
- package/template-[vue]-[storybook]-ts/tsconfig.json +25 -0
- package/template-[vue]-[vitest]-js/package.json +33 -0
- package/template-[vue]-[vitest]-js/rslib.config.ts +15 -0
- package/template-[vue]-[vitest]-js/src/Button.vue +43 -0
- package/template-[vue]-[vitest]-js/src/index.js +1 -0
- package/template-[vue]-[vitest]-js/src/style.css +34 -0
- package/template-[vue]-[vitest]-js/tests/index.test.js +16 -0
- package/template-[vue]-[vitest]-js/vitest.config.js +13 -0
- package/template-[vue]-[vitest]-js/vitest.setup.js +1 -0
- package/template-[vue]-[vitest]-ts/package.json +35 -0
- package/template-[vue]-[vitest]-ts/rslib.config.ts +15 -0
- package/template-[vue]-[vitest]-ts/src/Button.vue +35 -0
- package/template-[vue]-[vitest]-ts/src/index.ts +1 -0
- package/template-[vue]-[vitest]-ts/src/style.css +34 -0
- package/template-[vue]-[vitest]-ts/tests/index.test.ts +16 -0
- package/template-[vue]-[vitest]-ts/tsconfig.json +25 -0
- package/template-[vue]-[vitest]-ts/vitest.config.js +13 -0
- package/template-[vue]-[vitest]-ts/vitest.setup.js +1 -0
package/dist/index.js
CHANGED
|
@@ -103,6 +103,58 @@ const TEMPLATES = [
|
|
|
103
103
|
storybook: 'storybook-react-ts',
|
|
104
104
|
vitest: 'vitest-react-ts'
|
|
105
105
|
}
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
template: 'vue',
|
|
109
|
+
lang: 'js'
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
template: 'vue',
|
|
113
|
+
lang: 'js',
|
|
114
|
+
tools: {
|
|
115
|
+
storybook: 'storybook-vue-js'
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
template: 'vue',
|
|
120
|
+
lang: 'js',
|
|
121
|
+
tools: {
|
|
122
|
+
vitest: 'vitest-vue-js'
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
template: 'vue',
|
|
127
|
+
lang: 'js',
|
|
128
|
+
tools: {
|
|
129
|
+
storybook: 'storybook-vue-js',
|
|
130
|
+
vitest: 'vitest-vue-js'
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
template: 'vue',
|
|
135
|
+
lang: 'ts'
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
template: 'vue',
|
|
139
|
+
lang: 'ts',
|
|
140
|
+
tools: {
|
|
141
|
+
storybook: 'storybook-vue-ts'
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
template: 'vue',
|
|
146
|
+
lang: 'ts',
|
|
147
|
+
tools: {
|
|
148
|
+
vitest: 'vitest-vue-ts'
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
template: 'vue',
|
|
153
|
+
lang: 'ts',
|
|
154
|
+
tools: {
|
|
155
|
+
storybook: 'storybook-vue-ts',
|
|
156
|
+
vitest: 'vitest-vue-ts'
|
|
157
|
+
}
|
|
106
158
|
}
|
|
107
159
|
];
|
|
108
160
|
const src_dirname = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].dirname((0, __WEBPACK_EXTERNAL_MODULE_node_url_e96de089__.fileURLToPath)(import.meta.url));
|
|
@@ -119,17 +171,21 @@ async function getTemplateName({ template }) {
|
|
|
119
171
|
const templateName = (0, __WEBPACK_EXTERNAL_MODULE_create_rstack_aeeb76b8__.checkCancel)(await (0, __WEBPACK_EXTERNAL_MODULE_create_rstack_aeeb76b8__.select)({
|
|
120
172
|
message: 'Select template',
|
|
121
173
|
options: [
|
|
122
|
-
{
|
|
123
|
-
value: 'node-dual',
|
|
124
|
-
label: 'Node.js dual ESM/CJS package'
|
|
125
|
-
},
|
|
126
174
|
{
|
|
127
175
|
value: 'node-esm',
|
|
128
176
|
label: 'Node.js pure ESM package'
|
|
129
177
|
},
|
|
178
|
+
{
|
|
179
|
+
value: 'node-dual',
|
|
180
|
+
label: 'Node.js dual ESM/CJS package'
|
|
181
|
+
},
|
|
130
182
|
{
|
|
131
183
|
value: 'react',
|
|
132
184
|
label: 'React'
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
value: 'vue',
|
|
188
|
+
label: 'Vue'
|
|
133
189
|
}
|
|
134
190
|
]
|
|
135
191
|
}));
|
|
@@ -146,7 +202,10 @@ async function getTemplateName({ template }) {
|
|
|
146
202
|
}
|
|
147
203
|
]
|
|
148
204
|
}));
|
|
149
|
-
const supportStorybook =
|
|
205
|
+
const supportStorybook = [
|
|
206
|
+
'react',
|
|
207
|
+
'vue'
|
|
208
|
+
].includes(templateName);
|
|
150
209
|
const tools = (0, __WEBPACK_EXTERNAL_MODULE_create_rstack_aeeb76b8__.checkCancel)(await (0, __WEBPACK_EXTERNAL_MODULE_create_rstack_aeeb76b8__.multiselect)({
|
|
151
210
|
message: 'Select development tools (Use <space> to select, <enter> to continue)',
|
|
152
211
|
required: false,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-rslib",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "Create a new Rslib project",
|
|
5
5
|
"homepage": "https://lib.rsbuild.dev",
|
|
6
6
|
"repository": {
|
|
@@ -22,14 +22,14 @@
|
|
|
22
22
|
"dist"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"create-rstack": "1.4.
|
|
25
|
+
"create-rstack": "1.4.5"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@types/fs-extra": "^11.0.4",
|
|
29
|
-
"@types/node": "^22.
|
|
29
|
+
"@types/node": "^22.15.21",
|
|
30
30
|
"fs-extra": "^11.3.0",
|
|
31
31
|
"rsbuild-plugin-publint": "^0.3.2",
|
|
32
|
-
"rslib": "npm:@rslib/core@0.
|
|
32
|
+
"rslib": "npm:@rslib/core@0.8.0",
|
|
33
33
|
"tsx": "^4.19.4",
|
|
34
34
|
"typescript": "^5.8.3",
|
|
35
35
|
"@rslib/tsconfig": "0.0.1"
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"registry": "https://registry.npmjs.org/"
|
|
44
44
|
},
|
|
45
45
|
"scripts": {
|
|
46
|
-
"build": "rslib build
|
|
46
|
+
"build": "rslib build",
|
|
47
47
|
"dev": "rslib build --watch",
|
|
48
48
|
"generate-templates": "pnpm tsx ./src/genTemplates.ts",
|
|
49
49
|
"start": "node ./dist/index.js",
|
|
@@ -18,24 +18,24 @@
|
|
|
18
18
|
"test": "vitest run"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@rsbuild/core": "^1.3.
|
|
21
|
+
"@rsbuild/core": "^1.3.21",
|
|
22
22
|
"@rsbuild/plugin-react": "^1.3.1",
|
|
23
23
|
"@rslib/core": "workspace:*",
|
|
24
|
-
"@storybook/addon-essentials": "^8.6.
|
|
25
|
-
"@storybook/addon-interactions": "^8.6.
|
|
26
|
-
"@storybook/addon-links": "^8.6.
|
|
27
|
-
"@storybook/addon-onboarding": "^8.6.
|
|
28
|
-
"@storybook/blocks": "^8.6.
|
|
29
|
-
"@storybook/react": "^8.6.
|
|
30
|
-
"@storybook/test": "^8.6.
|
|
24
|
+
"@storybook/addon-essentials": "^8.6.14",
|
|
25
|
+
"@storybook/addon-interactions": "^8.6.14",
|
|
26
|
+
"@storybook/addon-links": "^8.6.14",
|
|
27
|
+
"@storybook/addon-onboarding": "^8.6.14",
|
|
28
|
+
"@storybook/blocks": "^8.6.14",
|
|
29
|
+
"@storybook/react": "^8.6.14",
|
|
30
|
+
"@storybook/test": "^8.6.14",
|
|
31
31
|
"@testing-library/jest-dom": "^6.6.3",
|
|
32
32
|
"@testing-library/react": "^16.3.0",
|
|
33
33
|
"jsdom": "^26.1.0",
|
|
34
34
|
"react": "^19.1.0",
|
|
35
|
-
"storybook": "^8.6.
|
|
35
|
+
"storybook": "^8.6.14",
|
|
36
36
|
"storybook-addon-rslib": "^1.0.1",
|
|
37
37
|
"storybook-react-rsbuild": "^1.0.1",
|
|
38
|
-
"vitest": "^3.1.
|
|
38
|
+
"vitest": "^3.1.4"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"react": ">=16.9.0",
|
|
@@ -20,26 +20,26 @@
|
|
|
20
20
|
"test": "vitest run"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
|
-
"@rsbuild/core": "^1.3.
|
|
23
|
+
"@rsbuild/core": "^1.3.21",
|
|
24
24
|
"@rsbuild/plugin-react": "^1.3.1",
|
|
25
25
|
"@rslib/core": "workspace:*",
|
|
26
|
-
"@storybook/addon-essentials": "^8.6.
|
|
27
|
-
"@storybook/addon-interactions": "^8.6.
|
|
28
|
-
"@storybook/addon-links": "^8.6.
|
|
29
|
-
"@storybook/addon-onboarding": "^8.6.
|
|
30
|
-
"@storybook/blocks": "^8.6.
|
|
31
|
-
"@storybook/react": "^8.6.
|
|
32
|
-
"@storybook/test": "^8.6.
|
|
26
|
+
"@storybook/addon-essentials": "^8.6.14",
|
|
27
|
+
"@storybook/addon-interactions": "^8.6.14",
|
|
28
|
+
"@storybook/addon-links": "^8.6.14",
|
|
29
|
+
"@storybook/addon-onboarding": "^8.6.14",
|
|
30
|
+
"@storybook/blocks": "^8.6.14",
|
|
31
|
+
"@storybook/react": "^8.6.14",
|
|
32
|
+
"@storybook/test": "^8.6.14",
|
|
33
33
|
"@testing-library/jest-dom": "^6.6.3",
|
|
34
34
|
"@testing-library/react": "^16.3.0",
|
|
35
|
-
"@types/react": "^19.1.
|
|
35
|
+
"@types/react": "^19.1.5",
|
|
36
36
|
"jsdom": "^26.1.0",
|
|
37
37
|
"react": "^19.1.0",
|
|
38
|
-
"storybook": "^8.6.
|
|
38
|
+
"storybook": "^8.6.14",
|
|
39
39
|
"storybook-addon-rslib": "^1.0.1",
|
|
40
40
|
"storybook-react-rsbuild": "^1.0.1",
|
|
41
41
|
"typescript": "^5.8.3",
|
|
42
|
-
"vitest": "^3.1.
|
|
42
|
+
"vitest": "^3.1.4"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"react": ">=16.9.0",
|
|
@@ -17,18 +17,18 @@
|
|
|
17
17
|
"storybook": "storybook dev"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"@rsbuild/core": "^1.3.
|
|
20
|
+
"@rsbuild/core": "^1.3.21",
|
|
21
21
|
"@rsbuild/plugin-react": "^1.3.1",
|
|
22
22
|
"@rslib/core": "workspace:*",
|
|
23
|
-
"@storybook/addon-essentials": "^8.6.
|
|
24
|
-
"@storybook/addon-interactions": "^8.6.
|
|
25
|
-
"@storybook/addon-links": "^8.6.
|
|
26
|
-
"@storybook/addon-onboarding": "^8.6.
|
|
27
|
-
"@storybook/blocks": "^8.6.
|
|
28
|
-
"@storybook/react": "^8.6.
|
|
29
|
-
"@storybook/test": "^8.6.
|
|
23
|
+
"@storybook/addon-essentials": "^8.6.14",
|
|
24
|
+
"@storybook/addon-interactions": "^8.6.14",
|
|
25
|
+
"@storybook/addon-links": "^8.6.14",
|
|
26
|
+
"@storybook/addon-onboarding": "^8.6.14",
|
|
27
|
+
"@storybook/blocks": "^8.6.14",
|
|
28
|
+
"@storybook/react": "^8.6.14",
|
|
29
|
+
"@storybook/test": "^8.6.14",
|
|
30
30
|
"react": "^19.1.0",
|
|
31
|
-
"storybook": "^8.6.
|
|
31
|
+
"storybook": "^8.6.14",
|
|
32
32
|
"storybook-addon-rslib": "^1.0.1",
|
|
33
33
|
"storybook-react-rsbuild": "^1.0.1"
|
|
34
34
|
},
|
|
@@ -19,19 +19,19 @@
|
|
|
19
19
|
"storybook": "storybook dev"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@rsbuild/core": "^1.3.
|
|
22
|
+
"@rsbuild/core": "^1.3.21",
|
|
23
23
|
"@rsbuild/plugin-react": "^1.3.1",
|
|
24
24
|
"@rslib/core": "workspace:*",
|
|
25
|
-
"@storybook/addon-essentials": "^8.6.
|
|
26
|
-
"@storybook/addon-interactions": "^8.6.
|
|
27
|
-
"@storybook/addon-links": "^8.6.
|
|
28
|
-
"@storybook/addon-onboarding": "^8.6.
|
|
29
|
-
"@storybook/blocks": "^8.6.
|
|
30
|
-
"@storybook/react": "^8.6.
|
|
31
|
-
"@storybook/test": "^8.6.
|
|
32
|
-
"@types/react": "^19.1.
|
|
25
|
+
"@storybook/addon-essentials": "^8.6.14",
|
|
26
|
+
"@storybook/addon-interactions": "^8.6.14",
|
|
27
|
+
"@storybook/addon-links": "^8.6.14",
|
|
28
|
+
"@storybook/addon-onboarding": "^8.6.14",
|
|
29
|
+
"@storybook/blocks": "^8.6.14",
|
|
30
|
+
"@storybook/react": "^8.6.14",
|
|
31
|
+
"@storybook/test": "^8.6.14",
|
|
32
|
+
"@types/react": "^19.1.5",
|
|
33
33
|
"react": "^19.1.0",
|
|
34
|
-
"storybook": "^8.6.
|
|
34
|
+
"storybook": "^8.6.14",
|
|
35
35
|
"storybook-addon-rslib": "^1.0.1",
|
|
36
36
|
"storybook-react-rsbuild": "^1.0.1",
|
|
37
37
|
"typescript": "^5.8.3"
|
|
@@ -22,11 +22,11 @@
|
|
|
22
22
|
"@rslib/core": "workspace:*",
|
|
23
23
|
"@testing-library/jest-dom": "^6.6.3",
|
|
24
24
|
"@testing-library/react": "^16.3.0",
|
|
25
|
-
"@types/react": "^19.1.
|
|
25
|
+
"@types/react": "^19.1.5",
|
|
26
26
|
"jsdom": "^26.1.0",
|
|
27
27
|
"react": "^19.1.0",
|
|
28
28
|
"typescript": "^5.8.3",
|
|
29
|
-
"vitest": "^3.1.
|
|
29
|
+
"vitest": "^3.1.4"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"react": ">=16.9.0",
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "rslib-vue-js",
|
|
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
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"files": [
|
|
13
|
+
"dist"
|
|
14
|
+
],
|
|
15
|
+
"scripts": {
|
|
16
|
+
"build": "rslib build",
|
|
17
|
+
"dev": "rslib build --watch"
|
|
18
|
+
},
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"@rslib/core": "workspace:*",
|
|
21
|
+
"rsbuild-plugin-unplugin-vue": "^0.1.0",
|
|
22
|
+
"vue": "^3.2.0"
|
|
23
|
+
},
|
|
24
|
+
"peerDependencies": {
|
|
25
|
+
"vue": "^3.2.0"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { defineConfig } from '@rslib/core';
|
|
2
|
+
import { pluginUnpluginVue } from 'rsbuild-plugin-unplugin-vue';
|
|
3
|
+
|
|
4
|
+
export default defineConfig({
|
|
5
|
+
lib: [
|
|
6
|
+
{
|
|
7
|
+
bundle: false,
|
|
8
|
+
format: 'esm',
|
|
9
|
+
},
|
|
10
|
+
],
|
|
11
|
+
output: {
|
|
12
|
+
target: 'web',
|
|
13
|
+
},
|
|
14
|
+
plugins: [pluginUnpluginVue()],
|
|
15
|
+
});
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed } from 'vue';
|
|
3
|
+
import './style.css';
|
|
4
|
+
|
|
5
|
+
const {
|
|
6
|
+
primary = false,
|
|
7
|
+
backgroundColor,
|
|
8
|
+
size = 'medium',
|
|
9
|
+
label,
|
|
10
|
+
onClick,
|
|
11
|
+
} = defineProps({
|
|
12
|
+
primary: {
|
|
13
|
+
type: Boolean,
|
|
14
|
+
},
|
|
15
|
+
backgroundColor: {
|
|
16
|
+
type: String,
|
|
17
|
+
},
|
|
18
|
+
size: {
|
|
19
|
+
type: String,
|
|
20
|
+
},
|
|
21
|
+
label: {
|
|
22
|
+
type: String,
|
|
23
|
+
},
|
|
24
|
+
onClick: {
|
|
25
|
+
type: Function,
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const mode = computed(() =>
|
|
30
|
+
primary ? 'demo-button--primary' : 'demo-button--secondary',
|
|
31
|
+
);
|
|
32
|
+
</script>
|
|
33
|
+
|
|
34
|
+
<template>
|
|
35
|
+
<button
|
|
36
|
+
type="button"
|
|
37
|
+
:class="['demo-button', `demo-button--${size}`, mode]"
|
|
38
|
+
:style="{ backgroundColor }"
|
|
39
|
+
@click="onClick"
|
|
40
|
+
>
|
|
41
|
+
{{ label }}
|
|
42
|
+
</button>
|
|
43
|
+
</template>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Button } from './Button.vue';
|
|
@@ -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,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "rslib-vue-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
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"files": [
|
|
13
|
+
"dist"
|
|
14
|
+
],
|
|
15
|
+
"scripts": {
|
|
16
|
+
"build": "rslib build && vue-tsc",
|
|
17
|
+
"dev": "rslib build --watch"
|
|
18
|
+
},
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"@rslib/core": "workspace:*",
|
|
21
|
+
"rsbuild-plugin-unplugin-vue": "^0.1.0",
|
|
22
|
+
"typescript": "^5.8.3",
|
|
23
|
+
"vue": "^3.2.0",
|
|
24
|
+
"vue-tsc": "^2.2.10"
|
|
25
|
+
},
|
|
26
|
+
"peerDependencies": {
|
|
27
|
+
"vue": "^3.2.0"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { defineConfig } from '@rslib/core';
|
|
2
|
+
import { pluginUnpluginVue } from 'rsbuild-plugin-unplugin-vue';
|
|
3
|
+
|
|
4
|
+
export default defineConfig({
|
|
5
|
+
lib: [
|
|
6
|
+
{
|
|
7
|
+
bundle: false,
|
|
8
|
+
format: 'esm',
|
|
9
|
+
},
|
|
10
|
+
],
|
|
11
|
+
output: {
|
|
12
|
+
target: 'web',
|
|
13
|
+
},
|
|
14
|
+
plugins: [pluginUnpluginVue()],
|
|
15
|
+
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed } from 'vue';
|
|
3
|
+
import './style.css';
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
primary?: boolean;
|
|
7
|
+
backgroundColor?: string;
|
|
8
|
+
size?: 'small' | 'medium' | 'large';
|
|
9
|
+
label: string;
|
|
10
|
+
onClick?: () => void;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const {
|
|
14
|
+
primary = false,
|
|
15
|
+
backgroundColor = undefined,
|
|
16
|
+
size = 'medium',
|
|
17
|
+
label,
|
|
18
|
+
onClick = undefined,
|
|
19
|
+
} = defineProps<Props>();
|
|
20
|
+
|
|
21
|
+
const mode = computed(() =>
|
|
22
|
+
primary ? 'demo-button--primary' : 'demo-button--secondary',
|
|
23
|
+
);
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
<template>
|
|
27
|
+
<button
|
|
28
|
+
type="button"
|
|
29
|
+
:class="['demo-button', `demo-button--${size}`, mode]"
|
|
30
|
+
:style="{ backgroundColor }"
|
|
31
|
+
@click="onClick"
|
|
32
|
+
>
|
|
33
|
+
{{ label }}
|
|
34
|
+
</button>
|
|
35
|
+
</template>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Button } from './Button.vue';
|
|
@@ -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,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"lib": ["DOM", "ES2020"],
|
|
4
|
+
"jsx": "preserve",
|
|
5
|
+
"target": "ES2020",
|
|
6
|
+
"skipLibCheck": true,
|
|
7
|
+
"jsxImportSource": "vue",
|
|
8
|
+
"useDefineForClassFields": true,
|
|
9
|
+
"declaration": true,
|
|
10
|
+
"outDir": "dist",
|
|
11
|
+
"emitDeclarationOnly": true,
|
|
12
|
+
|
|
13
|
+
/* modules */
|
|
14
|
+
"module": "ESNext",
|
|
15
|
+
"isolatedModules": true,
|
|
16
|
+
"resolveJsonModule": true,
|
|
17
|
+
"moduleResolution": "bundler",
|
|
18
|
+
|
|
19
|
+
/* type checking */
|
|
20
|
+
"strict": true,
|
|
21
|
+
"noUnusedLocals": true,
|
|
22
|
+
"noUnusedParameters": true
|
|
23
|
+
},
|
|
24
|
+
"include": ["src"]
|
|
25
|
+
}
|