create-rstack 3.3.2 → 3.3.4
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/README.md +1 -0
- package/dist/index.js +21 -2
- package/package.json +4 -4
- package/template-app-lit/package.json +2 -2
- package/template-app-lit-ts/package.json +3 -3
- package/template-app-preact/package.json +2 -2
- package/template-app-preact-ts/package.json +3 -3
- package/template-app-react/package.json +2 -2
- package/template-app-react-ts/package.json +4 -4
- package/template-app-solid/package.json +2 -2
- package/template-app-solid-ts/package.json +3 -3
- package/template-app-svelte/package.json +2 -2
- package/template-app-svelte-ts/package.json +3 -3
- package/template-app-vanilla/package.json +2 -2
- package/template-app-vanilla-ts/package.json +3 -3
- package/template-app-vue/package.json +2 -2
- package/template-app-vue-ts/package.json +3 -3
- package/template-doc/package.json +3 -3
- package/template-doc-i18n/package.json +3 -3
- package/template-lib-node/package.json +1 -1
- package/template-lib-node-ts/package.json +2 -2
- package/template-lib-react/package.json +3 -3
- package/template-lib-react-ts/package.json +4 -4
- package/template-lib-solid/package.json +2 -2
- package/template-lib-solid-ts/package.json +3 -3
- package/template-lib-svelte/package.json +2 -2
- package/template-lib-svelte-ts/package.json +3 -3
- package/template-lib-vue/package.json +2 -2
- package/template-lib-vue-ts/package.json +3 -3
- package/template-turborepo/README.md +31 -0
- package/template-turborepo/apps/web/package.json +27 -0
- package/template-turborepo/apps/web/rstack.config.ts +15 -0
- package/template-turborepo/apps/web/src/App.tsx +17 -0
- package/template-turborepo/apps/web/src/index.css +27 -0
- package/template-turborepo/apps/web/src/index.tsx +13 -0
- package/template-turborepo/apps/web/tests/app.test.tsx +11 -0
- package/template-turborepo/apps/web/tests/rstest.setup.ts +4 -0
- package/template-turborepo/apps/web/tests/tsconfig.json +7 -0
- package/template-turborepo/apps/web/tsconfig.json +4 -0
- package/template-turborepo/apps/web/turbo.json +8 -0
- package/template-turborepo/gitignore +16 -0
- package/template-turborepo/package.json +20 -0
- package/template-turborepo/packages/tsconfig/base.json +22 -0
- package/template-turborepo/packages/tsconfig/package.json +11 -0
- package/template-turborepo/packages/ui/package.json +31 -0
- package/template-turborepo/packages/ui/rstack.config.ts +20 -0
- package/template-turborepo/packages/ui/src/button.tsx +8 -0
- package/template-turborepo/packages/ui/tests/button.test.tsx +18 -0
- package/template-turborepo/packages/ui/tests/rstest.setup.ts +4 -0
- package/template-turborepo/packages/ui/tests/tsconfig.json +8 -0
- package/template-turborepo/packages/ui/tsconfig.json +7 -0
- package/template-turborepo/pnpm-workspace.yaml +3 -0
- package/template-turborepo/rstack.config.ts +30 -0
- package/template-turborepo/turbo.json +18 -0
package/README.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -28,7 +28,8 @@ const templateNames = [
|
|
|
28
28
|
'lib-solid',
|
|
29
29
|
'lib-solid-ts',
|
|
30
30
|
'doc',
|
|
31
|
-
'doc-i18n'
|
|
31
|
+
'doc-i18n',
|
|
32
|
+
'turborepo'
|
|
32
33
|
];
|
|
33
34
|
const resolveTemplateName = (template)=>{
|
|
34
35
|
if (!templateNames.includes(template)) throw new Error(`Invalid input: template "${template}" not found.`);
|
|
@@ -36,7 +37,7 @@ const resolveTemplateName = (template)=>{
|
|
|
36
37
|
};
|
|
37
38
|
const getTemplateName = async ({ template })=>{
|
|
38
39
|
if ('string' == typeof template) {
|
|
39
|
-
if (/^(?:app|lib|doc)(?:-|$)/u.test(template)) return resolveTemplateName(template);
|
|
40
|
+
if (/^(?:app|lib|doc|turborepo)(?:-|$)/u.test(template)) return resolveTemplateName(template);
|
|
40
41
|
return template;
|
|
41
42
|
}
|
|
42
43
|
const projectType = checkCancel(await create_toolkit_select({
|
|
@@ -53,9 +54,26 @@ const getTemplateName = async ({ template })=>{
|
|
|
53
54
|
{
|
|
54
55
|
value: 'doc',
|
|
55
56
|
label: 'Documentation'
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
value: 'monorepo',
|
|
60
|
+
label: 'Monorepo'
|
|
56
61
|
}
|
|
57
62
|
]
|
|
58
63
|
}));
|
|
64
|
+
if ('monorepo' === projectType) {
|
|
65
|
+
const monorepoType = checkCancel(await create_toolkit_select({
|
|
66
|
+
message: 'Select monorepo tool',
|
|
67
|
+
options: [
|
|
68
|
+
{
|
|
69
|
+
value: 'turborepo',
|
|
70
|
+
label: 'Turborepo',
|
|
71
|
+
hint: 'pnpm'
|
|
72
|
+
}
|
|
73
|
+
]
|
|
74
|
+
}));
|
|
75
|
+
return resolveTemplateName(monorepoType);
|
|
76
|
+
}
|
|
59
77
|
if ('doc' === projectType) {
|
|
60
78
|
const documentationType = checkCancel(await create_toolkit_select({
|
|
61
79
|
message: 'Choose documentation language setup',
|
|
@@ -208,5 +226,6 @@ await create({
|
|
|
208
226
|
templates: templateNames,
|
|
209
227
|
builtinTools: [],
|
|
210
228
|
getTemplateName: getTemplateName,
|
|
229
|
+
getPackageManager: ({ templateName })=>'turborepo' === templateName ? 'pnpm' : void 0,
|
|
211
230
|
onGitResolved: injectStagedSetup
|
|
212
231
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-rstack",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.4",
|
|
4
4
|
"description": "Create a new Rstack project",
|
|
5
5
|
"homepage": "https://rstack.rs",
|
|
6
6
|
"bugs": {
|
|
@@ -29,11 +29,11 @@
|
|
|
29
29
|
"bin.js"
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@rstackjs/create-toolkit": "2.2.
|
|
32
|
+
"@rstackjs/create-toolkit": "2.2.6"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@types/node": "^26.
|
|
36
|
-
"rstack": "0.7.
|
|
35
|
+
"@types/node": "^26.5.0",
|
|
36
|
+
"rstack": "0.7.4",
|
|
37
37
|
"typescript": "^7.0.2"
|
|
38
38
|
},
|
|
39
39
|
"engines": {
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
"@rsbuild/plugin-preact": "^2.1.0",
|
|
21
21
|
"@testing-library/jest-dom": "^7.0.1",
|
|
22
22
|
"@testing-library/preact": "^3.2.4",
|
|
23
|
-
"@types/node": "^26.
|
|
24
|
-
"happy-dom": "^20.
|
|
25
|
-
"rstack": "^0.7.
|
|
23
|
+
"@types/node": "^26.5.0",
|
|
24
|
+
"happy-dom": "^20.14.0",
|
|
25
|
+
"rstack": "^0.7.4",
|
|
26
26
|
"typescript": "^7.0.2"
|
|
27
27
|
}
|
|
28
28
|
}
|
|
@@ -22,11 +22,11 @@
|
|
|
22
22
|
"@testing-library/dom": "^10.4.1",
|
|
23
23
|
"@testing-library/jest-dom": "^7.0.1",
|
|
24
24
|
"@testing-library/react": "^16.3.3",
|
|
25
|
-
"@types/node": "^26.
|
|
25
|
+
"@types/node": "^26.5.0",
|
|
26
26
|
"@types/react": "^19.2.18",
|
|
27
|
-
"@types/react-dom": "^19.2.
|
|
28
|
-
"happy-dom": "^20.
|
|
29
|
-
"rstack": "^0.7.
|
|
27
|
+
"@types/react-dom": "^19.2.7",
|
|
28
|
+
"happy-dom": "^20.14.0",
|
|
29
|
+
"rstack": "^0.7.4",
|
|
30
30
|
"typescript": "^7.0.2"
|
|
31
31
|
}
|
|
32
32
|
}
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
"@rsbuild/plugin-solid": "^1.2.2",
|
|
22
22
|
"@solidjs/testing-library": "^0.8.10",
|
|
23
23
|
"@testing-library/jest-dom": "^7.0.1",
|
|
24
|
-
"@types/node": "^26.
|
|
25
|
-
"happy-dom": "^20.
|
|
26
|
-
"rstack": "^0.7.
|
|
24
|
+
"@types/node": "^26.5.0",
|
|
25
|
+
"happy-dom": "^20.14.0",
|
|
26
|
+
"rstack": "^0.7.4",
|
|
27
27
|
"typescript": "^7.0.2"
|
|
28
28
|
}
|
|
29
29
|
}
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"@rsbuild/plugin-svelte": "^2.0.1",
|
|
21
21
|
"@testing-library/jest-dom": "^7.0.1",
|
|
22
22
|
"@testing-library/svelte": "^5.4.2",
|
|
23
|
-
"happy-dom": "^20.
|
|
23
|
+
"happy-dom": "^20.14.0",
|
|
24
24
|
"prettier-plugin-svelte": "^4.1.1",
|
|
25
|
-
"rstack": "^0.7.
|
|
25
|
+
"rstack": "^0.7.4"
|
|
26
26
|
}
|
|
27
27
|
}
|
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
"@rsbuild/plugin-svelte": "^2.0.1",
|
|
21
21
|
"@testing-library/jest-dom": "^7.0.1",
|
|
22
22
|
"@testing-library/svelte": "^5.4.2",
|
|
23
|
-
"@types/node": "^26.
|
|
24
|
-
"happy-dom": "^20.
|
|
23
|
+
"@types/node": "^26.5.0",
|
|
24
|
+
"happy-dom": "^20.14.0",
|
|
25
25
|
"prettier-plugin-svelte": "^4.1.1",
|
|
26
|
-
"rstack": "^0.7.
|
|
26
|
+
"rstack": "^0.7.4",
|
|
27
27
|
"svelte-check": "^4.7.6",
|
|
28
28
|
"typescript": "^6.0.3"
|
|
29
29
|
}
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
"devDependencies": {
|
|
17
17
|
"@testing-library/dom": "^10.4.1",
|
|
18
18
|
"@testing-library/jest-dom": "^7.0.1",
|
|
19
|
-
"@types/node": "^26.
|
|
20
|
-
"happy-dom": "^20.
|
|
21
|
-
"rstack": "^0.7.
|
|
19
|
+
"@types/node": "^26.5.0",
|
|
20
|
+
"happy-dom": "^20.14.0",
|
|
21
|
+
"rstack": "^0.7.4",
|
|
22
22
|
"typescript": "^7.0.2"
|
|
23
23
|
}
|
|
24
24
|
}
|
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"@rsbuild/plugin-vue": "^2.0.1",
|
|
21
21
|
"@testing-library/jest-dom": "^7.0.1",
|
|
22
|
-
"@types/node": "^26.
|
|
22
|
+
"@types/node": "^26.5.0",
|
|
23
23
|
"@vue/test-utils": "^2.5.0",
|
|
24
|
-
"happy-dom": "^20.
|
|
25
|
-
"rstack": "^0.7.
|
|
24
|
+
"happy-dom": "^20.14.0",
|
|
25
|
+
"rstack": "^0.7.4",
|
|
26
26
|
"typescript": "^6.0.3",
|
|
27
27
|
"vue-tsc": "^3.3.11"
|
|
28
28
|
}
|
|
@@ -13,12 +13,12 @@
|
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
15
|
"@rspress/core": "^2.0.21",
|
|
16
|
-
"@types/node": "^26.
|
|
16
|
+
"@types/node": "^26.5.0",
|
|
17
17
|
"@types/react": "^19.2.18",
|
|
18
|
-
"@types/react-dom": "^19.2.
|
|
18
|
+
"@types/react-dom": "^19.2.7",
|
|
19
19
|
"react": "^19.2.8",
|
|
20
20
|
"react-dom": "^19.2.8",
|
|
21
|
-
"rstack": "^0.7.
|
|
21
|
+
"rstack": "^0.7.4",
|
|
22
22
|
"typescript": "^7.0.2"
|
|
23
23
|
}
|
|
24
24
|
}
|
|
@@ -13,12 +13,12 @@
|
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
15
|
"@rspress/core": "^2.0.21",
|
|
16
|
-
"@types/node": "^26.
|
|
16
|
+
"@types/node": "^26.5.0",
|
|
17
17
|
"@types/react": "^19.2.18",
|
|
18
|
-
"@types/react-dom": "^19.2.
|
|
18
|
+
"@types/react-dom": "^19.2.7",
|
|
19
19
|
"react": "^19.2.8",
|
|
20
20
|
"react-dom": "^19.2.8",
|
|
21
|
-
"rstack": "^0.7.
|
|
21
|
+
"rstack": "^0.7.4",
|
|
22
22
|
"typescript": "^7.0.2"
|
|
23
23
|
}
|
|
24
24
|
}
|
|
@@ -21,11 +21,11 @@
|
|
|
21
21
|
"@testing-library/dom": "^10.4.1",
|
|
22
22
|
"@testing-library/jest-dom": "^7.0.1",
|
|
23
23
|
"@testing-library/react": "^16.3.3",
|
|
24
|
-
"@types/react-dom": "^19.2.
|
|
25
|
-
"happy-dom": "^20.
|
|
24
|
+
"@types/react-dom": "^19.2.7",
|
|
25
|
+
"happy-dom": "^20.14.0",
|
|
26
26
|
"react": "^19.2.8",
|
|
27
27
|
"react-dom": "^19.2.8",
|
|
28
|
-
"rstack": "^0.7.
|
|
28
|
+
"rstack": "^0.7.4"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"react": ">=18.0.0",
|
|
@@ -27,13 +27,13 @@
|
|
|
27
27
|
"@testing-library/dom": "^10.4.1",
|
|
28
28
|
"@testing-library/jest-dom": "^7.0.1",
|
|
29
29
|
"@testing-library/react": "^16.3.3",
|
|
30
|
-
"@types/node": "^26.
|
|
30
|
+
"@types/node": "^26.5.0",
|
|
31
31
|
"@types/react": "^19.2.18",
|
|
32
|
-
"@types/react-dom": "^19.2.
|
|
33
|
-
"happy-dom": "^20.
|
|
32
|
+
"@types/react-dom": "^19.2.7",
|
|
33
|
+
"happy-dom": "^20.14.0",
|
|
34
34
|
"react": "^19.2.8",
|
|
35
35
|
"react-dom": "^19.2.8",
|
|
36
|
-
"rstack": "^0.7.
|
|
36
|
+
"rstack": "^0.7.4",
|
|
37
37
|
"typescript": "^7.0.2"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"@rsbuild/plugin-solid": "^1.2.2",
|
|
27
27
|
"@solidjs/testing-library": "^0.8.10",
|
|
28
28
|
"@testing-library/jest-dom": "^7.0.1",
|
|
29
|
-
"happy-dom": "^20.
|
|
30
|
-
"rstack": "^0.7.
|
|
29
|
+
"happy-dom": "^20.14.0",
|
|
30
|
+
"rstack": "^0.7.4",
|
|
31
31
|
"solid-js": "^1.9.15"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
"@rsbuild/plugin-solid": "^1.2.2",
|
|
29
29
|
"@solidjs/testing-library": "^0.8.10",
|
|
30
30
|
"@testing-library/jest-dom": "^7.0.1",
|
|
31
|
-
"@types/node": "^26.
|
|
32
|
-
"happy-dom": "^20.
|
|
33
|
-
"rstack": "^0.7.
|
|
31
|
+
"@types/node": "^26.5.0",
|
|
32
|
+
"happy-dom": "^20.14.0",
|
|
33
|
+
"rstack": "^0.7.4",
|
|
34
34
|
"solid-js": "^1.9.15",
|
|
35
35
|
"typescript": "^7.0.2"
|
|
36
36
|
},
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"@rsbuild/plugin-svelte": "^2.0.1",
|
|
21
|
-
"happy-dom": "^20.
|
|
21
|
+
"happy-dom": "^20.14.0",
|
|
22
22
|
"prettier-plugin-svelte": "^4.1.1",
|
|
23
|
-
"rstack": "^0.7.
|
|
23
|
+
"rstack": "^0.7.4",
|
|
24
24
|
"svelte": "^5.57.0"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
@@ -24,10 +24,10 @@
|
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@rsbuild/plugin-svelte": "^2.0.1",
|
|
27
|
-
"@types/node": "^26.
|
|
28
|
-
"happy-dom": "^20.
|
|
27
|
+
"@types/node": "^26.5.0",
|
|
28
|
+
"happy-dom": "^20.14.0",
|
|
29
29
|
"prettier-plugin-svelte": "^4.1.1",
|
|
30
|
-
"rstack": "^0.7.
|
|
30
|
+
"rstack": "^0.7.4",
|
|
31
31
|
"svelte": "^5.57.0",
|
|
32
32
|
"svelte-check": "^4.7.6",
|
|
33
33
|
"svelte2tsx": "^0.7.61",
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"@rsbuild/plugin-vue": "^2.0.1",
|
|
21
21
|
"@testing-library/jest-dom": "^7.0.1",
|
|
22
22
|
"@vue/test-utils": "^2.5.0",
|
|
23
|
-
"happy-dom": "^20.
|
|
24
|
-
"rstack": "^0.7.
|
|
23
|
+
"happy-dom": "^20.14.0",
|
|
24
|
+
"rstack": "^0.7.4",
|
|
25
25
|
"vue": "^3.5.42"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
@@ -25,10 +25,10 @@
|
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@rsbuild/plugin-vue": "^2.0.1",
|
|
27
27
|
"@testing-library/jest-dom": "^7.0.1",
|
|
28
|
-
"@types/node": "^26.
|
|
28
|
+
"@types/node": "^26.5.0",
|
|
29
29
|
"@vue/test-utils": "^2.5.0",
|
|
30
|
-
"happy-dom": "^20.
|
|
31
|
-
"rstack": "^0.7.
|
|
30
|
+
"happy-dom": "^20.14.0",
|
|
31
|
+
"rstack": "^0.7.4",
|
|
32
32
|
"typescript": "^6.0.3",
|
|
33
33
|
"vue": "^3.5.42",
|
|
34
34
|
"vue-tsc": "^3.3.11"
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Rstack + Turborepo
|
|
2
|
+
|
|
3
|
+
## Setup
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
pnpm install
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Structure
|
|
10
|
+
|
|
11
|
+
- `apps/web`: React application.
|
|
12
|
+
- `packages/ui`: Shared UI components.
|
|
13
|
+
- `packages/tsconfig`: Shared TypeScript configuration.
|
|
14
|
+
|
|
15
|
+
## Scripts
|
|
16
|
+
|
|
17
|
+
Run from the repository root:
|
|
18
|
+
|
|
19
|
+
- `pnpm run build`: Build all packages.
|
|
20
|
+
- `pnpm run dev`: Start development.
|
|
21
|
+
- `pnpm run test`: Run tests.
|
|
22
|
+
- `pnpm run check`: Run lint, formatting, and TypeScript checks.
|
|
23
|
+
- `pnpm run lint`: Lint the workspace.
|
|
24
|
+
- `pnpm run format`: Format the workspace.
|
|
25
|
+
|
|
26
|
+
Run `pnpm run build` before `pnpm run check`.
|
|
27
|
+
|
|
28
|
+
## Learn more
|
|
29
|
+
|
|
30
|
+
- [Rstack CLI monorepo guide](https://rstack.rs/guide/monorepo)
|
|
31
|
+
- [Turborepo documentation](https://turborepo.com/docs)
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "web",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "rs build",
|
|
8
|
+
"dev": "rs dev",
|
|
9
|
+
"preview": "rs preview",
|
|
10
|
+
"test": "rs test"
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"@repo/ui": "workspace:^",
|
|
14
|
+
"react": "^19.2.8",
|
|
15
|
+
"react-dom": "^19.2.8"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"@repo/tsconfig": "workspace:^",
|
|
19
|
+
"@rsbuild/plugin-react": "^2.1.0",
|
|
20
|
+
"@testing-library/dom": "^10.4.1",
|
|
21
|
+
"@testing-library/jest-dom": "^7.0.1",
|
|
22
|
+
"@testing-library/react": "^16.3.3",
|
|
23
|
+
"@types/react": "^19.2.18",
|
|
24
|
+
"@types/react-dom": "^19.2.7",
|
|
25
|
+
"happy-dom": "^20.14.0"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Configuration guide: https://rstack.rs/config
|
|
2
|
+
import { define } from 'rstack';
|
|
3
|
+
|
|
4
|
+
define.app(async () => {
|
|
5
|
+
const { pluginReact } = await import('@rsbuild/plugin-react');
|
|
6
|
+
return {
|
|
7
|
+
plugins: [pluginReact()],
|
|
8
|
+
html: { title: 'Web | Rstack' },
|
|
9
|
+
server: { port: 3000 },
|
|
10
|
+
};
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
define.test({
|
|
14
|
+
setupFiles: ['./tests/rstest.setup.ts'],
|
|
15
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Button } from '@repo/ui/button';
|
|
2
|
+
|
|
3
|
+
export function App() {
|
|
4
|
+
return (
|
|
5
|
+
<main>
|
|
6
|
+
<h1>Web</h1>
|
|
7
|
+
<p>Turborepo + Rstack CLI</p>
|
|
8
|
+
<p>Edit apps/web/src/App.tsx to get started.</p>
|
|
9
|
+
<Button onClick={() => window.alert('Hello from @repo/ui!')}>
|
|
10
|
+
Shared button
|
|
11
|
+
</Button>
|
|
12
|
+
<nav>
|
|
13
|
+
<a href="https://rstack.rs">Rstack documentation</a>
|
|
14
|
+
</nav>
|
|
15
|
+
</main>
|
|
16
|
+
);
|
|
17
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
body {
|
|
2
|
+
margin: 0;
|
|
3
|
+
font-family: system-ui, sans-serif;
|
|
4
|
+
color: #202124;
|
|
5
|
+
background: #f8f9fa;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
main {
|
|
9
|
+
max-width: 640px;
|
|
10
|
+
margin: 15vh auto;
|
|
11
|
+
padding: 24px;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
button {
|
|
15
|
+
padding: 10px 16px;
|
|
16
|
+
border: 0;
|
|
17
|
+
border-radius: 8px;
|
|
18
|
+
color: white;
|
|
19
|
+
background: #5755d9;
|
|
20
|
+
cursor: pointer;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
nav {
|
|
24
|
+
display: flex;
|
|
25
|
+
gap: 20px;
|
|
26
|
+
margin-top: 24px;
|
|
27
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { StrictMode } from 'react';
|
|
2
|
+
import { createRoot } from 'react-dom/client';
|
|
3
|
+
import { App } from './App';
|
|
4
|
+
import './index.css';
|
|
5
|
+
|
|
6
|
+
const root = document.getElementById('root');
|
|
7
|
+
if (root) {
|
|
8
|
+
createRoot(root).render(
|
|
9
|
+
<StrictMode>
|
|
10
|
+
<App />
|
|
11
|
+
</StrictMode>,
|
|
12
|
+
);
|
|
13
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { expect, test } from 'rstack/test';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import { App } from '../src/App';
|
|
4
|
+
|
|
5
|
+
test('renders the web app with the shared UI package', () => {
|
|
6
|
+
render(<App />);
|
|
7
|
+
expect(screen.getByRole('heading', { name: 'Web' })).toBeInTheDocument();
|
|
8
|
+
expect(
|
|
9
|
+
screen.getByRole('button', { name: 'Shared button' }),
|
|
10
|
+
).toBeInTheDocument();
|
|
11
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "rstack-turborepo",
|
|
3
|
+
"private": true,
|
|
4
|
+
"type": "module",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"build": "turbo run build",
|
|
7
|
+
"check": "rs check --type-check",
|
|
8
|
+
"dev": "turbo watch dev",
|
|
9
|
+
"format": "rs fmt",
|
|
10
|
+
"lint": "rs lint",
|
|
11
|
+
"test": "turbo run test"
|
|
12
|
+
},
|
|
13
|
+
"devDependencies": {
|
|
14
|
+
"@types/node": "^26.5.0",
|
|
15
|
+
"rstack": "^0.7.4",
|
|
16
|
+
"turbo": "^2.10.12",
|
|
17
|
+
"typescript": "^7.0.2"
|
|
18
|
+
},
|
|
19
|
+
"packageManager": "pnpm@12.3.4"
|
|
20
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"lib": ["DOM", "DOM.Iterable", "ES2022"],
|
|
5
|
+
"target": "ES2022",
|
|
6
|
+
"module": "ESNext",
|
|
7
|
+
"moduleResolution": "bundler",
|
|
8
|
+
"moduleDetection": "force",
|
|
9
|
+
"jsx": "react-jsx",
|
|
10
|
+
"strict": true,
|
|
11
|
+
"noEmit": true,
|
|
12
|
+
"skipLibCheck": true,
|
|
13
|
+
"isolatedModules": true,
|
|
14
|
+
"verbatimModuleSyntax": true,
|
|
15
|
+
"resolveJsonModule": true,
|
|
16
|
+
"allowImportingTsExtensions": true,
|
|
17
|
+
"noUncheckedIndexedAccess": true,
|
|
18
|
+
"noUnusedLocals": true,
|
|
19
|
+
"noUnusedParameters": true,
|
|
20
|
+
"types": ["rstack/types", "node"]
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@repo/ui",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"exports": {
|
|
7
|
+
"./button": {
|
|
8
|
+
"types": "./dist/button.d.ts",
|
|
9
|
+
"default": "./dist/button.js"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"scripts": {
|
|
13
|
+
"build": "rs lib",
|
|
14
|
+
"dev": "rs lib --no-clean",
|
|
15
|
+
"test": "rs test"
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"react": "^19.2.8"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@repo/tsconfig": "workspace:^",
|
|
22
|
+
"@rsbuild/plugin-react": "^2.1.0",
|
|
23
|
+
"@testing-library/dom": "^10.4.1",
|
|
24
|
+
"@testing-library/jest-dom": "^7.0.1",
|
|
25
|
+
"@testing-library/react": "^16.3.3",
|
|
26
|
+
"@types/react": "^19.2.18",
|
|
27
|
+
"@types/react-dom": "^19.2.7",
|
|
28
|
+
"happy-dom": "^20.14.0",
|
|
29
|
+
"react-dom": "^19.2.8"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// 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
|
+
return {
|
|
7
|
+
dts: true,
|
|
8
|
+
source: {
|
|
9
|
+
entry: { button: './src/button.tsx' },
|
|
10
|
+
},
|
|
11
|
+
output: {
|
|
12
|
+
target: 'web',
|
|
13
|
+
},
|
|
14
|
+
plugins: [pluginReact()],
|
|
15
|
+
};
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
define.test({
|
|
19
|
+
setupFiles: ['./tests/rstest.setup.ts'],
|
|
20
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { expect, test } from 'rstack/test';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import { Button } from '../src/button';
|
|
4
|
+
|
|
5
|
+
test('defaults to a non-submitting button and forwards props', () => {
|
|
6
|
+
render(<Button disabled>Save</Button>);
|
|
7
|
+
const button = screen.getByRole('button', { name: 'Save' });
|
|
8
|
+
expect(button).toHaveAttribute('type', 'button');
|
|
9
|
+
expect(button).toBeDisabled();
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
test('allows a submit button', () => {
|
|
13
|
+
render(<Button type="submit">Submit</Button>);
|
|
14
|
+
expect(screen.getByRole('button', { name: 'Submit' })).toHaveAttribute(
|
|
15
|
+
'type',
|
|
16
|
+
'submit',
|
|
17
|
+
);
|
|
18
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Configuration guide: https://rstack.rs/config
|
|
2
|
+
import { define } from 'rstack';
|
|
3
|
+
|
|
4
|
+
define.lint(({ js, ts, reactPlugin, reactHooksPlugin, rstestPlugin }) => [
|
|
5
|
+
js.configs.recommended,
|
|
6
|
+
ts.configs.recommendedTypeChecked,
|
|
7
|
+
reactPlugin.configs.recommended,
|
|
8
|
+
reactHooksPlugin.configs.recommended,
|
|
9
|
+
{
|
|
10
|
+
files: ['**/*.{test,spec}.?(c|m)[jt]s?(x)'],
|
|
11
|
+
...rstestPlugin.configs.recommended,
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
languageOptions: {
|
|
15
|
+
parserOptions: {
|
|
16
|
+
project: [
|
|
17
|
+
'./apps/*/tsconfig.json',
|
|
18
|
+
'./apps/*/tests/tsconfig.json',
|
|
19
|
+
'./packages/*/tsconfig.json',
|
|
20
|
+
'./packages/*/tests/tsconfig.json',
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
]);
|
|
26
|
+
|
|
27
|
+
define.fmt({
|
|
28
|
+
singleQuote: true,
|
|
29
|
+
ignorePatterns: ['**/dist/**', '**/.turbo/**'],
|
|
30
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://turborepo.dev/schema.json",
|
|
3
|
+
"ui": "tui",
|
|
4
|
+
"tasks": {
|
|
5
|
+
"build": {
|
|
6
|
+
"dependsOn": ["^build"],
|
|
7
|
+
"inputs": ["$TURBO_DEFAULT$", ".env*"],
|
|
8
|
+
"outputs": ["dist/**"]
|
|
9
|
+
},
|
|
10
|
+
"dev": {
|
|
11
|
+
"dependsOn": ["^dev"],
|
|
12
|
+
"cache": false
|
|
13
|
+
},
|
|
14
|
+
"test": {
|
|
15
|
+
"dependsOn": ["^build"]
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|