create-rspack-debug 2.0.0-beta.5 → 2.0.0-beta.7

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.
Files changed (36) hide show
  1. package/dist/index.js +33 -3
  2. package/package.json +3 -3
  3. package/template-react-js/package.json +1 -1
  4. package/template-react-ts/package.json +1 -1
  5. package/template-rstest/AGENTS.md +10 -0
  6. package/template-rstest/react-js/package.json +14 -0
  7. package/template-rstest/react-js/rstest.config.mjs +9 -0
  8. package/template-rstest/react-js/tests/index.test.jsx +9 -0
  9. package/template-rstest/react-js/tests/rstest.setup.js +4 -0
  10. package/template-rstest/react-ts/package.json +14 -0
  11. package/template-rstest/react-ts/rstest.config.mts +9 -0
  12. package/template-rstest/react-ts/tests/index.test.tsx +9 -0
  13. package/template-rstest/react-ts/tests/rstest.setup.ts +4 -0
  14. package/template-rstest/react-ts/tests/tsconfig.json +7 -0
  15. package/template-rstest/vanilla-js/package.json +12 -0
  16. package/template-rstest/vanilla-js/rstest.config.mjs +7 -0
  17. package/template-rstest/vanilla-js/tests/dom.test.js +12 -0
  18. package/template-rstest/vanilla-js/tests/rstest.setup.js +4 -0
  19. package/template-rstest/vanilla-ts/package.json +12 -0
  20. package/template-rstest/vanilla-ts/rstest.config.mts +7 -0
  21. package/template-rstest/vanilla-ts/tests/dom.test.ts +12 -0
  22. package/template-rstest/vanilla-ts/tests/rstest.setup.ts +4 -0
  23. package/template-rstest/vanilla-ts/tests/tsconfig.json +7 -0
  24. package/template-rstest/vue-js/package.json +14 -0
  25. package/template-rstest/vue-js/rstest.config.mjs +9 -0
  26. package/template-rstest/vue-js/tests/index.test.js +9 -0
  27. package/template-rstest/vue-js/tests/rstest.setup.js +4 -0
  28. package/template-rstest/vue-ts/package.json +14 -0
  29. package/template-rstest/vue-ts/rstest.config.mts +9 -0
  30. package/template-rstest/vue-ts/tests/index.test.ts +9 -0
  31. package/template-rstest/vue-ts/tests/rstest.setup.ts +4 -0
  32. package/template-rstest/vue-ts/tests/tsconfig.json +7 -0
  33. package/template-vanilla-js/package.json +1 -1
  34. package/template-vanilla-ts/package.json +1 -1
  35. package/template-vue-js/package.json +2 -2
  36. package/template-vue-ts/package.json +2 -2
package/dist/index.js CHANGED
@@ -1,7 +1,8 @@
1
1
  import node_path from "node:path";
2
2
  import { fileURLToPath } from "node:url";
3
- import { checkCancel, create, select as external_create_rstack_select } from "create-rstack";
3
+ import { checkCancel, copyFolder, create, select as external_create_rstack_select } from "create-rstack";
4
4
  const src_dirname = node_path.dirname(fileURLToPath(import.meta.url));
