create-rsbuild 0.2.5 → 0.2.6

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,7 @@
1
1
  # create-rsbuild
2
2
 
3
+ ## 0.2.6
4
+
3
5
  ## 0.2.5
4
6
 
5
7
  ## 0.2.4
package/dist/index.js CHANGED
@@ -93,7 +93,7 @@ async function main() {
93
93
  const commonFolder = import_path.default.join(packageRoot, `template-common`);
94
94
  const distFolder = import_path.default.join(cwd, targetDir);
95
95
  copyFolder(commonFolder, distFolder, version);
96
- copyFolder(srcFolder, distFolder, version);
96
+ copyFolder(srcFolder, distFolder, version, import_path.default.basename(targetDir));
97
97
  const nextSteps = [
98
98
  `cd ${targetDir}`,
99
99
  `${pkgManager} i`,
@@ -102,7 +102,7 @@ async function main() {
102
102
  (0, import_prompts.note)(nextSteps.join("\n"), "Next steps");
103
103
  (0, import_prompts.outro)("Done.");
104
104
  }
105
- function copyFolder(src, dist, version) {
105
+ function copyFolder(src, dist, version, name) {
106
106
  const renameFiles = {
107
107
  gitignore: ".gitignore"
108
108
  };
@@ -120,14 +120,17 @@ function copyFolder(src, dist, version) {
120
120
  } else {
121
121
  import_fs.default.copyFileSync(srcFile, distFile);
122
122
  if (file === "package.json") {
123
- replaceVersion(distFile, version);
123
+ updatePackageJson(distFile, version, name);
124
124
  }
125
125
  }
126
126
  }
127
127
  }
128
- const replaceVersion = (pkgJsonPath, version) => {
128
+ const updatePackageJson = (pkgJsonPath, version, name) => {
129
129
  let content = import_fs.default.readFileSync(pkgJsonPath, "utf-8");
130
130
  content = content.replace(/workspace:\*/g, `^${version}`);
131
- import_fs.default.writeFileSync(pkgJsonPath, content);
131
+ const pkg = JSON.parse(content);
132
+ if (name)
133
+ pkg.name = name;
134
+ import_fs.default.writeFileSync(pkgJsonPath, JSON.stringify(pkg, null, 2));
132
135
  };
133
136
  main();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-rsbuild",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
4
4
  "description": "Create a new Rsbuild project",
5
5
  "homepage": "https://rsbuild.dev",
6
6
  "repository": {
@@ -23,7 +23,7 @@
23
23
  },
24
24
  "dependencies": {
25
25
  "@clack/prompts": "^0.7.0",
26
- "rslog": "^1.1.1"
26
+ "rslog": "^1.1.2"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@types/node": "16.x",