create-cookbook 1.0.0-beta.72 → 1.0.0-beta.74

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 (2) hide show
  1. package/index.mjs +13 -6
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -93,7 +93,7 @@ const color = gradient(["cyan", "#2d9b87"]);
93
93
  exit(1);
94
94
  }
95
95
 
96
- consola.start(color("Extracting package"));
96
+ consola.start(color("Extracting package.."));
97
97
  try {
98
98
  await compressing.tgz.uncompress(join(tempspace, "package.tgz"), tempspace);
99
99
  consola.success(color("Package extracted"));
@@ -115,7 +115,7 @@ const color = gradient(["cyan", "#2d9b87"]);
115
115
  if (!existsSync(installPath)) mkdirSync(installPath, { recursive: true });
116
116
  await move(execPath, join(installPath, execName), { overwrite: true });
117
117
  } else {
118
- consola.start(color("Finding suitable installation location"));
118
+ consola.start(color("Finding suitable installation location.."));
119
119
 
120
120
  let targetPath = "";
121
121
  if (process.platform === "win32") {
@@ -157,18 +157,25 @@ const color = gradient(["cyan", "#2d9b87"]);
157
157
  const targetFile = join(targetPath, "co");
158
158
  if (existsSync(targetFile)) rmSync(targetFile);
159
159
 
160
- await move(execPath, targetFile, { overwrite: true });
160
+ try {
161
+ consola.info(color(`Moving executable to PATH: ${targetPath}`));
162
+ await move(execPath, targetFile, { overwrite: true });
163
+ } catch (error) {
164
+ consola.error(color(`Installation failed: ${error?.message}`));
165
+ exit(1);
166
+ }
161
167
 
162
168
  try {
163
169
  execFileSync("chmod", ["+x", targetFile]);
164
170
  consola.success(color("Executable permissions set"));
165
171
  } catch (error) {
166
- consola.warn(color(`Permission setting failed: ${error.message}`));
172
+ consola.error(color(`Permission setting failed: ${error?.message}`));
173
+ exit(1);
167
174
  }
168
175
  }
169
176
  }
170
177
 
171
- consola.start(color("Cleaning temporary files"));
178
+ consola.start(color("Cleaning temporary files.."));
172
179
  try {
173
180
  await remove(tempspace);
174
181
  consola.success(color("Installation complete"));
@@ -181,6 +188,6 @@ const color = gradient(["cyan", "#2d9b87"]);
181
188
 
182
189
  console.log(color("△ Try running: co --help"));
183
190
  if (process.platform === "win32") {
184
- console.info(log("△ Note: You may need to restart your terminal for PATH changes to take effect"));
191
+ console.log(color("△ Note: You may need to restart your terminal for PATH changes to take effect"));
185
192
  }
186
193
  })();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-cookbook",
3
- "version": "1.0.0-beta.72",
3
+ "version": "1.0.0-beta.74",
4
4
  "main": "index.mjs",
5
5
  "bin": {
6
6
  "create-cookbook": "./index.mjs"