create-rstack 2.1.2 → 3.0.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/LICENSE +1 -1
- package/README.md +43 -73
- package/bin.js +2 -0
- package/dist/index.js +202 -3588
- package/package.json +26 -46
- package/template-app-lit-js/package.json +23 -0
- package/template-app-lit-js/rstack.config.js +28 -0
- package/template-app-lit-js/src/index.css +6 -0
- package/template-app-lit-js/src/index.html +7 -0
- package/template-app-lit-js/src/index.js +4 -0
- package/template-app-lit-js/src/my-element.js +34 -0
- package/template-app-lit-js/tests/index.test.js +12 -0
- package/template-app-lit-ts/package.json +25 -0
- package/template-app-lit-ts/rstack.config.ts +27 -0
- package/template-app-lit-ts/src/index.css +6 -0
- package/template-app-lit-ts/src/index.html +7 -0
- package/template-app-lit-ts/src/index.ts +4 -0
- package/template-app-lit-ts/src/my-element.ts +34 -0
- package/template-app-lit-ts/tests/index.test.ts +12 -0
- package/template-app-lit-ts/tsconfig.json +23 -0
- package/template-app-preact-js/package.json +26 -0
- package/template-app-preact-js/rstack.config.js +29 -0
- package/template-app-preact-js/src/App.css +26 -0
- package/template-app-preact-js/src/App.jsx +12 -0
- package/template-app-preact-js/src/index.jsx +4 -0
- package/template-app-preact-js/tests/index.test.jsx +8 -0
- package/template-app-preact-js/tests/rstest.setup.js +4 -0
- package/template-app-preact-ts/package.json +28 -0
- package/template-app-preact-ts/rstack.config.ts +29 -0
- package/template-app-preact-ts/src/App.css +26 -0
- package/template-app-preact-ts/src/App.tsx +12 -0
- package/template-app-preact-ts/src/index.tsx +7 -0
- package/template-app-preact-ts/tests/index.test.tsx +8 -0
- package/template-app-preact-ts/tests/rstest.setup.ts +4 -0
- package/template-app-preact-ts/tests/tsconfig.json +7 -0
- package/template-app-preact-ts/tsconfig.json +28 -0
- package/template-app-react-js/package.json +28 -0
- package/template-app-react-js/rstack.config.js +29 -0
- package/template-app-react-js/src/App.css +26 -0
- package/template-app-react-js/src/App.jsx +12 -0
- package/template-app-react-js/src/index.jsx +10 -0
- package/template-app-react-js/tests/index.test.jsx +8 -0
- package/template-app-react-js/tests/rstest.setup.js +4 -0
- package/template-app-react-ts/package.json +32 -0
- package/template-app-react-ts/rstack.config.ts +29 -0
- package/template-app-react-ts/src/App.css +26 -0
- package/template-app-react-ts/src/App.tsx +12 -0
- package/template-app-react-ts/src/env.d.ts +9 -0
- package/template-app-react-ts/src/index.tsx +13 -0
- package/template-app-react-ts/tests/index.test.tsx +8 -0
- package/template-app-react-ts/tests/rstest.setup.ts +4 -0
- package/template-app-react-ts/tests/tsconfig.json +7 -0
- package/template-app-react-ts/tsconfig.json +23 -0
- package/template-app-solid-js/package.json +27 -0
- package/template-app-solid-js/rstack.config.js +31 -0
- package/template-app-solid-js/src/App.css +26 -0
- package/template-app-solid-js/src/App.jsx +12 -0
- package/template-app-solid-js/src/index.jsx +4 -0
- package/template-app-solid-js/tests/index.test.jsx +8 -0
- package/template-app-solid-js/tests/rstest.setup.js +4 -0
- package/template-app-solid-ts/package.json +29 -0
- package/template-app-solid-ts/rstack.config.ts +30 -0
- package/template-app-solid-ts/src/App.css +26 -0
- package/template-app-solid-ts/src/App.tsx +12 -0
- package/template-app-solid-ts/src/index.tsx +7 -0
- package/template-app-solid-ts/tests/index.test.tsx +8 -0
- package/template-app-solid-ts/tests/rstest.setup.ts +4 -0
- package/template-app-solid-ts/tests/tsconfig.json +7 -0
- package/template-app-solid-ts/tsconfig.json +24 -0
- package/template-app-svelte-js/package.json +27 -0
- package/template-app-svelte-js/pnpm-workspace.yaml +2 -0
- package/template-app-svelte-js/rstack.config.js +26 -0
- package/template-app-svelte-js/src/App.svelte +28 -0
- package/template-app-svelte-js/src/index.css +6 -0
- package/template-app-svelte-js/src/index.js +8 -0
- package/template-app-svelte-js/tests/index.test.js +8 -0
- package/template-app-svelte-js/tests/rstest.setup.js +4 -0
- package/template-app-svelte-ts/package.json +30 -0
- package/template-app-svelte-ts/pnpm-workspace.yaml +2 -0
- package/template-app-svelte-ts/rstack.config.ts +25 -0
- package/template-app-svelte-ts/src/App.svelte +37 -0
- package/template-app-svelte-ts/src/index.css +6 -0
- package/template-app-svelte-ts/src/index.ts +14 -0
- package/template-app-svelte-ts/tests/index.test.ts +11 -0
- package/template-app-svelte-ts/tests/rstest.setup.ts +4 -0
- package/template-app-svelte-ts/tests/tsconfig.json +7 -0
- package/template-app-svelte-ts/tsconfig.json +22 -0
- package/template-app-vanilla-js/package.json +22 -0
- package/template-app-vanilla-js/rstack.config.js +21 -0
- package/template-app-vanilla-js/src/index.css +26 -0
- package/template-app-vanilla-js/src/index.js +12 -0
- package/template-app-vanilla-js/tests/dom.test.js +12 -0
- package/template-app-vanilla-js/tests/rstest.setup.js +4 -0
- package/template-app-vanilla-ts/package.json +24 -0
- package/template-app-vanilla-ts/rstack.config.ts +20 -0
- package/template-app-vanilla-ts/src/index.css +26 -0
- package/template-app-vanilla-ts/src/index.ts +12 -0
- package/template-app-vanilla-ts/tests/dom.test.ts +12 -0
- package/template-app-vanilla-ts/tests/rstest.setup.ts +4 -0
- package/template-app-vanilla-ts/tests/tsconfig.json +7 -0
- package/template-app-vanilla-ts/tsconfig.json +22 -0
- package/template-app-vue-js/package.json +26 -0
- package/template-app-vue-js/rstack.config.js +25 -0
- package/template-app-vue-js/src/App.vue +28 -0
- package/template-app-vue-js/src/index.css +6 -0
- package/template-app-vue-js/src/index.js +5 -0
- package/template-app-vue-js/tests/index.test.js +8 -0
- package/template-app-vue-js/tests/rstest.setup.js +6 -0
- package/template-app-vue-ts/package.json +29 -0
- package/template-app-vue-ts/rstack.config.ts +24 -0
- package/template-app-vue-ts/src/App.vue +28 -0
- package/template-app-vue-ts/src/index.css +6 -0
- package/template-app-vue-ts/src/index.ts +5 -0
- package/template-app-vue-ts/tests/index.test.ts +8 -0
- package/template-app-vue-ts/tests/rstest.setup.ts +6 -0
- package/template-app-vue-ts/tests/tsconfig.json +7 -0
- package/template-app-vue-ts/tsconfig.json +24 -0
- package/template-common/AGENTS.md +7 -0
- package/template-common/README.md +34 -0
- package/template-common/gitignore +13 -0
- package/template-doc-basic/README.md +34 -0
- package/template-doc-basic/docs/_nav.json +16 -0
- package/template-doc-basic/docs/api/_meta.json +1 -0
- package/template-doc-basic/docs/api/commands.mdx +25 -0
- package/template-doc-basic/docs/api/index.mdx +6 -0
- package/template-doc-basic/docs/guide/_meta.json +7 -0
- package/template-doc-basic/docs/guide/start/_meta.json +1 -0
- package/template-doc-basic/docs/guide/start/introduction.md +5 -0
- package/template-doc-basic/docs/index.md +39 -0
- package/template-doc-basic/gitignore +14 -0
- package/template-doc-basic/package.json +24 -0
- package/template-doc-basic/rstack.config.ts +23 -0
- package/template-doc-basic/tsconfig.json +26 -0
- package/template-doc-i18n/README.md +34 -0
- package/template-doc-i18n/docs/en/_nav.json +16 -0
- package/template-doc-i18n/docs/en/api/_meta.json +1 -0
- package/template-doc-i18n/docs/en/api/commands.mdx +25 -0
- package/template-doc-i18n/docs/en/api/index.mdx +6 -0
- package/template-doc-i18n/docs/en/guide/_meta.json +7 -0
- package/template-doc-i18n/docs/en/guide/start/_meta.json +1 -0
- package/template-doc-i18n/docs/en/guide/start/introduction.md +5 -0
- package/template-doc-i18n/docs/en/index.md +39 -0
- package/template-doc-i18n/docs/zh/_nav.json +16 -0
- package/template-doc-i18n/docs/zh/api/_meta.json +12 -0
- package/template-doc-i18n/docs/zh/api/commands.mdx +25 -0
- package/template-doc-i18n/docs/zh/api/index.mdx +6 -0
- package/template-doc-i18n/docs/zh/guide/_meta.json +7 -0
- package/template-doc-i18n/docs/zh/guide/start/_meta.json +7 -0
- package/template-doc-i18n/docs/zh/guide/start/introduction.md +5 -0
- package/template-doc-i18n/docs/zh/index.md +39 -0
- package/template-doc-i18n/gitignore +14 -0
- package/template-doc-i18n/package.json +24 -0
- package/template-doc-i18n/rstack.config.ts +39 -0
- package/template-doc-i18n/tsconfig.json +26 -0
- package/template-lib-node-js/README.md +40 -0
- package/template-lib-node-js/package.json +33 -0
- package/template-lib-node-js/rstack.config.js +21 -0
- package/template-lib-node-js/src/index.js +1 -0
- package/template-lib-node-js/tests/index.test.js +7 -0
- package/template-lib-node-ts/README.md +40 -0
- package/template-lib-node-ts/package.json +37 -0
- package/template-lib-node-ts/rstack.config.ts +21 -0
- package/template-lib-node-ts/src/index.ts +1 -0
- package/template-lib-node-ts/tests/index.test.ts +7 -0
- package/template-lib-node-ts/tsconfig.json +23 -0
- package/template-lib-react-js/README.md +40 -0
- package/template-lib-react-js/package.json +41 -0
- package/template-lib-react-js/rstack.config.js +38 -0
- package/template-lib-react-js/src/Button.jsx +21 -0
- package/template-lib-react-js/src/button.css +34 -0
- package/template-lib-react-js/src/index.jsx +1 -0
- package/template-lib-react-js/tests/index.test.jsx +11 -0
- package/template-lib-react-js/tests/rstest.setup.js +4 -0
- package/template-lib-react-ts/README.md +40 -0
- package/template-lib-react-ts/package.json +46 -0
- package/template-lib-react-ts/rstack.config.ts +39 -0
- package/template-lib-react-ts/src/Button.tsx +46 -0
- package/template-lib-react-ts/src/button.css +34 -0
- package/template-lib-react-ts/src/index.tsx +1 -0
- package/template-lib-react-ts/tests/index.test.tsx +11 -0
- package/template-lib-react-ts/tests/rstest.setup.ts +4 -0
- package/template-lib-react-ts/tests/tsconfig.json +8 -0
- package/template-lib-react-ts/tsconfig.json +24 -0
- package/template-lib-solid-js/README.md +40 -0
- package/template-lib-solid-js/package.json +39 -0
- package/template-lib-solid-js/rstack.config.js +86 -0
- package/template-lib-solid-js/src/Button.jsx +18 -0
- package/template-lib-solid-js/src/button.css +34 -0
- package/template-lib-solid-js/src/index.jsx +1 -0
- package/template-lib-solid-js/tests/index.test.jsx +11 -0
- package/template-lib-solid-js/tests/rstest.setup.js +4 -0
- package/template-lib-solid-ts/README.md +40 -0
- package/template-lib-solid-ts/package.json +43 -0
- package/template-lib-solid-ts/rstack.config.ts +86 -0
- package/template-lib-solid-ts/src/Button.tsx +43 -0
- package/template-lib-solid-ts/src/button.css +34 -0
- package/template-lib-solid-ts/src/index.tsx +2 -0
- package/template-lib-solid-ts/tests/index.test.tsx +11 -0
- package/template-lib-solid-ts/tests/rstest.setup.ts +4 -0
- package/template-lib-solid-ts/tests/tsconfig.json +8 -0
- package/template-lib-solid-ts/tsconfig.json +25 -0
- package/template-lib-svelte-js/README.md +40 -0
- package/template-lib-svelte-js/package.json +36 -0
- package/template-lib-svelte-js/pnpm-workspace.yaml +2 -0
- package/template-lib-svelte-js/rstack.config.js +35 -0
- package/template-lib-svelte-js/src/Button.svelte +24 -0
- package/template-lib-svelte-js/src/button.css +34 -0
- package/template-lib-svelte-js/src/index.js +1 -0
- package/template-lib-svelte-js/tests/index.test.js +19 -0
- package/template-lib-svelte-ts/README.md +40 -0
- package/template-lib-svelte-ts/package.json +42 -0
- package/template-lib-svelte-ts/pnpm-workspace.yaml +2 -0
- package/template-lib-svelte-ts/rstack.config.ts +35 -0
- package/template-lib-svelte-ts/scripts/rslib-plugin-svelte-dts.ts +59 -0
- package/template-lib-svelte-ts/src/Button.svelte +34 -0
- package/template-lib-svelte-ts/src/button.css +34 -0
- package/template-lib-svelte-ts/src/index.ts +1 -0
- package/template-lib-svelte-ts/tests/index.test.ts +19 -0
- package/template-lib-svelte-ts/tests/tsconfig.json +7 -0
- package/template-lib-svelte-ts/tsconfig.json +25 -0
- package/template-lib-vue-js/README.md +40 -0
- package/template-lib-vue-js/package.json +37 -0
- package/template-lib-vue-js/rstack.config.js +34 -0
- package/template-lib-vue-js/src/Button.vue +43 -0
- package/template-lib-vue-js/src/button.css +34 -0
- package/template-lib-vue-js/src/index.js +1 -0
- package/template-lib-vue-js/tests/index.test.js +17 -0
- package/template-lib-vue-js/tests/rstest.setup.js +6 -0
- package/template-lib-vue-ts/README.md +40 -0
- package/template-lib-vue-ts/package.json +42 -0
- package/template-lib-vue-ts/rstack.config.ts +33 -0
- package/template-lib-vue-ts/src/Button.vue +35 -0
- package/template-lib-vue-ts/src/button.css +34 -0
- package/template-lib-vue-ts/src/index.ts +1 -0
- package/template-lib-vue-ts/tests/index.test.ts +17 -0
- package/template-lib-vue-ts/tests/rstest.setup.ts +6 -0
- package/template-lib-vue-ts/tests/tsconfig.json +8 -0
- package/template-lib-vue-ts/tsconfig.json +27 -0
- package/dist/index.d.ts +0 -316
- package/template-biome/AGENTS.md +0 -6
- package/template-biome/biome.json.template +0 -34
- package/template-biome/package.json +0 -12
- package/template-eslint/AGENTS.md +0 -5
- package/template-eslint/react-js/eslint.config.mjs +0 -23
- package/template-eslint/react-js/package.json +0 -15
- package/template-eslint/react-ts/eslint.config.mjs +0 -22
- package/template-eslint/react-ts/package.json +0 -16
- package/template-eslint/svelte-js/eslint.config.mjs +0 -20
- package/template-eslint/svelte-js/package.json +0 -14
- package/template-eslint/svelte-ts/eslint.config.mjs +0 -28
- package/template-eslint/svelte-ts/package.json +0 -16
- package/template-eslint/vanilla-js/eslint.config.mjs +0 -8
- package/template-eslint/vanilla-js/package.json +0 -13
- package/template-eslint/vanilla-ts/eslint.config.mjs +0 -10
- package/template-eslint/vanilla-ts/package.json +0 -14
- package/template-eslint/vue-js/eslint.config.mjs +0 -15
- package/template-eslint/vue-js/package.json +0 -14
- package/template-eslint/vue-ts/eslint.config.mjs +0 -23
- package/template-eslint/vue-ts/package.json +0 -15
- package/template-prettier/.prettierignore +0 -4
- package/template-prettier/.prettierrc +0 -3
- package/template-prettier/AGENTS.md +0 -5
- package/template-prettier/package.json +0 -11
- package/template-rslint/AGENTS.md +0 -9
- package/template-rslint/react-js/package.json +0 -11
- package/template-rslint/react-js/rslint.config.ts +0 -7
- package/template-rslint/react-ts/package.json +0 -11
- package/template-rslint/react-ts/rslint.config.ts +0 -14
- package/template-rslint/vanilla-js/package.json +0 -11
- package/template-rslint/vanilla-js/rslint.config.ts +0 -3
- package/template-rslint/vanilla-ts/package.json +0 -11
- package/template-rslint/vanilla-ts/rslint.config.ts +0 -3
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed } from 'vue';
|
|
3
|
+
import './button.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,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) 0 0 0 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 { default as Button } from './Button.vue';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { expect, test } from 'rstack/test';
|
|
2
|
+
import { mount } from '@vue/test-utils';
|
|
3
|
+
import Button from '../src/Button.vue';
|
|
4
|
+
|
|
5
|
+
test('The button should have correct background color', () => {
|
|
6
|
+
const wrapper = mount(Button, {
|
|
7
|
+
attachTo: document.body,
|
|
8
|
+
props: {
|
|
9
|
+
backgroundColor: '#ccc',
|
|
10
|
+
label: 'Demo Button',
|
|
11
|
+
},
|
|
12
|
+
});
|
|
13
|
+
expect(wrapper.get('button').element).toHaveStyle({
|
|
14
|
+
backgroundColor: '#ccc',
|
|
15
|
+
});
|
|
16
|
+
wrapper.unmount();
|
|
17
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Rstack library
|
|
2
|
+
|
|
3
|
+
## Setup
|
|
4
|
+
|
|
5
|
+
Install the dependencies:
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
{{ packageManager }} install
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Get started
|
|
12
|
+
|
|
13
|
+
Build the library:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
{{ packageManager }} run build
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Build the library in watch mode:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
{{ packageManager }} run dev
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Run tests:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
{{ packageManager }} run test
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Run tests in watch mode:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
{{ packageManager }} run test:watch
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Learn more
|
|
38
|
+
|
|
39
|
+
- [Rstack documentation](https://rstack.rs)
|
|
40
|
+
- [Rslib documentation](https://rslib.rs)
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "rstack-lib-vue-ts",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"exports": {
|
|
6
|
+
".": {
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"default": "./dist/index.js"
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"files": [
|
|
13
|
+
"dist",
|
|
14
|
+
"README.md"
|
|
15
|
+
],
|
|
16
|
+
"scripts": {
|
|
17
|
+
"build": "rs lib && vue-tsc",
|
|
18
|
+
"check": "rs lint && rs fmt --check",
|
|
19
|
+
"dev": "rs lib --watch",
|
|
20
|
+
"format": "rs fmt",
|
|
21
|
+
"lint": "rs lint",
|
|
22
|
+
"test": "rs test",
|
|
23
|
+
"test:watch": "rs test --watch"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@rsbuild/plugin-vue": "^2.0.1",
|
|
27
|
+
"@testing-library/jest-dom": "^7.0.0",
|
|
28
|
+
"@types/node": "^24.13.3",
|
|
29
|
+
"@vue/test-utils": "^2.4.11",
|
|
30
|
+
"happy-dom": "^20.11.2",
|
|
31
|
+
"rstack": "^0.4.0",
|
|
32
|
+
"typescript": "^6.0.3",
|
|
33
|
+
"vue": "^3.5.41",
|
|
34
|
+
"vue-tsc": "^3.3.9"
|
|
35
|
+
},
|
|
36
|
+
"peerDependencies": {
|
|
37
|
+
"vue": ">=3.2.0"
|
|
38
|
+
},
|
|
39
|
+
"publishConfig": {
|
|
40
|
+
"access": "public"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// Rstack configuration guide: https://rstack.rs/config
|
|
2
|
+
import { define } from 'rstack';
|
|
3
|
+
|
|
4
|
+
define.lib(async () => {
|
|
5
|
+
const { pluginVue } = await import('@rsbuild/plugin-vue');
|
|
6
|
+
|
|
7
|
+
return {
|
|
8
|
+
bundle: false,
|
|
9
|
+
source: {
|
|
10
|
+
entry: {
|
|
11
|
+
index: ['./src/**'],
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
output: {
|
|
15
|
+
target: 'web',
|
|
16
|
+
},
|
|
17
|
+
plugins: [pluginVue()],
|
|
18
|
+
};
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
define.test({
|
|
22
|
+
setupFiles: ['./tests/rstest.setup.ts'],
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
define.lint(async () => {
|
|
26
|
+
const { js, ts } = await import('rstack/lint');
|
|
27
|
+
|
|
28
|
+
return [js.configs.recommended, ts.configs.recommended];
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
define.fmt({
|
|
32
|
+
singleQuote: true,
|
|
33
|
+
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed } from 'vue';
|
|
3
|
+
import './button.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,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) 0 0 0 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 { default as Button } from './Button.vue';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { expect, test } from 'rstack/test';
|
|
2
|
+
import { mount } from '@vue/test-utils';
|
|
3
|
+
import Button from '../src/Button.vue';
|
|
4
|
+
|
|
5
|
+
test('The button should have correct background color', () => {
|
|
6
|
+
const wrapper = mount(Button, {
|
|
7
|
+
attachTo: document.body,
|
|
8
|
+
props: {
|
|
9
|
+
backgroundColor: '#ccc',
|
|
10
|
+
label: 'Demo Button',
|
|
11
|
+
},
|
|
12
|
+
});
|
|
13
|
+
expect(wrapper.get('button').element).toHaveStyle({
|
|
14
|
+
backgroundColor: '#ccc',
|
|
15
|
+
});
|
|
16
|
+
wrapper.unmount();
|
|
17
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"lib": ["DOM", "ES2022"],
|
|
4
|
+
"jsx": "preserve",
|
|
5
|
+
"target": "ES2022",
|
|
6
|
+
"declaration": true,
|
|
7
|
+
"emitDeclarationOnly": true,
|
|
8
|
+
"outDir": "dist",
|
|
9
|
+
"skipLibCheck": true,
|
|
10
|
+
"types": ["rstack/types", "node"],
|
|
11
|
+
"jsxImportSource": "vue",
|
|
12
|
+
"useDefineForClassFields": true,
|
|
13
|
+
"rootDir": "src",
|
|
14
|
+
|
|
15
|
+
/* modules */
|
|
16
|
+
"moduleDetection": "force",
|
|
17
|
+
"moduleResolution": "bundler",
|
|
18
|
+
"verbatimModuleSyntax": true,
|
|
19
|
+
"resolveJsonModule": true,
|
|
20
|
+
"allowImportingTsExtensions": true,
|
|
21
|
+
|
|
22
|
+
/* type checking */
|
|
23
|
+
"noUnusedLocals": true,
|
|
24
|
+
"noUnusedParameters": true
|
|
25
|
+
},
|
|
26
|
+
"include": ["src"]
|
|
27
|
+
}
|
package/dist/index.d.ts
DELETED
|
@@ -1,316 +0,0 @@
|
|
|
1
|
-
import { AutocompletePrompt } from '@clack/core';
|
|
2
|
-
import { Readable } from 'node:stream';
|
|
3
|
-
import { Writable } from 'node:stream';
|
|
4
|
-
|
|
5
|
-
export declare type Argv = {
|
|
6
|
-
help?: boolean;
|
|
7
|
-
dir?: string;
|
|
8
|
-
template?: string;
|
|
9
|
-
override?: boolean;
|
|
10
|
-
tools?: string | string[];
|
|
11
|
-
skill?: string | string[];
|
|
12
|
-
packageName?: string;
|
|
13
|
-
'package-name'?: string;
|
|
14
|
-
templateVersion?: string;
|
|
15
|
-
'template-version'?: string;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export declare const autocomplete: <Value>(opts: AutocompleteOptions<Value>) => Promise<Value | symbol>;
|
|
19
|
-
|
|
20
|
-
declare interface AutocompleteOptions<Value> extends AutocompleteSharedOptions<Value> {
|
|
21
|
-
/**
|
|
22
|
-
* The initial selected value.
|
|
23
|
-
*/
|
|
24
|
-
initialValue?: Value;
|
|
25
|
-
/**
|
|
26
|
-
* The initial user input
|
|
27
|
-
*/
|
|
28
|
-
initialUserInput?: string;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
declare interface AutocompleteSharedOptions<Value> extends CommonOptions {
|
|
32
|
-
/**
|
|
33
|
-
* The message to display to the user.
|
|
34
|
-
*/
|
|
35
|
-
message: string;
|
|
36
|
-
/**
|
|
37
|
-
* Available options for the autocomplete prompt.
|
|
38
|
-
*/
|
|
39
|
-
options: Option_2<Value>[] | ((this: AutocompletePrompt<Option_2<Value>>) => Option_2<Value>[]);
|
|
40
|
-
/**
|
|
41
|
-
* Maximum number of items to display at once.
|
|
42
|
-
*/
|
|
43
|
-
maxItems?: number;
|
|
44
|
-
/**
|
|
45
|
-
* Placeholder text to display when no input is provided.
|
|
46
|
-
*/
|
|
47
|
-
placeholder?: string;
|
|
48
|
-
/**
|
|
49
|
-
* Validates the value
|
|
50
|
-
*/
|
|
51
|
-
validate?: (value: Value | Value[] | undefined) => string | Error | undefined;
|
|
52
|
-
/**
|
|
53
|
-
* Custom filter function to match options against search input.
|
|
54
|
-
* If not provided, a default filter that matches label, hint, and value is used.
|
|
55
|
-
*/
|
|
56
|
-
filter?: (search: string, option: Option_2<Value>) => boolean;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export declare const BUILTIN_TOOLS: string[];
|
|
60
|
-
|
|
61
|
-
export declare function checkCancel<T>(value: unknown): T;
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Collect AGENTS.md files from template directories
|
|
65
|
-
*/
|
|
66
|
-
export declare function collectAgentsFiles(agentsMdSearchDirs: string[]): string[];
|
|
67
|
-
|
|
68
|
-
declare interface CommonOptions {
|
|
69
|
-
input?: Readable;
|
|
70
|
-
output?: Writable;
|
|
71
|
-
signal?: AbortSignal;
|
|
72
|
-
withGuide?: boolean;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Copy files from one folder to another.
|
|
77
|
-
* @param from Source folder
|
|
78
|
-
* @param to Destination folder
|
|
79
|
-
* @param version - Optional. The version to update in the package.json. If not provided, version will not be updated.
|
|
80
|
-
* @param name - Optional. The name to update in the package.json. If not provided, name will not be updated.
|
|
81
|
-
* @param isMergePackageJson Merge package.json files
|
|
82
|
-
* @param skipFiles Files to skip
|
|
83
|
-
*/
|
|
84
|
-
export declare function copyFolder({ from, to, version, packageName, templateParameters, isMergePackageJson, skipFiles, }: {
|
|
85
|
-
from: string;
|
|
86
|
-
to: string;
|
|
87
|
-
version?: string | Record<string, string>;
|
|
88
|
-
packageName?: string;
|
|
89
|
-
templateParameters?: Record<string, string>;
|
|
90
|
-
isMergePackageJson?: boolean;
|
|
91
|
-
skipFiles?: string[];
|
|
92
|
-
}): void;
|
|
93
|
-
|
|
94
|
-
export declare function create({ name, root, templates, skipFiles, getTemplateName, mapESLintTemplate, mapRslintTemplate, version, noteInformation, extraTools, extraSkills, argv: processArgv, }: {
|
|
95
|
-
name: string;
|
|
96
|
-
root: string;
|
|
97
|
-
skipFiles?: string[];
|
|
98
|
-
templates: string[];
|
|
99
|
-
getTemplateName: (argv: Argv) => Promise<string>;
|
|
100
|
-
/**
|
|
101
|
-
* Map the template name to the ESLint template name.
|
|
102
|
-
* If not provided, defaults to 'vanilla-ts' for all templates.
|
|
103
|
-
*/
|
|
104
|
-
mapESLintTemplate?: (templateName: string, context: {
|
|
105
|
-
distFolder: string;
|
|
106
|
-
}) => ESLintTemplateName | null;
|
|
107
|
-
/**
|
|
108
|
-
* Map the template name to the Rslint template name.
|
|
109
|
-
* If not provided, reuses mapESLintTemplate and falls back to 'vanilla-ts'.
|
|
110
|
-
*/
|
|
111
|
-
mapRslintTemplate?: (templateName: string, context: {
|
|
112
|
-
distFolder: string;
|
|
113
|
-
}) => RslintTemplateName | null;
|
|
114
|
-
version?: Record<string, string> | string;
|
|
115
|
-
noteInformation?: string[];
|
|
116
|
-
/**
|
|
117
|
-
* Specify additional tools.
|
|
118
|
-
*/
|
|
119
|
-
extraTools?: ExtraTool[];
|
|
120
|
-
extraSkills?: ExtraSkill[];
|
|
121
|
-
/**
|
|
122
|
-
* For test purpose, override the default argv (process.argv).
|
|
123
|
-
*/
|
|
124
|
-
argv?: string[];
|
|
125
|
-
}): Promise<void>;
|
|
126
|
-
|
|
127
|
-
export declare type ESLintTemplateName = 'vanilla-js' | 'vanilla-ts' | 'react-js' | 'react-ts' | 'vue-ts' | 'vue-js' | 'svelte-js' | 'svelte-ts';
|
|
128
|
-
|
|
129
|
-
declare type ExtraSkill = {
|
|
130
|
-
value: string;
|
|
131
|
-
label: string;
|
|
132
|
-
source: string;
|
|
133
|
-
skill?: string;
|
|
134
|
-
/**
|
|
135
|
-
* Controls whether the skill is shown in the interactive prompt for the
|
|
136
|
-
* selected template/tools. Explicit `--skill` values and `--help` remain
|
|
137
|
-
* unfiltered so CLI input stays authoritative and help stays discoverable.
|
|
138
|
-
*/
|
|
139
|
-
when?: (context: {
|
|
140
|
-
templateName: string;
|
|
141
|
-
tools: string[];
|
|
142
|
-
}) => boolean;
|
|
143
|
-
order?: 'pre' | 'post';
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
declare type ExtraTool = {
|
|
147
|
-
/**
|
|
148
|
-
* The value of the multiselect option.
|
|
149
|
-
*/
|
|
150
|
-
value: string;
|
|
151
|
-
/**
|
|
152
|
-
* The label of the multiselect option.
|
|
153
|
-
*/
|
|
154
|
-
label: string;
|
|
155
|
-
/**
|
|
156
|
-
* The action to perform when the tool is selected.
|
|
157
|
-
*/
|
|
158
|
-
action?: (context: {
|
|
159
|
-
templateName: string;
|
|
160
|
-
distFolder: string;
|
|
161
|
-
addAgentsMdSearchDirs: (dir: string) => void;
|
|
162
|
-
}) => unknown;
|
|
163
|
-
/**
|
|
164
|
-
* The custom command to run when the tool is selected.
|
|
165
|
-
*/
|
|
166
|
-
command?: string;
|
|
167
|
-
/**
|
|
168
|
-
* Specify where to display this tool.
|
|
169
|
-
* If undefined, the tool will be displayed after built-in tools.
|
|
170
|
-
*/
|
|
171
|
-
order?: 'pre' | 'post';
|
|
172
|
-
/**
|
|
173
|
-
* Condition to determine whether this tool should be displayed.
|
|
174
|
-
* If returns false, the tool will not be shown in the selection.
|
|
175
|
-
* @default () => true
|
|
176
|
-
*/
|
|
177
|
-
when?: (context: {
|
|
178
|
-
templateName: string;
|
|
179
|
-
}) => boolean;
|
|
180
|
-
};
|
|
181
|
-
|
|
182
|
-
export declare const groupMultiselect: <Value>(opts: GroupMultiSelectOptions<Value>) => Promise<Value[] | symbol>;
|
|
183
|
-
|
|
184
|
-
declare interface GroupMultiSelectOptions<Value> extends CommonOptions {
|
|
185
|
-
message: string;
|
|
186
|
-
options: Record<string, Option_2<Value>[]>;
|
|
187
|
-
initialValues?: Value[];
|
|
188
|
-
required?: boolean;
|
|
189
|
-
cursorAt?: Value;
|
|
190
|
-
selectableGroups?: boolean;
|
|
191
|
-
groupSpacing?: number;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
/**
|
|
195
|
-
* Check if the input is an npm package template
|
|
196
|
-
*/
|
|
197
|
-
export declare function isNpmTemplate(templateInput: string): boolean;
|
|
198
|
-
|
|
199
|
-
/**
|
|
200
|
-
* Merge AGENTS.md files from multiple sources
|
|
201
|
-
*/
|
|
202
|
-
export declare function mergeAgentsFiles(agentsFiles: string[]): string;
|
|
203
|
-
|
|
204
|
-
/**
|
|
205
|
-
* Merge two package.json files and keep the order of keys.
|
|
206
|
-
* @param targetPackage Path to the base package.json file
|
|
207
|
-
* @param extraPackage Path to the extra package.json file to merge
|
|
208
|
-
*/
|
|
209
|
-
export declare function mergePackageJson(targetPackage: string, extraPackage: string): void;
|
|
210
|
-
|
|
211
|
-
export declare const multiselect: <Value>(opts: MultiSelectOptions<Value>) => Promise<Value[] | symbol>;
|
|
212
|
-
|
|
213
|
-
declare interface MultiSelectOptions<Value> extends CommonOptions {
|
|
214
|
-
message: string;
|
|
215
|
-
options: Option_2<Value>[];
|
|
216
|
-
initialValues?: Value[];
|
|
217
|
-
maxItems?: number;
|
|
218
|
-
required?: boolean;
|
|
219
|
-
cursorAt?: Value;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
declare type Option_2<Value> = Value extends Primitive ? {
|
|
223
|
-
/**
|
|
224
|
-
* Internal data for this option.
|
|
225
|
-
*/
|
|
226
|
-
value: Value;
|
|
227
|
-
/**
|
|
228
|
-
* The optional, user-facing text for this option.
|
|
229
|
-
*
|
|
230
|
-
* By default, the `value` is converted to a string.
|
|
231
|
-
*/
|
|
232
|
-
label?: string;
|
|
233
|
-
/**
|
|
234
|
-
* An optional hint to display to the user when
|
|
235
|
-
* this option might be selected.
|
|
236
|
-
*
|
|
237
|
-
* By default, no `hint` is displayed.
|
|
238
|
-
*/
|
|
239
|
-
hint?: string;
|
|
240
|
-
/**
|
|
241
|
-
* Whether this option is disabled.
|
|
242
|
-
* Disabled options are visible but cannot be selected.
|
|
243
|
-
*
|
|
244
|
-
* By default, options are not disabled.
|
|
245
|
-
*/
|
|
246
|
-
disabled?: boolean;
|
|
247
|
-
} : {
|
|
248
|
-
/**
|
|
249
|
-
* Internal data for this option.
|
|
250
|
-
*/
|
|
251
|
-
value: Value;
|
|
252
|
-
/**
|
|
253
|
-
* Required. The user-facing text for this option.
|
|
254
|
-
*/
|
|
255
|
-
label: string;
|
|
256
|
-
/**
|
|
257
|
-
* An optional hint to display to the user when
|
|
258
|
-
* this option might be selected.
|
|
259
|
-
*
|
|
260
|
-
* By default, no `hint` is displayed.
|
|
261
|
-
*/
|
|
262
|
-
hint?: string;
|
|
263
|
-
/**
|
|
264
|
-
* Whether this option is disabled.
|
|
265
|
-
* Disabled options are visible but cannot be selected.
|
|
266
|
-
*
|
|
267
|
-
* By default, options are not disabled.
|
|
268
|
-
*/
|
|
269
|
-
disabled?: boolean;
|
|
270
|
-
};
|
|
271
|
-
|
|
272
|
-
declare type Primitive = Readonly<string | boolean | number>;
|
|
273
|
-
|
|
274
|
-
/**
|
|
275
|
-
* Resolve custom template (npm package, GitHub, or local path)
|
|
276
|
-
*/
|
|
277
|
-
export declare function resolveCustomTemplate(templateInput: string, version?: string, options?: {
|
|
278
|
-
forceLatest?: boolean;
|
|
279
|
-
cacheDir?: string;
|
|
280
|
-
}): string;
|
|
281
|
-
|
|
282
|
-
/**
|
|
283
|
-
* Resolve npm template package and return the local path
|
|
284
|
-
*/
|
|
285
|
-
export declare function resolveNpmTemplate(packageName: string, version?: string, options?: {
|
|
286
|
-
forceLatest?: boolean;
|
|
287
|
-
cacheDir?: string;
|
|
288
|
-
}): string;
|
|
289
|
-
|
|
290
|
-
export declare type RslintTemplateName = 'vanilla-js' | 'vanilla-ts' | 'react-js' | 'react-ts';
|
|
291
|
-
|
|
292
|
-
/**
|
|
293
|
-
* Sanitize package name and version to create a valid cache key
|
|
294
|
-
*/
|
|
295
|
-
export declare const sanitizeCacheKey: (packageName: string, version: string) => string;
|
|
296
|
-
|
|
297
|
-
export declare const select: <Value>(opts: SelectOptions<Value>) => Promise<Value | symbol>;
|
|
298
|
-
|
|
299
|
-
declare interface SelectOptions<Value> extends CommonOptions {
|
|
300
|
-
message: string;
|
|
301
|
-
options: Option_2<Value>[];
|
|
302
|
-
initialValue?: Value;
|
|
303
|
-
maxItems?: number;
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
export declare const text: (opts: TextOptions) => Promise<string | symbol>;
|
|
307
|
-
|
|
308
|
-
declare interface TextOptions extends CommonOptions {
|
|
309
|
-
message: string;
|
|
310
|
-
placeholder?: string;
|
|
311
|
-
defaultValue?: string;
|
|
312
|
-
initialValue?: string;
|
|
313
|
-
validate?: (value: string | undefined) => string | Error | undefined;
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
export { }
|