create-rsbuild 0.0.10 → 0.0.12

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/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # create-rsbuild
2
2
 
3
+ ## 0.0.12
4
+
5
+ ### Patch Changes
6
+
7
+ - 50c2711: feat(create-rsbuild): always use the latest version
8
+
9
+ ## 0.0.11
10
+
11
+ ### Patch Changes
12
+
13
+ - 8a4cf1e: fix(create-rsbuild): incorrect preview command
14
+ - db6b547: feat(create-rsbuild): templates depend on latest version of Rsbuild
15
+
3
16
  ## 0.0.10
4
17
 
5
18
  ### Patch Changes
package/dist/index.js CHANGED
@@ -40,6 +40,8 @@ async function main() {
40
40
  import_rslog.logger.greet("◆ Create Rsbuild Project");
41
41
  const cwd = process.cwd();
42
42
  const packageRoot = import_path.default.resolve(__dirname, "..");
43
+ const packageJsonPath = import_path.default.join(packageRoot, "package.json");
44
+ const { version } = require(packageJsonPath);
43
45
  let targetDir = await (0, import_prompts.text)({
44
46
  message: "Input target folder",
45
47
  placeholder: "my-project",
@@ -59,7 +61,8 @@ async function main() {
59
61
  options: [
60
62
  { value: "react", label: "React" },
61
63
  { value: "vue3", label: "Vue 3" },
62
- { value: "vue2", label: "Vue 2" }
64
+ { value: "vue2", label: "Vue 2" },
65
+ { value: "svelte", label: "Svelte" }
63
66
  ]
64
67
  });
65
68
  checkCancel(framework);
@@ -74,13 +77,13 @@ async function main() {
74
77
  const srcFolder = import_path.default.join(packageRoot, `template-${framework}-${language}`);
75
78
  const commonFolder = import_path.default.join(packageRoot, `template-common`);
76
79
  const distFolder = import_path.default.join(cwd, targetDir);
77
- copyFolder(commonFolder, distFolder);
78
- copyFolder(srcFolder, distFolder);
80
+ copyFolder(commonFolder, distFolder, version);
81
+ copyFolder(srcFolder, distFolder, version);
79
82
  const nextSteps = [`cd ${targetDir}`, "npm i", "npm run dev"];
80
83
  (0, import_prompts.note)(nextSteps.join("\n"), "Next steps");
81
84
  (0, import_prompts.outro)("Done.");
82
85
  }
83
- function copyFolder(src, dist) {
86
+ function copyFolder(src, dist, version) {
84
87
  const renameFiles = {
85
88
  gitignore: ".gitignore"
86
89
  };
@@ -94,10 +97,18 @@ function copyFolder(src, dist) {
94
97
  const distFile = renameFiles[file] ? import_path.default.resolve(dist, renameFiles[file]) : import_path.default.resolve(dist, file);
95
98
  const stat = import_fs.default.statSync(srcFile);
96
99
  if (stat.isDirectory()) {
97
- copyFolder(srcFile, distFile);
100
+ copyFolder(srcFile, distFile, version);
98
101
  } else {
99
102
  import_fs.default.copyFileSync(srcFile, distFile);
103
+ if (file === "package.json") {
104
+ replaceVersion(distFile, version);
105
+ }
100
106
  }
101
107
  }
102
108
  }
109
+ const replaceVersion = (pkgJsonPath, version) => {
110
+ let content = import_fs.default.readFileSync(pkgJsonPath, "utf-8");
111
+ content = content.replace(/workspace:\*/g, `^${version}`);
112
+ import_fs.default.writeFileSync(pkgJsonPath, content);
113
+ };
103
114
  main();
package/package.json CHANGED
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "name": "create-rsbuild",
3
+ "version": "0.0.12",
3
4
  "description": "Create a new Rsbuild project",
4
5
  "homepage": "https://rsbuild.dev",
5
6
  "repository": {
@@ -8,34 +9,33 @@
8
9
  "directory": "packages/create-rsbuild"
9
10
  },
10
11
  "license": "MIT",
11
- "version": "0.0.10",
12
- "types": "./dist/index.d.ts",
13
- "main": "./dist/index.js",
14
- "bin": {
15
- "create-rsbuild": "./dist/index.js"
16
- },
17
12
  "exports": {
18
13
  ".": {
19
14
  "types": "./dist/index.d.ts",
20
15
  "default": "./dist/index.js"
21
16
  }
22
17
  },
18
+ "main": "./dist/index.js",
19
+ "types": "./dist/index.d.ts",
20
+ "bin": {
21
+ "create-rsbuild": "./dist/index.js"
22
+ },
23
23
  "dependencies": {
24
24
  "@clack/prompts": "^0.7.0",
25
25
  "rslog": "^1.1.0"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@types/node": "^16",
29
- "typescript": "^5"
29
+ "typescript": "^5.2.2"
30
30
  },
31
31
  "publishConfig": {
32
- "registry": "https://registry.npmjs.org/",
33
32
  "access": "public",
34
- "provenance": true
33
+ "provenance": true,
34
+ "registry": "https://registry.npmjs.org/"
35
35
  },
36
36
  "scripts": {
37
- "dev": "modern build --watch",
38
37
  "build": "modern build",
38
+ "dev": "modern build --watch",
39
39
  "start": "node ./dist/index.js"
40
40
  }
41
41
  }
@@ -12,18 +12,18 @@ pnpm install
12
12
 
13
13
  Start the dev server:
14
14
 
15
- ```
15
+ ```bash
16
16
  pnpm dev
17
17
  ```
18
18
 
19
19
  Build the app for production:
20
20
 
21
- ```
21
+ ```bash
22
22
  pnpm build
23
23
  ```
24
24
 
25
25
  Preview the production build locally:
26
26
 
27
- ```
28
- pnpm serve
27
+ ```bash
28
+ pnpm preview
29
29
  ```
@@ -8,11 +8,11 @@
8
8
  "preview": "rsbuild preview"
9
9
  },
10
10
  "dependencies": {
11
- "react": "^18",
12
- "react-dom": "^18"
11
+ "react": "^18.2.0",
12
+ "react-dom": "^18.2.0"
13
13
  },
14
14
  "devDependencies": {
15
- "@rsbuild/core": "nightly",
16
- "@rsbuild/plugin-react": "nightly"
15
+ "@rsbuild/core": "workspace:*",
16
+ "@rsbuild/plugin-react": "workspace:*"
17
17
  }
18
18
  }
@@ -8,14 +8,14 @@
8
8
  "preview": "rsbuild preview"
9
9
  },
10
10
  "dependencies": {
11
- "react": "^18",
12
- "react-dom": "^18"
11
+ "react": "^18.2.0",
12
+ "react-dom": "^18.2.0"
13
13
  },
14
14
  "devDependencies": {
15
- "@rsbuild/core": "nightly",
16
- "@rsbuild/plugin-react": "nightly",
15
+ "@rsbuild/core": "workspace:*",
16
+ "@rsbuild/plugin-react": "workspace:*",
17
17
  "@types/react": "^18",
18
18
  "@types/react-dom": "^18",
19
- "typescript": "^5.0.0"
19
+ "typescript": "^5.2.2"
20
20
  }
21
21
  }
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "rsbuild-svelte-js",
3
+ "private": true,
4
+ "version": "1.0.0",
5
+ "scripts": {
6
+ "dev": "rsbuild dev",
7
+ "build": "rsbuild build",
8
+ "preview": "rsbuild preview"
9
+ },
10
+ "dependencies": {
11
+ "svelte": "^4.2.2"
12
+ },
13
+ "devDependencies": {
14
+ "@rsbuild/core": "workspace:*",
15
+ "@rsbuild/plugin-svelte": "workspace:*"
16
+ }
17
+ }
@@ -0,0 +1,6 @@
1
+ import { defineConfig } from '@rsbuild/core';
2
+ import { pluginSvelte } from '@rsbuild/plugin-svelte';
3
+
4
+ export default defineConfig({
5
+ plugins: [pluginSvelte()],
6
+ });
@@ -0,0 +1,33 @@
1
+ <script>
2
+ export let name;
3
+ </script>
4
+
5
+ <main>
6
+ <h1>Hello {name}!</h1>
7
+ <p>
8
+ Visit the <a href="https://svelte.dev/tutorial">Svelte tutorial</a> to learn
9
+ how to build Svelte apps.
10
+ </p>
11
+ </main>
12
+
13
+ <style>
14
+ main {
15
+ text-align: center;
16
+ padding: 1em;
17
+ max-width: 240px;
18
+ margin: 0 auto;
19
+ }
20
+
21
+ @media (min-width: 640px) {
22
+ main {
23
+ max-width: none;
24
+ }
25
+ }
26
+
27
+ h1 {
28
+ color: #ff3e00;
29
+ text-transform: uppercase;
30
+ font-size: 4em;
31
+ font-weight: 100;
32
+ }
33
+ </style>
@@ -0,0 +1,68 @@
1
+ html,
2
+ body {
3
+ position: relative;
4
+ width: 100%;
5
+ height: 100%;
6
+ }
7
+
8
+ body {
9
+ color: #333;
10
+ margin: 0;
11
+ padding: 8px;
12
+ box-sizing: border-box;
13
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
14
+ Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
15
+ }
16
+
17
+ a {
18
+ color: rgb(0, 100, 200);
19
+ text-decoration: none;
20
+ }
21
+
22
+ a:hover {
23
+ text-decoration: underline;
24
+ }
25
+
26
+ a:visited {
27
+ color: rgb(0, 80, 160);
28
+ }
29
+
30
+ label {
31
+ display: block;
32
+ }
33
+
34
+ input,
35
+ button,
36
+ select,
37
+ textarea {
38
+ font-family: inherit;
39
+ font-size: inherit;
40
+ -webkit-padding: 0.4em 0;
41
+ padding: 0.4em;
42
+ margin: 0 0 0.5em 0;
43
+ box-sizing: border-box;
44
+ border: 1px solid #ccc;
45
+ border-radius: 2px;
46
+ }
47
+
48
+ input:disabled {
49
+ color: #ccc;
50
+ }
51
+
52
+ button {
53
+ color: #333;
54
+ background-color: #f4f4f4;
55
+ outline: none;
56
+ }
57
+
58
+ button:disabled {
59
+ color: #999;
60
+ }
61
+
62
+ button:not(:disabled):active {
63
+ background-color: #ddd;
64
+ }
65
+
66
+ button:focus {
67
+ border-color: #666;
68
+ }
@@ -0,0 +1,12 @@
1
+ import './global.css';
2
+
3
+ import App from './App.svelte';
4
+
5
+ const app = new App({
6
+ target: document.body,
7
+ props: {
8
+ name: 'world',
9
+ },
10
+ });
11
+
12
+ export default app;
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "rsbuild-svelte-ts",
3
+ "private": true,
4
+ "version": "1.0.0",
5
+ "scripts": {
6
+ "dev": "rsbuild dev",
7
+ "build": "rsbuild build",
8
+ "preview": "rsbuild preview"
9
+ },
10
+ "dependencies": {
11
+ "svelte": "^4.2.2"
12
+ },
13
+ "devDependencies": {
14
+ "@rsbuild/core": "workspace:*",
15
+ "@rsbuild/plugin-svelte": "workspace:*",
16
+ "typescript": "^5.2.2"
17
+ }
18
+ }
@@ -0,0 +1,6 @@
1
+ import { defineConfig } from '@rsbuild/core';
2
+ import { pluginSvelte } from '@rsbuild/plugin-svelte';
3
+
4
+ export default defineConfig({
5
+ plugins: [pluginSvelte()],
6
+ });
@@ -0,0 +1,33 @@
1
+ <script>
2
+ export let name;
3
+ </script>
4
+
5
+ <main>
6
+ <h1>Hello {name}!</h1>
7
+ <p>
8
+ Visit the <a href="https://svelte.dev/tutorial">Svelte tutorial</a> to learn
9
+ how to build Svelte apps.
10
+ </p>
11
+ </main>
12
+
13
+ <style>
14
+ main {
15
+ text-align: center;
16
+ padding: 1em;
17
+ max-width: 240px;
18
+ margin: 0 auto;
19
+ }
20
+
21
+ @media (min-width: 640px) {
22
+ main {
23
+ max-width: none;
24
+ }
25
+ }
26
+
27
+ h1 {
28
+ color: #ff3e00;
29
+ text-transform: uppercase;
30
+ font-size: 4em;
31
+ font-weight: 100;
32
+ }
33
+ </style>
@@ -0,0 +1,68 @@
1
+ html,
2
+ body {
3
+ position: relative;
4
+ width: 100%;
5
+ height: 100%;
6
+ }
7
+
8
+ body {
9
+ color: #333;
10
+ margin: 0;
11
+ padding: 8px;
12
+ box-sizing: border-box;
13
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
14
+ Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
15
+ }
16
+
17
+ a {
18
+ color: rgb(0, 100, 200);
19
+ text-decoration: none;
20
+ }
21
+
22
+ a:hover {
23
+ text-decoration: underline;
24
+ }
25
+
26
+ a:visited {
27
+ color: rgb(0, 80, 160);
28
+ }
29
+
30
+ label {
31
+ display: block;
32
+ }
33
+
34
+ input,
35
+ button,
36
+ select,
37
+ textarea {
38
+ font-family: inherit;
39
+ font-size: inherit;
40
+ -webkit-padding: 0.4em 0;
41
+ padding: 0.4em;
42
+ margin: 0 0 0.5em 0;
43
+ box-sizing: border-box;
44
+ border: 1px solid #ccc;
45
+ border-radius: 2px;
46
+ }
47
+
48
+ input:disabled {
49
+ color: #ccc;
50
+ }
51
+
52
+ button {
53
+ color: #333;
54
+ background-color: #f4f4f4;
55
+ outline: none;
56
+ }
57
+
58
+ button:disabled {
59
+ color: #999;
60
+ }
61
+
62
+ button:not(:disabled):active {
63
+ background-color: #ddd;
64
+ }
65
+
66
+ button:focus {
67
+ border-color: #666;
68
+ }
@@ -0,0 +1,12 @@
1
+ import './global.css';
2
+
3
+ import App from './App.svelte';
4
+
5
+ const app = new App({
6
+ target: document.body,
7
+ props: {
8
+ name: 'world',
9
+ },
10
+ });
11
+
12
+ export default app;
@@ -0,0 +1,13 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "lib": ["DOM", "ES2020"],
5
+ "module": "ESNext",
6
+ "strict": true,
7
+ "skipLibCheck": true,
8
+ "isolatedModules": true,
9
+ "resolveJsonModule": true,
10
+ "moduleResolution": "bundler"
11
+ },
12
+ "include": ["src"]
13
+ }
@@ -11,7 +11,7 @@
11
11
  "vue": "^2.7.14"
12
12
  },
13
13
  "devDependencies": {
14
- "@rsbuild/core": "nightly",
15
- "@rsbuild/plugin-vue2": "nightly"
14
+ "@rsbuild/core": "workspace:*",
15
+ "@rsbuild/plugin-vue2": "workspace:*"
16
16
  }
17
17
  }
@@ -11,8 +11,8 @@
11
11
  "vue": "^2.7.14"
12
12
  },
13
13
  "devDependencies": {
14
- "@rsbuild/core": "nightly",
15
- "@rsbuild/plugin-vue2": "nightly",
16
- "typescript": "^5.0.0"
14
+ "@rsbuild/core": "workspace:*",
15
+ "@rsbuild/plugin-vue2": "workspace:*",
16
+ "typescript": "^5.2.2"
17
17
  }
18
18
  }
@@ -8,10 +8,10 @@
8
8
  "preview": "rsbuild preview"
9
9
  },
10
10
  "dependencies": {
11
- "vue": "^3.0.0"
11
+ "vue": "^3.3.4"
12
12
  },
13
13
  "devDependencies": {
14
- "@rsbuild/core": "nightly",
15
- "@rsbuild/plugin-vue": "nightly"
14
+ "@rsbuild/core": "workspace:*",
15
+ "@rsbuild/plugin-vue": "workspace:*"
16
16
  }
17
17
  }
@@ -8,11 +8,11 @@
8
8
  "preview": "rsbuild preview"
9
9
  },
10
10
  "dependencies": {
11
- "vue": "^3.0.0"
11
+ "vue": "^3.3.4"
12
12
  },
13
13
  "devDependencies": {
14
- "@rsbuild/core": "nightly",
15
- "@rsbuild/plugin-vue": "nightly",
16
- "typescript": "^5.0.0"
14
+ "@rsbuild/core": "workspace:*",
15
+ "@rsbuild/plugin-vue": "workspace:*",
16
+ "typescript": "^5.2.2"
17
17
  }
18
18
  }