5
+ const root = node_path.resolve(src_dirname, '..');
5
6
  async function getTemplateName({ template }) {
6
7
  if ('string' == typeof template) {
7
8
  const pair = template.split('-');
@@ -52,8 +53,19 @@ function mapESLintTemplate(templateName) {
52
53
  const language = templateName.split('-')[1];
53
54
  return `vanilla-${language}`;
54
55
  }
56
+ function mapRstestTemplate(templateName) {
57
+ switch(templateName){
58
+ case 'react-js':
59
+ case 'react-ts':
60
+ case 'vue-js':
61
+ case 'vue-ts':
62
+ return templateName;
63
+ default:
64
+ return `vanilla-${templateName.split('-')[1]}`;
65
+ }
66
+ }
55
67
  create({
56
- root: node_path.resolve(src_dirname, '..'),
68
+ root: root,
57
69
  name: 'rspack',
58
70
  templates: [
59
71
  'vanilla-js',
@@ -67,5 +79,23 @@ create({
67
79
  '.npmignore'
68
80
  ],
69
81
  getTemplateName: getTemplateName,
70
- mapESLintTemplate: mapESLintTemplate
82
+ mapESLintTemplate: mapESLintTemplate,
83
+ extraTools: [
84
+ {
85
+ value: 'rstest',
86
+ label: 'Rstest - testing',
87
+ order: 'pre',
88
+ action: ({ templateName, distFolder, addAgentsMdSearchDirs })=>{
89
+ const rstestTemplate = mapRstestTemplate(templateName);
90
+ const toolFolder = node_path.join(root, 'template-rstest');
91
+ const subFolder = node_path.join(toolFolder, rstestTemplate);
92
+ copyFolder({
93
+ from: subFolder,
94
+ to: distFolder,
95
+ isMergePackageJson: true
96
+ });
97
+ addAgentsMdSearchDirs(toolFolder);
98
+ }
99
+ }
100
+ ]
71
101
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-rspack-debug",
3
- "version": "2.0.0-beta.5",
3
+ "version": "2.0.0-beta.7",
4
4
  "homepage": "https://rspack.rs",
5
5
  "bugs": "https://github.com/web-infra-dev/rspack/issues",
6
6
  "repository": {
@@ -20,10 +20,10 @@
20
20
  "bin.js"
21
21
  ],
22
22
  "dependencies": {
23
- "create-rstack": "1.8.0"
23
+ "create-rstack": "1.8.1"
24
24
  },
25
25
  "devDependencies": {
26
- "@rslib/core": "0.19.6",
26
+ "@rslib/core": "0.20.0",
27
27
  "typescript": "^5.9.3"
28
28
  },
29
29
  "publishConfig": {
@@ -14,7 +14,7 @@
14
14
  "devDependencies": {
15
15
  "@rspack/cli": "workspace:*",
16
16
  "@rspack/core": "workspace:*",
17
- "@rspack/dev-server": "~1.2.1",
17
+ "@rspack/dev-server": "2.0.0-beta.5",
18
18
  "@rspack/plugin-react-refresh": "^1.6.1",
19
19
  "@types/react": "^19.2.14",
20
20
  "@types/react-dom": "^19.2.3",
@@ -14,7 +14,7 @@
14
14
  "devDependencies": {
15
15
  "@rspack/cli": "workspace:*",
16
16
  "@rspack/core": "workspace:*",
17
- "@rspack/dev-server": "~1.2.1",
17
+ "@rspack/dev-server": "2.0.0-beta.5",
18
18
  "@rspack/plugin-react-refresh": "^1.6.1",
19
19
  "@types/react": "^19.2.14",
20
20
  "@types/react-dom": "^19.2.3",
@@ -0,0 +1,10 @@
1
+ ## Docs
2
+
3
+ - Rstest: https://rstest.rs/llms.txt
4
+
5
+ ## Tools
6
+
7
+ ### Rstest
8
+
9
+ - Run `{{ packageManager }} run test` to run tests
10
+ - Run `{{ packageManager }} run test:watch` to run tests in watch mode
@@ -0,0 +1,14 @@
1
+ {
2
+ "scripts": {
3
+ "test": "rstest",
4
+ "test:watch": "rstest --watch"
5
+ },
6
+ "devDependencies": {
7
+ "@rsbuild/plugin-react": "^1.4.5",
8
+ "@testing-library/dom": "^10.4.1",
9
+ "@testing-library/jest-dom": "^6.9.1",
10
+ "@testing-library/react": "^16.3.2",
11
+ "@rstest/core": "^0.9.2",
12
+ "happy-dom": "^20.8.3"
13
+ }
14
+ }
@@ -0,0 +1,9 @@
1
+ import { pluginReact } from '@rsbuild/plugin-react';
2
+ import { defineConfig } from '@rstest/core';
3
+
4
+ // Docs: https://rstest.rs/config/
5
+ export default defineConfig({
6
+ plugins: [pluginReact()],
7
+ testEnvironment: 'happy-dom',
8
+ setupFiles: ['./tests/rstest.setup.js'],
9
+ });
@@ -0,0 +1,9 @@
1
+ import { expect, test } from '@rstest/core';
2
+ import { render, screen } from '@testing-library/react';
3
+ import App from '../src/App';
4
+
5
+ test('renders the main page', () => {
6
+ const testMessage = 'Rspack + React';
7
+ render(<App />);
8
+ expect(screen.getByText(testMessage)).toBeInTheDocument();
9
+ });
@@ -0,0 +1,4 @@
1
+ import { expect } from '@rstest/core';
2
+ import * as jestDomMatchers from '@testing-library/jest-dom/matchers';
3
+
4
+ expect.extend(jestDomMatchers);
@@ -0,0 +1,14 @@
1
+ {
2
+ "scripts": {
3
+ "test": "rstest",
4
+ "test:watch": "rstest --watch"
5
+ },
6
+ "devDependencies": {
7
+ "@rsbuild/plugin-react": "^1.4.5",
8
+ "@testing-library/dom": "^10.4.1",
9
+ "@testing-library/jest-dom": "^6.9.1",
10
+ "@testing-library/react": "^16.3.2",
11
+ "@rstest/core": "^0.9.2",
12
+ "happy-dom": "^20.8.3"
13
+ }
14
+ }
@@ -0,0 +1,9 @@
1
+ import { pluginReact } from '@rsbuild/plugin-react';
2
+ import { defineConfig } from '@rstest/core';
3
+
4
+ // Docs: https://rstest.rs/config/
5
+ export default defineConfig({
6
+ plugins: [pluginReact()],
7
+ testEnvironment: 'happy-dom',
8
+ setupFiles: ['./tests/rstest.setup.ts'],
9
+ });
@@ -0,0 +1,9 @@
1
+ import { expect, test } from '@rstest/core';
2
+ import { render, screen } from '@testing-library/react';
3
+ import App from '../src/App';
4
+
5
+ test('renders the main page', () => {
6
+ const testMessage = 'Rspack + React + TypeScript';
7
+ render(<App />);
8
+ expect(screen.getByText(testMessage)).toBeInTheDocument();
9
+ });
@@ -0,0 +1,4 @@
1
+ import { expect } from '@rstest/core';
2
+ import * as jestDomMatchers from '@testing-library/jest-dom/matchers';
3
+
4
+ expect.extend(jestDomMatchers);
@@ -0,0 +1,7 @@
1
+ {
2
+ "extends": "../tsconfig.json",
3
+ "compilerOptions": {
4
+ "types": ["@testing-library/jest-dom"]
5
+ },
6
+ "include": ["./"]
7
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "scripts": {
3
+ "test": "rstest",
4
+ "test:watch": "rstest --watch"
5
+ },
6
+ "devDependencies": {
7
+ "@testing-library/dom": "^10.4.1",
8
+ "@testing-library/jest-dom": "^6.9.1",
9
+ "@rstest/core": "^0.9.2",
10
+ "happy-dom": "^20.8.3"
11
+ }
12
+ }
@@ -0,0 +1,7 @@
1
+ import { defineConfig } from '@rstest/core';
2
+
3
+ // Docs: https://rstest.rs/config/
4
+ export default defineConfig({
5
+ testEnvironment: 'happy-dom',
6
+ setupFiles: ['./tests/rstest.setup.js'],
7
+ });
@@ -0,0 +1,12 @@
1
+ import { expect, test } from '@rstest/core';
2
+ import { screen } from '@testing-library/dom';
3
+
4
+ test('test dom', () => {
5
+ document.body.innerHTML = `
6
+ <span data-testid="not-empty"><span data-testid="empty"></span></span>
7
+ <div data-testid="visible">Visible Example</div>
8
+ `;
9
+
10
+ expect(screen.queryByTestId('not-empty')).toBeInTheDocument();
11
+ expect(screen.getByText('Visible Example')).toBeVisible();
12
+ });
@@ -0,0 +1,4 @@
1
+ import { expect } from '@rstest/core';
2
+ import * as jestDomMatchers from '@testing-library/jest-dom/matchers';
3
+
4
+ expect.extend(jestDomMatchers);
@@ -0,0 +1,12 @@
1
+ {
2
+ "scripts": {
3
+ "test": "rstest",
4
+ "test:watch": "rstest --watch"
5
+ },
6
+ "devDependencies": {
7
+ "@testing-library/dom": "^10.4.1",
8
+ "@testing-library/jest-dom": "^6.9.1",
9
+ "@rstest/core": "^0.9.2",
10
+ "happy-dom": "^20.8.3"
11
+ }
12
+ }
@@ -0,0 +1,7 @@
1
+ import { defineConfig } from '@rstest/core';
2
+
3
+ // Docs: https://rstest.rs/config/
4
+ export default defineConfig({
5
+ testEnvironment: 'happy-dom',
6
+ setupFiles: ['./tests/rstest.setup.ts'],
7
+ });
@@ -0,0 +1,12 @@
1
+ import { expect, test } from '@rstest/core';
2
+ import { screen } from '@testing-library/dom';
3
+
4
+ test('test dom', () => {
5
+ document.body.innerHTML = `
6
+ <span data-testid="not-empty"><span data-testid="empty"></span></span>
7
+ <div data-testid="visible">Visible Example</div>
8
+ `;
9
+
10
+ expect(screen.queryByTestId('not-empty')).toBeInTheDocument();
11
+ expect(screen.getByText('Visible Example')).toBeVisible();
12
+ });
@@ -0,0 +1,4 @@
1
+ import { expect } from '@rstest/core';
2
+ import * as jestDomMatchers from '@testing-library/jest-dom/matchers';
3
+
4
+ expect.extend(jestDomMatchers);
@@ -0,0 +1,7 @@
1
+ {
2
+ "extends": "../tsconfig.json",
3
+ "compilerOptions": {
4
+ "types": ["@testing-library/jest-dom"]
5
+ },
6
+ "include": ["./"]
7
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "scripts": {
3
+ "test": "rstest",
4
+ "test:watch": "rstest --watch"
5
+ },
6
+ "devDependencies": {
7
+ "@rsbuild/plugin-vue": "^1.2.6",
8
+ "@testing-library/dom": "^10.4.1",
9
+ "@testing-library/jest-dom": "^6.9.1",
10
+ "@testing-library/vue": "^8.1.0",
11
+ "@rstest/core": "^0.9.2",
12
+ "happy-dom": "^20.8.3"
13
+ }
14
+ }
@@ -0,0 +1,9 @@
1
+ import { pluginVue } from '@rsbuild/plugin-vue';
2
+ import { defineConfig } from '@rstest/core';
3
+
4
+ // Docs: https://rstest.rs/config/
5
+ export default defineConfig({
6
+ plugins: [pluginVue()],
7
+ testEnvironment: 'happy-dom',
8
+ setupFiles: ['./tests/rstest.setup.js'],
9
+ });
@@ -0,0 +1,9 @@
1
+ import { expect, test } from '@rstest/core';
2
+ import { render, screen } from '@testing-library/vue';
3
+ import App from '../src/App.vue';
4
+
5
+ test('renders the main page', () => {
6
+ const testMessage = 'Rspack + Vue';
7
+ render(App);
8
+ expect(screen.getByText(testMessage)).toBeInTheDocument();
9
+ });
@@ -0,0 +1,4 @@
1
+ import { expect } from '@rstest/core';
2
+ import * as jestDomMatchers from '@testing-library/jest-dom/matchers';
3
+
4
+ expect.extend(jestDomMatchers);
@@ -0,0 +1,14 @@
1
+ {
2
+ "scripts": {
3
+ "test": "rstest",
4
+ "test:watch": "rstest --watch"
5
+ },
6
+ "devDependencies": {
7
+ "@rsbuild/plugin-vue": "^1.2.6",
8
+ "@testing-library/dom": "^10.4.1",
9
+ "@testing-library/jest-dom": "^6.9.1",
10
+ "@testing-library/vue": "^8.1.0",
11
+ "@rstest/core": "^0.9.2",
12
+ "happy-dom": "^20.8.3"
13
+ }
14
+ }
@@ -0,0 +1,9 @@
1
+ import { pluginVue } from '@rsbuild/plugin-vue';
2
+ import { defineConfig } from '@rstest/core';
3
+
4
+ // Docs: https://rstest.rs/config/
5
+ export default defineConfig({
6
+ plugins: [pluginVue()],
7
+ testEnvironment: 'happy-dom',
8
+ setupFiles: ['./tests/rstest.setup.ts'],
9
+ });
@@ -0,0 +1,9 @@
1
+ import { expect, test } from '@rstest/core';
2
+ import { render, screen } from '@testing-library/vue';
3
+ import App from '../src/App.vue';
4
+
5
+ test('renders the main page', () => {
6
+ const testMessage = 'Rspack + Vue';
7
+ render(App);
8
+ expect(screen.getByText(testMessage)).toBeInTheDocument();
9
+ });
@@ -0,0 +1,4 @@
1
+ import { expect } from '@rstest/core';
2
+ import * as jestDomMatchers from '@testing-library/jest-dom/matchers';
3
+
4
+ expect.extend(jestDomMatchers);
@@ -0,0 +1,7 @@
1
+ {
2
+ "extends": "../tsconfig.json",
3
+ "compilerOptions": {
4
+ "types": ["@testing-library/jest-dom"]
5
+ },
6
+ "include": ["./"]
7
+ }
@@ -10,6 +10,6 @@
10
10
  "devDependencies": {
11
11
  "@rspack/cli": "workspace:*",
12
12
  "@rspack/core": "workspace:*",
13
- "@rspack/dev-server": "~1.2.1"
13
+ "@rspack/dev-server": "2.0.0-beta.5"
14
14
  }
15
15
  }
@@ -10,7 +10,7 @@
10
10
  "devDependencies": {
11
11
  "@rspack/cli": "workspace:*",
12
12
  "@rspack/core": "workspace:*",
13
- "@rspack/dev-server": "~1.2.1",
13
+ "@rspack/dev-server": "2.0.0-beta.5",
14
14
  "typescript": "^5.9.3"
15
15
  }
16
16
  }
@@ -8,12 +8,12 @@
8
8
  "preview": "rspack preview"
9
9
  },
10
10
  "dependencies": {
11
- "vue": "^3.5.29"
11
+ "vue": "^3.5.30"
12
12
  },
13
13
  "devDependencies": {
14
14
  "@rspack/cli": "workspace:*",
15
15
  "@rspack/core": "workspace:*",
16
- "@rspack/dev-server": "~1.2.1",
16
+ "@rspack/dev-server": "2.0.0-beta.5",
17
17
  "rspack-vue-loader": "^17.5.0"
18
18
  }
19
19
  }
@@ -8,12 +8,12 @@
8
8
  "preview": "rspack preview"
9
9
  },
10
10
  "dependencies": {
11
- "vue": "^3.5.29"
11
+ "vue": "^3.5.30"
12
12
  },
13
13
  "devDependencies": {
14
14
  "@rspack/cli": "workspace:*",
15
15
  "@rspack/core": "workspace:*",
16
- "@rspack/dev-server": "~1.2.1",
16
+ "@rspack/dev-server": "2.0.0-beta.5",
17
17
  "typescript": "^5.9.3",
18
18
  "rspack-vue-loader": "^17.5.0"
19
19
  }