create-rsbuild 0.0.11 → 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,11 @@
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
+
3
9
  ## 0.0.11
4
10
 
5
11
  ### 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",
@@ -75,13 +77,13 @@ async function main() {
75
77
  const srcFolder = import_path.default.join(packageRoot, `template-${framework}-${language}`);
76
78
  const commonFolder = import_path.default.join(packageRoot, `template-common`);
77
79
  const distFolder = import_path.default.join(cwd, targetDir);
78
- copyFolder(commonFolder, distFolder);
79
- copyFolder(srcFolder, distFolder);
80
+ copyFolder(commonFolder, distFolder, version);
81
+ copyFolder(srcFolder, distFolder, version);
80
82
  const nextSteps = [`cd ${targetDir}`, "npm i", "npm run dev"];
81
83
  (0, import_prompts.note)(nextSteps.join("\n"), "Next steps");
82
84
  (0, import_prompts.outro)("Done.");
83
85
  }
84
- function copyFolder(src, dist) {
86
+ function copyFolder(src, dist, version) {
85
87
  const renameFiles = {
86
88
  gitignore: ".gitignore"
87
89
  };
@@ -95,10 +97,18 @@ function copyFolder(src, dist) {
95
97
  const distFile = renameFiles[file] ? import_path.default.resolve(dist, renameFiles[file]) : import_path.default.resolve(dist, file);
96
98
  const stat = import_fs.default.statSync(srcFile);
97
99
  if (stat.isDirectory()) {
98
- copyFolder(srcFile, distFile);
100
+ copyFolder(srcFile, distFile, version);
99
101
  } else {
100
102
  import_fs.default.copyFileSync(srcFile, distFile);
103
+ if (file === "package.json") {
104
+ replaceVersion(distFile, version);
105
+ }
101
106
  }
102
107
  }
103
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
+ };
104
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.11",
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
  }
@@ -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": "^0.0.10",
16
- "@rsbuild/plugin-react": "^0.0.10"
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": "^0.0.10",
16
- "@rsbuild/plugin-react": "^0.0.10",
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
  }
@@ -11,7 +11,7 @@
11
11
  "svelte": "^4.2.2"
12
12
  },
13
13
  "devDependencies": {
14
- "@rsbuild/core": "^0.0.10",
15
- "@rsbuild/plugin-svelte": "^0.0.10"
14
+ "@rsbuild/core": "workspace:*",
15
+ "@rsbuild/plugin-svelte": "workspace:*"
16
16
  }
17
17
  }
@@ -11,8 +11,8 @@
11
11
  "svelte": "^4.2.2"
12
12
  },
13
13
  "devDependencies": {
14
- "@rsbuild/core": "^0.0.10",
15
- "@rsbuild/plugin-svelte": "^0.0.10",
16
- "typescript": "^5.0.0"
14
+ "@rsbuild/core": "workspace:*",
15
+ "@rsbuild/plugin-svelte": "workspace:*",
16
+ "typescript": "^5.2.2"
17
17
  }
18
18
  }
@@ -11,7 +11,7 @@
11
11
  "vue": "^2.7.14"
12
12
  },
13
13
  "devDependencies": {
14
- "@rsbuild/core": "^0.0.10",
15
- "@rsbuild/plugin-vue2": "^0.0.10"
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": "^0.0.10",
15
- "@rsbuild/plugin-vue2": "^0.0.10",
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": "^0.0.10",
15
- "@rsbuild/plugin-vue": "^0.0.10"
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": "^0.0.10",
15
- "@rsbuild/plugin-vue": "^0.0.10",
16
- "typescript": "^5.0.0"
14
+ "@rsbuild/core": "workspace:*",
15
+ "@rsbuild/plugin-vue": "workspace:*",
16
+ "typescript": "^5.2.2"
17
17
  }
18
18
  }