create-rstack 2.1.3 → 3.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/LICENSE +1 -1
- package/README.md +43 -73
- package/bin.js +2 -0
- package/dist/index.js +195 -3312
- package/package.json +23 -41
- package/template-app-lit/package.json +23 -0
- package/template-app-lit/rstack.config.js +28 -0
- package/template-app-lit/src/index.css +6 -0
- package/template-app-lit/src/index.html +7 -0
- package/template-app-lit/src/index.js +4 -0
- package/template-app-lit/src/my-element.js +34 -0
- package/template-app-lit/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/package.json +26 -0
- package/template-app-preact/rstack.config.js +29 -0
- package/template-app-preact/src/App.css +26 -0
- package/template-app-preact/src/App.jsx +12 -0
- package/template-app-preact/src/index.jsx +4 -0
- package/template-app-preact/tests/index.test.jsx +8 -0
- package/template-app-preact/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/package.json +28 -0
- package/template-app-react/rstack.config.js +29 -0
- package/template-app-react/src/App.css +26 -0
- package/template-app-react/src/App.jsx +12 -0
- package/template-app-react/src/index.jsx +10 -0
- package/template-app-react/tests/index.test.jsx +8 -0
- package/template-app-react/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/package.json +27 -0
- package/template-app-solid/rstack.config.js +31 -0
- package/template-app-solid/src/App.css +26 -0
- package/template-app-solid/src/App.jsx +12 -0
- package/template-app-solid/src/index.jsx +4 -0
- package/template-app-solid/tests/index.test.jsx +8 -0
- package/template-app-solid/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/package.json +27 -0
- package/template-app-svelte/pnpm-workspace.yaml +2 -0
- package/template-app-svelte/rstack.config.js +26 -0
- package/template-app-svelte/src/App.svelte +28 -0
- package/template-app-svelte/src/index.css +6 -0
- package/template-app-svelte/src/index.js +8 -0
- package/template-app-svelte/tests/index.test.js +8 -0
- package/template-app-svelte/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/package.json +22 -0
- package/template-app-vanilla/rstack.config.js +21 -0
- package/template-app-vanilla/src/index.css +26 -0
- package/template-app-vanilla/src/index.js +12 -0
- package/template-app-vanilla/tests/dom.test.js +12 -0
- package/template-app-vanilla/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/package.json +26 -0
- package/template-app-vue/rstack.config.js +25 -0
- package/template-app-vue/src/App.vue +28 -0
- package/template-app-vue/src/index.css +6 -0
- package/template-app-vue/src/index.js +5 -0
- package/template-app-vue/tests/index.test.js +8 -0
- package/template-app-vue/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 +25 -0
- package/template-common/gitignore +13 -0
- package/template-doc/README.md +23 -0
- package/template-doc/docs/_nav.json +16 -0
- package/template-doc/docs/api/_meta.json +1 -0
- package/template-doc/docs/api/commands.mdx +25 -0
- package/template-doc/docs/api/index.mdx +6 -0
- package/template-doc/docs/guide/_meta.json +7 -0
- package/template-doc/docs/guide/start/_meta.json +1 -0
- package/template-doc/docs/guide/start/introduction.md +5 -0
- package/template-doc/docs/index.md +39 -0
- package/template-doc/gitignore +14 -0
- package/template-doc/package.json +24 -0
- package/template-doc/rstack.config.ts +23 -0
- package/template-doc/tsconfig.json +26 -0
- package/template-doc-i18n/README.md +23 -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/README.md +24 -0
- package/template-lib-node/package.json +33 -0
- package/template-lib-node/rstack.config.js +21 -0
- package/template-lib-node/src/index.js +1 -0
- package/template-lib-node/tests/index.test.js +7 -0
- package/template-lib-node-ts/README.md +24 -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/README.md +24 -0
- package/template-lib-react/package.json +41 -0
- package/template-lib-react/rstack.config.js +38 -0
- package/template-lib-react/src/Button.jsx +21 -0
- package/template-lib-react/src/button.css +34 -0
- package/template-lib-react/src/index.jsx +1 -0
- package/template-lib-react/tests/index.test.jsx +11 -0
- package/template-lib-react/tests/rstest.setup.js +4 -0
- package/template-lib-react-ts/README.md +24 -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/README.md +24 -0
- package/template-lib-solid/package.json +39 -0
- package/template-lib-solid/rstack.config.js +86 -0
- package/template-lib-solid/src/Button.jsx +18 -0
- package/template-lib-solid/src/button.css +34 -0
- package/template-lib-solid/src/index.jsx +1 -0
- package/template-lib-solid/tests/index.test.jsx +11 -0
- package/template-lib-solid/tests/rstest.setup.js +4 -0
- package/template-lib-solid-ts/README.md +24 -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/README.md +24 -0
- package/template-lib-svelte/package.json +36 -0
- package/template-lib-svelte/pnpm-workspace.yaml +2 -0
- package/template-lib-svelte/rstack.config.js +35 -0
- package/template-lib-svelte/src/Button.svelte +24 -0
- package/template-lib-svelte/src/button.css +34 -0
- package/template-lib-svelte/src/index.js +1 -0
- package/template-lib-svelte/tests/index.test.js +19 -0
- package/template-lib-svelte-ts/README.md +24 -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/README.md +24 -0
- package/template-lib-vue/package.json +37 -0
- package/template-lib-vue/rstack.config.js +34 -0
- package/template-lib-vue/src/Button.vue +43 -0
- package/template-lib-vue/src/button.css +34 -0
- package/template-lib-vue/src/index.js +1 -0
- package/template-lib-vue/tests/index.test.js +17 -0
- package/template-lib-vue/tests/rstest.setup.js +6 -0
- package/template-lib-vue-ts/README.md +24 -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 -356
- 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,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "rstack-doc-i18n",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "rs doc build",
|
|
8
|
+
"check": "rs check --type-check",
|
|
9
|
+
"dev": "rs doc",
|
|
10
|
+
"format": "rs fmt",
|
|
11
|
+
"lint": "rs lint",
|
|
12
|
+
"preview": "rs doc preview"
|
|
13
|
+
},
|
|
14
|
+
"devDependencies": {
|
|
15
|
+
"@rspress/core": "^2.0.19",
|
|
16
|
+
"@types/node": "^24.13.3",
|
|
17
|
+
"@types/react": "^19.2.18",
|
|
18
|
+
"@types/react-dom": "^19.2.4",
|
|
19
|
+
"react": "^19.2.8",
|
|
20
|
+
"react-dom": "^19.2.8",
|
|
21
|
+
"rstack": "^0.5.0",
|
|
22
|
+
"typescript": "^7.0.2"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// Rstack configuration guide: https://rstack.rs/config
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { define } from 'rstack';
|
|
4
|
+
|
|
5
|
+
define.doc({
|
|
6
|
+
root: path.join(import.meta.dirname, 'docs'),
|
|
7
|
+
title: 'My Site',
|
|
8
|
+
description: 'A multilingual Rspress documentation site.',
|
|
9
|
+
lang: 'en',
|
|
10
|
+
locales: [
|
|
11
|
+
{
|
|
12
|
+
lang: 'en',
|
|
13
|
+
label: 'English',
|
|
14
|
+
title: 'My Site',
|
|
15
|
+
description: 'A multilingual Rspress documentation site.',
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
lang: 'zh',
|
|
19
|
+
label: '简体中文',
|
|
20
|
+
title: '我的站点',
|
|
21
|
+
description: '一个多语言 Rspress 文档站点。',
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
define.lint(async () => {
|
|
27
|
+
const { js, ts, reactPlugin, reactHooksPlugin } = await import('rstack/lint');
|
|
28
|
+
|
|
29
|
+
return [
|
|
30
|
+
js.configs.recommended,
|
|
31
|
+
ts.configs.recommended,
|
|
32
|
+
reactPlugin.configs.recommended,
|
|
33
|
+
reactHooksPlugin.configs.recommended,
|
|
34
|
+
];
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
define.fmt({
|
|
38
|
+
singleQuote: true,
|
|
39
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"lib": ["DOM", "ES2020"],
|
|
4
|
+
"jsx": "react-jsx",
|
|
5
|
+
"target": "ES2020",
|
|
6
|
+
"noEmit": true,
|
|
7
|
+
"skipLibCheck": true,
|
|
8
|
+
"types": ["rstack/types", "node"],
|
|
9
|
+
"useDefineForClassFields": true,
|
|
10
|
+
|
|
11
|
+
/* modules */
|
|
12
|
+
"moduleDetection": "force",
|
|
13
|
+
"moduleResolution": "bundler",
|
|
14
|
+
"verbatimModuleSyntax": true,
|
|
15
|
+
"resolveJsonModule": true,
|
|
16
|
+
"allowImportingTsExtensions": true,
|
|
17
|
+
|
|
18
|
+
/* type checking */
|
|
19
|
+
"noUnusedLocals": true,
|
|
20
|
+
"noUnusedParameters": true
|
|
21
|
+
},
|
|
22
|
+
"include": ["docs", "rstack.config.ts"],
|
|
23
|
+
"mdx": {
|
|
24
|
+
"checkMdx": true
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Rstack library
|
|
2
|
+
|
|
3
|
+
## Setup
|
|
4
|
+
|
|
5
|
+
Install the dependencies:
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
{{ packageManager }} install
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Scripts
|
|
12
|
+
|
|
13
|
+
- `{{ packageManager }} run build`: Build the library.
|
|
14
|
+
- `{{ packageManager }} run check`: Run static checks, including lint and format.
|
|
15
|
+
- `{{ packageManager }} run dev`: Build the library in watch mode.
|
|
16
|
+
- `{{ packageManager }} run format`: Format code.
|
|
17
|
+
- `{{ packageManager }} run lint`: Lint code.
|
|
18
|
+
- `{{ packageManager }} run test`: Run tests.
|
|
19
|
+
- `{{ packageManager }} run test:watch`: Run tests in watch mode.
|
|
20
|
+
|
|
21
|
+
## Learn more
|
|
22
|
+
|
|
23
|
+
- [Rstack documentation](https://rstack.rs)
|
|
24
|
+
- [Rslib documentation](https://rslib.rs)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "rstack-lib-node",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"sideEffects": false,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"default": "./dist/index.js"
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist",
|
|
13
|
+
"README.md"
|
|
14
|
+
],
|
|
15
|
+
"scripts": {
|
|
16
|
+
"build": "rs lib",
|
|
17
|
+
"check": "rs check",
|
|
18
|
+
"dev": "rs lib --watch",
|
|
19
|
+
"format": "rs fmt",
|
|
20
|
+
"lint": "rs lint",
|
|
21
|
+
"test": "rs test",
|
|
22
|
+
"test:watch": "rs test --watch"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"rstack": "^0.5.0"
|
|
26
|
+
},
|
|
27
|
+
"engines": {
|
|
28
|
+
"node": ">=22.12.0"
|
|
29
|
+
},
|
|
30
|
+
"publishConfig": {
|
|
31
|
+
"access": "public"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
// Rstack configuration guide: https://rstack.rs/config
|
|
3
|
+
import { define } from 'rstack';
|
|
4
|
+
|
|
5
|
+
define.lib({
|
|
6
|
+
syntax: ['node 22'],
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
define.test({
|
|
10
|
+
// Configure Rstest
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
define.lint(async () => {
|
|
14
|
+
const { js } = await import('rstack/lint');
|
|
15
|
+
|
|
16
|
+
return [js.configs.recommended];
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
define.fmt({
|
|
20
|
+
singleQuote: true,
|
|
21
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const squared = (n) => n * n;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Rstack library
|
|
2
|
+
|
|
3
|
+
## Setup
|
|
4
|
+
|
|
5
|
+
Install the dependencies:
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
{{ packageManager }} install
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Scripts
|
|
12
|
+
|
|
13
|
+
- `{{ packageManager }} run build`: Build the library.
|
|
14
|
+
- `{{ packageManager }} run check`: Run static checks, including lint and format.
|
|
15
|
+
- `{{ packageManager }} run dev`: Build the library in watch mode.
|
|
16
|
+
- `{{ packageManager }} run format`: Format code.
|
|
17
|
+
- `{{ packageManager }} run lint`: Lint code.
|
|
18
|
+
- `{{ packageManager }} run test`: Run tests.
|
|
19
|
+
- `{{ packageManager }} run test:watch`: Run tests in watch mode.
|
|
20
|
+
|
|
21
|
+
## Learn more
|
|
22
|
+
|
|
23
|
+
- [Rstack documentation](https://rstack.rs)
|
|
24
|
+
- [Rslib documentation](https://rslib.rs)
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "rstack-lib-node-ts",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"sideEffects": false,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"default": "./dist/index.js"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"files": [
|
|
14
|
+
"dist",
|
|
15
|
+
"README.md"
|
|
16
|
+
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "rs lib",
|
|
19
|
+
"check": "rs check --type-check",
|
|
20
|
+
"dev": "rs lib --watch",
|
|
21
|
+
"format": "rs fmt",
|
|
22
|
+
"lint": "rs lint",
|
|
23
|
+
"test": "rs test",
|
|
24
|
+
"test:watch": "rs test --watch"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@types/node": "^24.13.3",
|
|
28
|
+
"rstack": "^0.5.0",
|
|
29
|
+
"typescript": "^7.0.2"
|
|
30
|
+
},
|
|
31
|
+
"engines": {
|
|
32
|
+
"node": ">=22.12.0"
|
|
33
|
+
},
|
|
34
|
+
"publishConfig": {
|
|
35
|
+
"access": "public"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// Rstack configuration guide: https://rstack.rs/config
|
|
2
|
+
import { define } from 'rstack';
|
|
3
|
+
|
|
4
|
+
define.lib({
|
|
5
|
+
syntax: ['node 22'],
|
|
6
|
+
dts: true,
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
define.test({
|
|
10
|
+
// Configure Rstest
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
define.lint(async () => {
|
|
14
|
+
const { js, ts } = await import('rstack/lint');
|
|
15
|
+
|
|
16
|
+
return [js.configs.recommended, ts.configs.recommended];
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
define.fmt({
|
|
20
|
+
singleQuote: true,
|
|
21
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const squared = (n: number): number => n * n;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"lib": ["ES2022"],
|
|
4
|
+
"target": "ES2022",
|
|
5
|
+
"noEmit": true,
|
|
6
|
+
"skipLibCheck": true,
|
|
7
|
+
"types": ["rstack/types", "node"],
|
|
8
|
+
"useDefineForClassFields": true,
|
|
9
|
+
"rootDir": "src",
|
|
10
|
+
|
|
11
|
+
/* modules */
|
|
12
|
+
"moduleDetection": "force",
|
|
13
|
+
"moduleResolution": "bundler",
|
|
14
|
+
"verbatimModuleSyntax": true,
|
|
15
|
+
"resolveJsonModule": true,
|
|
16
|
+
"allowImportingTsExtensions": true,
|
|
17
|
+
|
|
18
|
+
/* type checking */
|
|
19
|
+
"noUnusedLocals": true,
|
|
20
|
+
"noUnusedParameters": true
|
|
21
|
+
},
|
|
22
|
+
"include": ["src"]
|
|
23
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Rstack library
|
|
2
|
+
|
|
3
|
+
## Setup
|
|
4
|
+
|
|
5
|
+
Install the dependencies:
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
{{ packageManager }} install
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Scripts
|
|
12
|
+
|
|
13
|
+
- `{{ packageManager }} run build`: Build the library.
|
|
14
|
+
- `{{ packageManager }} run check`: Run static checks, including lint and format.
|
|
15
|
+
- `{{ packageManager }} run dev`: Build the library in watch mode.
|
|
16
|
+
- `{{ packageManager }} run format`: Format code.
|
|
17
|
+
- `{{ packageManager }} run lint`: Lint code.
|
|
18
|
+
- `{{ packageManager }} run test`: Run tests.
|
|
19
|
+
- `{{ packageManager }} run test:watch`: Run tests in watch mode.
|
|
20
|
+
|
|
21
|
+
## Learn more
|
|
22
|
+
|
|
23
|
+
- [Rstack documentation](https://rstack.rs)
|
|
24
|
+
- [Rslib documentation](https://rslib.rs)
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "rstack-lib-react",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"exports": {
|
|
6
|
+
".": {
|
|
7
|
+
"default": "./dist/index.js"
|
|
8
|
+
}
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist",
|
|
12
|
+
"README.md"
|
|
13
|
+
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "rs lib",
|
|
16
|
+
"check": "rs check",
|
|
17
|
+
"dev": "rs lib --watch",
|
|
18
|
+
"format": "rs fmt",
|
|
19
|
+
"lint": "rs lint",
|
|
20
|
+
"test": "rs test",
|
|
21
|
+
"test:watch": "rs test --watch"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@rsbuild/plugin-react": "^2.1.0",
|
|
25
|
+
"@testing-library/dom": "^10.4.1",
|
|
26
|
+
"@testing-library/jest-dom": "^7.0.0",
|
|
27
|
+
"@testing-library/react": "^16.3.2",
|
|
28
|
+
"@types/react-dom": "^19.2.4",
|
|
29
|
+
"happy-dom": "^20.11.2",
|
|
30
|
+
"react": "^19.2.8",
|
|
31
|
+
"react-dom": "^19.2.8",
|
|
32
|
+
"rstack": "^0.5.0"
|
|
33
|
+
},
|
|
34
|
+
"peerDependencies": {
|
|
35
|
+
"react": ">=18.0.0",
|
|
36
|
+
"react-dom": ">=18.0.0"
|
|
37
|
+
},
|
|
38
|
+
"publishConfig": {
|
|
39
|
+
"access": "public"
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
// Rstack configuration guide: https://rstack.rs/config
|
|
3
|
+
import { define } from 'rstack';
|
|
4
|
+
|
|
5
|
+
define.lib(async () => {
|
|
6
|
+
const { pluginReact } = await import('@rsbuild/plugin-react');
|
|
7
|
+
|
|
8
|
+
return {
|
|
9
|
+
bundle: false,
|
|
10
|
+
source: {
|
|
11
|
+
entry: {
|
|
12
|
+
index: ['./src/**'],
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
output: {
|
|
16
|
+
target: 'web',
|
|
17
|
+
},
|
|
18
|
+
plugins: [pluginReact()],
|
|
19
|
+
};
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
define.test({
|
|
23
|
+
setupFiles: ['./tests/rstest.setup.js'],
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
define.lint(async () => {
|
|
27
|
+
const { js, reactHooksPlugin, reactPlugin } = await import('rstack/lint');
|
|
28
|
+
|
|
29
|
+
return [
|
|
30
|
+
js.configs.recommended,
|
|
31
|
+
reactPlugin.configs.recommended,
|
|
32
|
+
reactHooksPlugin.configs.recommended,
|
|
33
|
+
];
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
define.fmt({
|
|
37
|
+
singleQuote: true,
|
|
38
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import './button.css';
|
|
2
|
+
|
|
3
|
+
export const Button = ({
|
|
4
|
+
primary = false,
|
|
5
|
+
size = 'medium',
|
|
6
|
+
backgroundColor,
|
|
7
|
+
label,
|
|
8
|
+
...props
|
|
9
|
+
}) => {
|
|
10
|
+
const mode = primary ? 'demo-button--primary' : 'demo-button--secondary';
|
|
11
|
+
return (
|
|
12
|
+
<button
|
|
13
|
+
type="button"
|
|
14
|
+
className={['demo-button', `demo-button--${size}`, mode].join(' ')}
|
|
15
|
+
style={{ backgroundColor }}
|
|
16
|
+
{...props}
|
|
17
|
+
>
|
|
18
|
+
{label}
|
|
19
|
+
</button>
|
|
20
|
+
);
|
|
21
|
+
};
|
|
@@ -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 { Button } from './Button';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { expect, test } from 'rstack/test';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import { Button } from '../src/Button';
|
|
4
|
+
|
|
5
|
+
test('The button should have correct background color', async () => {
|
|
6
|
+
render(<Button backgroundColor="#ccc" label="Demo Button" />);
|
|
7
|
+
const button = screen.getByText('Demo Button');
|
|
8
|
+
expect(button).toHaveStyle({
|
|
9
|
+
backgroundColor: '#ccc',
|
|
10
|
+
});
|
|
11
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Rstack library
|
|
2
|
+
|
|
3
|
+
## Setup
|
|
4
|
+
|
|
5
|
+
Install the dependencies:
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
{{ packageManager }} install
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Scripts
|
|
12
|
+
|
|
13
|
+
- `{{ packageManager }} run build`: Build the library.
|
|
14
|
+
- `{{ packageManager }} run check`: Run static checks, including lint and format.
|
|
15
|
+
- `{{ packageManager }} run dev`: Build the library in watch mode.
|
|
16
|
+
- `{{ packageManager }} run format`: Format code.
|
|
17
|
+
- `{{ packageManager }} run lint`: Lint code.
|
|
18
|
+
- `{{ packageManager }} run test`: Run tests.
|
|
19
|
+
- `{{ packageManager }} run test:watch`: Run tests in watch mode.
|
|
20
|
+
|
|
21
|
+
## Learn more
|
|
22
|
+
|
|
23
|
+
- [Rstack documentation](https://rstack.rs)
|
|
24
|
+
- [Rslib documentation](https://rslib.rs)
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "rstack-lib-react-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",
|
|
18
|
+
"check": "rs check --type-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-react": "^2.1.0",
|
|
27
|
+
"@testing-library/dom": "^10.4.1",
|
|
28
|
+
"@testing-library/jest-dom": "^7.0.0",
|
|
29
|
+
"@testing-library/react": "^16.3.2",
|
|
30
|
+
"@types/node": "^24.13.3",
|
|
31
|
+
"@types/react": "^19.2.18",
|
|
32
|
+
"@types/react-dom": "^19.2.4",
|
|
33
|
+
"happy-dom": "^20.11.2",
|
|
34
|
+
"react": "^19.2.8",
|
|
35
|
+
"react-dom": "^19.2.8",
|
|
36
|
+
"rstack": "^0.5.0",
|
|
37
|
+
"typescript": "^7.0.2"
|
|
38
|
+
},
|
|
39
|
+
"peerDependencies": {
|
|
40
|
+
"react": ">=18.0.0",
|
|
41
|
+
"react-dom": ">=18.0.0"
|
|
42
|
+
},
|
|
43
|
+
"publishConfig": {
|
|
44
|
+
"access": "public"
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// Rstack configuration guide: https://rstack.rs/config
|
|
2
|
+
import { define } from 'rstack';
|
|
3
|
+
|
|
4
|
+
define.lib(async () => {
|
|
5
|
+
const { pluginReact } = await import('@rsbuild/plugin-react');
|
|
6
|
+
|
|
7
|
+
return {
|
|
8
|
+
bundle: false,
|
|
9
|
+
dts: true,
|
|
10
|
+
source: {
|
|
11
|
+
entry: {
|
|
12
|
+
index: ['./src/**'],
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
output: {
|
|
16
|
+
target: 'web',
|
|
17
|
+
},
|
|
18
|
+
plugins: [pluginReact()],
|
|
19
|
+
};
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
define.test({
|
|
23
|
+
setupFiles: ['./tests/rstest.setup.ts'],
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
define.lint(async () => {
|
|
27
|
+
const { js, ts, reactPlugin, reactHooksPlugin } = await import('rstack/lint');
|
|
28
|
+
|
|
29
|
+
return [
|
|
30
|
+
js.configs.recommended,
|
|
31
|
+
ts.configs.recommended,
|
|
32
|
+
reactPlugin.configs.recommended,
|
|
33
|
+
reactHooksPlugin.configs.recommended,
|
|
34
|
+
];
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
define.fmt({
|
|
38
|
+
singleQuote: true,
|
|
39
|
+
});
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import './button.css';
|
|
2
|
+
|
|
3
|
+
export interface ButtonProps {
|
|
4
|
+
/**
|
|
5
|
+
* Whether the button is primary
|
|
6
|
+
* @default false
|
|
7
|
+
*/
|
|
8
|
+
primary?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Background color of the button
|
|
11
|
+
*/
|
|
12
|
+
backgroundColor?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Size of Button
|
|
15
|
+
* @default 'medium'
|
|
16
|
+
*/
|
|
17
|
+
size?: 'small' | 'medium' | 'large';
|
|
18
|
+
/**
|
|
19
|
+
* Label of the button
|
|
20
|
+
*/
|
|
21
|
+
label: string;
|
|
22
|
+
/**
|
|
23
|
+
* Optional click handler
|
|
24
|
+
*/
|
|
25
|
+
onClick?: () => void;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const Button = ({
|
|
29
|
+
primary = false,
|
|
30
|
+
size = 'medium',
|
|
31
|
+
backgroundColor,
|
|
32
|
+
label,
|
|
33
|
+
...props
|
|
34
|
+
}: ButtonProps) => {
|
|
35
|
+
const mode = primary ? 'demo-button--primary' : 'demo-button--secondary';
|
|
36
|
+
return (
|
|
37
|
+
<button
|
|
38
|
+
type="button"
|
|
39
|
+
className={['demo-button', `demo-button--${size}`, mode].join(' ')}
|
|
40
|
+
style={{ backgroundColor }}
|
|
41
|
+
{...props}
|
|
42
|
+
>
|
|
43
|
+
{label}
|
|
44
|
+
</button>
|
|
45
|
+
);
|
|
46
|
+
};
|
|
@@ -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
|
+
}
|