create-rstack 3.4.3 → 3.4.5
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 +2 -0
- package/dist/index.js +18 -3
- 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 +3 -3
- package/template-app-preact-ts/package.json +4 -4
- package/template-app-react/package.json +2 -2
- package/template-app-react-ts/package.json +3 -3
- 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 +3 -3
- package/template-app-vue-ts/package.json +5 -5
- package/template-doc/package.json +2 -2
- package/template-doc-i18n/package.json +2 -2
- package/template-lib-node/package.json +2 -2
- package/template-lib-node-ts/package.json +3 -3
- package/template-lib-react/package.json +2 -2
- package/template-lib-react-ts/package.json +3 -3
- 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 +3 -3
- package/template-lib-vue-ts/package.json +5 -5
- package/template-nx/.env +2 -0
- package/template-nx/README.md +37 -0
- package/template-nx/apps/web/package.json +26 -0
- package/template-nx/apps/web/rstack.config.ts +13 -0
- package/template-nx/apps/web/src/App.tsx +17 -0
- package/template-nx/apps/web/src/index.css +27 -0
- package/template-nx/apps/web/src/index.tsx +13 -0
- package/template-nx/apps/web/tests/app.test.tsx +11 -0
- package/template-nx/apps/web/tests/rstest.setup.ts +4 -0
- package/template-nx/apps/web/tests/tsconfig.json +7 -0
- package/template-nx/apps/web/tsconfig.json +4 -0
- package/template-nx/gitignore +17 -0
- package/template-nx/nx.json +33 -0
- package/template-nx/package.json +20 -0
- package/template-nx/packages/ui/package.json +39 -0
- package/template-nx/packages/ui/rstack.config.ts +20 -0
- package/template-nx/packages/ui/src/button.tsx +8 -0
- package/template-nx/packages/ui/tests/button.test.tsx +18 -0
- package/template-nx/packages/ui/tests/rstest.setup.ts +4 -0
- package/template-nx/packages/ui/tests/tsconfig.json +8 -0
- package/template-nx/packages/ui/tsconfig.json +7 -0
- package/template-nx/pnpm-workspace.yaml +6 -0
- package/template-nx/rstack.config.ts +29 -0
- package/template-nx/tsconfig.base.json +22 -0
- package/template-pnpm/README.md +33 -0
- package/template-pnpm/apps/web/package.json +26 -0
- package/template-pnpm/apps/web/rstack.config.ts +13 -0
- package/template-pnpm/apps/web/src/App.tsx +17 -0
- package/template-pnpm/apps/web/src/index.css +27 -0
- package/template-pnpm/apps/web/src/index.tsx +13 -0
- package/template-pnpm/apps/web/tests/app.test.tsx +11 -0
- package/template-pnpm/apps/web/tests/rstest.setup.ts +4 -0
- package/template-pnpm/apps/web/tests/tsconfig.json +7 -0
- package/template-pnpm/apps/web/tsconfig.json +4 -0
- package/template-pnpm/gitignore +13 -0
- package/template-pnpm/package.json +19 -0
- package/template-pnpm/packages/ui/package.json +30 -0
- package/template-pnpm/packages/ui/rstack.config.ts +20 -0
- package/template-pnpm/packages/ui/src/button.tsx +8 -0
- package/template-pnpm/packages/ui/tests/button.test.tsx +18 -0
- package/template-pnpm/packages/ui/tests/rstest.setup.ts +4 -0
- package/template-pnpm/packages/ui/tests/tsconfig.json +8 -0
- package/template-pnpm/packages/ui/tsconfig.json +7 -0
- package/template-pnpm/pnpm-workspace.yaml +3 -0
- package/template-pnpm/rstack.config.ts +29 -0
- package/template-pnpm/tsconfig.base.json +22 -0
- package/template-turborepo/apps/web/package.json +1 -1
- package/template-turborepo/package.json +4 -4
- package/template-turborepo/packages/ui/package.json +1 -1
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "./node_modules/nx/schemas/nx-schema.json",
|
|
3
|
+
"namedInputs": {
|
|
4
|
+
"default": [
|
|
5
|
+
"{projectRoot}/**/*",
|
|
6
|
+
{ "fileset": "{projectRoot}/.{env*,*.env}", "includeIgnored": true },
|
|
7
|
+
"sharedGlobals"
|
|
8
|
+
],
|
|
9
|
+
"sharedGlobals": [
|
|
10
|
+
"{workspaceRoot}/tsconfig.base.json",
|
|
11
|
+
"{workspaceRoot}/rstack.config.ts",
|
|
12
|
+
"{workspaceRoot}/pnpm-workspace.yaml",
|
|
13
|
+
{ "fileset": "{workspaceRoot}/.{env*,*.env}", "includeIgnored": true }
|
|
14
|
+
]
|
|
15
|
+
},
|
|
16
|
+
"targetDefaults": {
|
|
17
|
+
"build": {
|
|
18
|
+
"dependsOn": ["^build"],
|
|
19
|
+
"cache": true,
|
|
20
|
+
"inputs": ["default", "^default"],
|
|
21
|
+
"outputs": ["{projectRoot}/dist"]
|
|
22
|
+
},
|
|
23
|
+
"dev": {
|
|
24
|
+
"dependsOn": ["^build"],
|
|
25
|
+
"continuous": true
|
|
26
|
+
},
|
|
27
|
+
"test": {
|
|
28
|
+
"dependsOn": ["^build"],
|
|
29
|
+
"cache": true,
|
|
30
|
+
"inputs": ["default", "^default"]
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "rstack-nx",
|
|
3
|
+
"private": true,
|
|
4
|
+
"type": "module",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"build": "nx run-many -t build",
|
|
7
|
+
"check": "rs check --type-check",
|
|
8
|
+
"dev": "nx run-many -t dev",
|
|
9
|
+
"format": "rs fmt",
|
|
10
|
+
"lint": "rs lint",
|
|
11
|
+
"test": "nx run-many -t test"
|
|
12
|
+
},
|
|
13
|
+
"devDependencies": {
|
|
14
|
+
"@types/node": "^26.6.5",
|
|
15
|
+
"nx": "^23.3.0",
|
|
16
|
+
"rstack": "^0.8.5",
|
|
17
|
+
"typescript": "^7.0.2"
|
|
18
|
+
},
|
|
19
|
+
"packageManager": "pnpm@12.11.2"
|
|
20
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
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 --watch --no-clean",
|
|
15
|
+
"test": "rs test"
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"react": "^19.3.0"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@rsbuild/plugin-react": "^2.1.1",
|
|
22
|
+
"@testing-library/dom": "^10.4.2",
|
|
23
|
+
"@testing-library/jest-dom": "^7.0.1",
|
|
24
|
+
"@testing-library/react": "^16.3.3",
|
|
25
|
+
"@types/react": "^19.3.0",
|
|
26
|
+
"@types/react-dom": "^19.3.0",
|
|
27
|
+
"happy-dom": "^21.0.1",
|
|
28
|
+
"react-dom": "^19.3.0"
|
|
29
|
+
},
|
|
30
|
+
"nx": {
|
|
31
|
+
"targets": {
|
|
32
|
+
"dev": {
|
|
33
|
+
"dependsOn": [
|
|
34
|
+
"build"
|
|
35
|
+
]
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -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,29 @@
|
|
|
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
|
+
});
|
|
@@ -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,33 @@
|
|
|
1
|
+
# pnpm workspace + Rstack
|
|
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
|
+
- `tsconfig.base.json`: Shared TypeScript configuration.
|
|
14
|
+
|
|
15
|
+
## Scripts
|
|
16
|
+
|
|
17
|
+
Run from the repository root:
|
|
18
|
+
|
|
19
|
+
- `pnpm run build`: Build all packages in dependency order.
|
|
20
|
+
- `pnpm run dev`: Build shared packages, then start the web app and watch the shared UI package.
|
|
21
|
+
- `pnpm run test`: Build shared packages, then 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
|
+
Use `pnpm --filter <package-name> <script>` to run a script in one package.
|
|
29
|
+
|
|
30
|
+
## Learn more
|
|
31
|
+
|
|
32
|
+
- [Rstack CLI monorepo guide](https://rstack.rs/guide/monorepo)
|
|
33
|
+
- [pnpm workspace documentation](https://pnpm.io/workspaces)
|
|
@@ -0,0 +1,26 @@
|
|
|
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.3.0",
|
|
15
|
+
"react-dom": "^19.3.0"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"@rsbuild/plugin-react": "^2.1.1",
|
|
19
|
+
"@testing-library/dom": "^10.4.2",
|
|
20
|
+
"@testing-library/jest-dom": "^7.0.1",
|
|
21
|
+
"@testing-library/react": "^16.3.3",
|
|
22
|
+
"@types/react": "^19.3.0",
|
|
23
|
+
"@types/react-dom": "^19.3.0",
|
|
24
|
+
"happy-dom": "^21.0.1"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
};
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
define.test({
|
|
12
|
+
setupFiles: ['./tests/rstest.setup.ts'],
|
|
13
|
+
});
|
|
@@ -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>pnpm workspace + 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,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "rstack-pnpm",
|
|
3
|
+
"private": true,
|
|
4
|
+
"type": "module",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"build": "pnpm -r build",
|
|
7
|
+
"check": "rs check --type-check",
|
|
8
|
+
"dev": "pnpm --filter \"./packages/**\" build && pnpm -r --parallel dev",
|
|
9
|
+
"format": "rs fmt",
|
|
10
|
+
"lint": "rs lint",
|
|
11
|
+
"test": "pnpm --filter \"./packages/**\" build && pnpm -r test"
|
|
12
|
+
},
|
|
13
|
+
"devDependencies": {
|
|
14
|
+
"@types/node": "^26.6.5",
|
|
15
|
+
"rstack": "^0.8.5",
|
|
16
|
+
"typescript": "^7.0.2"
|
|
17
|
+
},
|
|
18
|
+
"packageManager": "pnpm@12.11.2"
|
|
19
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
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 --watch --no-clean",
|
|
15
|
+
"test": "rs test"
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"react": "^19.3.0"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@rsbuild/plugin-react": "^2.1.1",
|
|
22
|
+
"@testing-library/dom": "^10.4.2",
|
|
23
|
+
"@testing-library/jest-dom": "^7.0.1",
|
|
24
|
+
"@testing-library/react": "^16.3.3",
|
|
25
|
+
"@types/react": "^19.3.0",
|
|
26
|
+
"@types/react-dom": "^19.3.0",
|
|
27
|
+
"happy-dom": "^21.0.1",
|
|
28
|
+
"react-dom": "^19.3.0"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -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,29 @@
|
|
|
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
|
+
});
|
|
@@ -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
|
+
}
|
|
@@ -11,10 +11,10 @@
|
|
|
11
11
|
"test": "turbo run test"
|
|
12
12
|
},
|
|
13
13
|
"devDependencies": {
|
|
14
|
-
"@types/node": "^26.6.
|
|
15
|
-
"rstack": "^0.8.
|
|
16
|
-
"turbo": "^2.11.
|
|
14
|
+
"@types/node": "^26.6.5",
|
|
15
|
+
"rstack": "^0.8.5",
|
|
16
|
+
"turbo": "^2.11.8",
|
|
17
17
|
"typescript": "^7.0.2"
|
|
18
18
|
},
|
|
19
|
-
"packageManager": "pnpm@12.
|
|
19
|
+
"packageManager": "pnpm@12.11.2"
|
|
20
20
|
}
|