@naseej/blox 0.1.8 → 0.1.9
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/dist/run.js +24 -15
- package/package.json +1 -1
package/dist/run.js
CHANGED
|
@@ -31,7 +31,7 @@ var option = (flags, description) => {
|
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
// package.json
|
|
34
|
-
var version = "0.1.
|
|
34
|
+
var version = "0.1.9";
|
|
35
35
|
|
|
36
36
|
// src/services/git.ts
|
|
37
37
|
var import_node_path = __toESM(require("path"));
|
|
@@ -41,7 +41,7 @@ var import_fs_extra = __toESM(require("fs-extra"));
|
|
|
41
41
|
var import_node_child_process = require("child_process");
|
|
42
42
|
|
|
43
43
|
// src/shared/logger.ts
|
|
44
|
-
var
|
|
44
|
+
var console2 = __toESM(require("console"));
|
|
45
45
|
var import_prompts = require("@clack/prompts");
|
|
46
46
|
|
|
47
47
|
// src/config/runtime.ts
|
|
@@ -61,15 +61,15 @@ var debug = (message) => {
|
|
|
61
61
|
if (typeof message === "string") {
|
|
62
62
|
import_prompts.log.warn(message.trim());
|
|
63
63
|
} else {
|
|
64
|
-
|
|
64
|
+
console2.log(JSON.stringify(message));
|
|
65
65
|
}
|
|
66
66
|
};
|
|
67
67
|
var logWarningSection = (title, content) => {
|
|
68
68
|
const line = fmt.yellow("=".repeat(82));
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
content &&
|
|
72
|
-
|
|
69
|
+
console2.log("\n" + line);
|
|
70
|
+
console2.log(fmt.bold(fmt.yellow("\u25B2 " + title)));
|
|
71
|
+
content && console2.log(content);
|
|
72
|
+
console2.log(line + "\n");
|
|
73
73
|
};
|
|
74
74
|
|
|
75
75
|
// src/services/shell.ts
|
|
@@ -557,21 +557,30 @@ async function updateFromRemote(name, source = "", destPath = ".") {
|
|
|
557
557
|
const patchFilePath = import_node_path5.default.join(destPath, "diff.patch");
|
|
558
558
|
await git.createPatch(fromCommit, toCommit, patchFilePath);
|
|
559
559
|
const changes = await git.getChangesLog(fromCommit, toCommit);
|
|
560
|
+
const deletePatchFile = async () => {
|
|
561
|
+
if (!isDebugMode()) {
|
|
562
|
+
await import_fs_extra6.default.unlink(patchFilePath);
|
|
563
|
+
}
|
|
564
|
+
debug("make sure to delete the patch file after you're done with it.");
|
|
565
|
+
};
|
|
566
|
+
try {
|
|
567
|
+
await git.applyPatch(patchFilePath, destPath);
|
|
568
|
+
} catch (e) {
|
|
569
|
+
const errorMessage = `${e}`;
|
|
570
|
+
if (errorMessage.includes("error:")) {
|
|
571
|
+
await deletePatchFile();
|
|
572
|
+
console.log(`${e}`.replace("error:", fmt.red("error:")));
|
|
573
|
+
error("Failed to apply changes.");
|
|
574
|
+
}
|
|
575
|
+
}
|
|
560
576
|
if (changes.trim() !== "") {
|
|
561
577
|
logWarningSection(
|
|
562
578
|
"These is the changes from last update, make sure to review for breaking changes",
|
|
563
579
|
changes
|
|
564
580
|
);
|
|
565
581
|
}
|
|
566
|
-
|
|
567
|
-
await git.applyPatch(patchFilePath, destPath);
|
|
568
|
-
} catch {
|
|
569
|
-
}
|
|
582
|
+
await deletePatchFile();
|
|
570
583
|
updateBasedOnInfo({ commit: toCommit }, destPath);
|
|
571
|
-
if (!isDebugMode()) {
|
|
572
|
-
await import_fs_extra6.default.unlink(patchFilePath);
|
|
573
|
-
}
|
|
574
|
-
debug("make sure to delete the patch file after you're done with it.");
|
|
575
584
|
}
|
|
576
585
|
|
|
577
586
|
// src/commands/update/index.ts
|