@naseej/blox 0.1.21 → 0.1.22
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 +22 -4
- package/package.json +4 -2
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.22";
|
|
35
35
|
|
|
36
36
|
// src/commands/add/index.ts
|
|
37
37
|
var import_fs_extra7 = __toESM(require("fs-extra"));
|
|
@@ -171,6 +171,19 @@ var updateRemote = async (name, source, shellOptions = {}) => {
|
|
|
171
171
|
});
|
|
172
172
|
await $("git", ["fetch", name], { ...defaultShellOptions, ...shellOptions });
|
|
173
173
|
};
|
|
174
|
+
var readFileFromRemote = async (remote, file) => {
|
|
175
|
+
try {
|
|
176
|
+
let content = "";
|
|
177
|
+
await $("git", ["show", `${remote}/main:${file}`], {
|
|
178
|
+
onStdout: (text2) => {
|
|
179
|
+
content = text2;
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
return JSON.parse(content);
|
|
183
|
+
} catch {
|
|
184
|
+
return {};
|
|
185
|
+
}
|
|
186
|
+
};
|
|
174
187
|
var update = (shellOptions = {}) => {
|
|
175
188
|
return $("git", ["pull", "--progress"], { ...defaultShellOptions, ...shellOptions });
|
|
176
189
|
};
|
|
@@ -240,7 +253,8 @@ var git = {
|
|
|
240
253
|
createPatch,
|
|
241
254
|
getChangesLog,
|
|
242
255
|
applyPatch,
|
|
243
|
-
updateRemote
|
|
256
|
+
updateRemote,
|
|
257
|
+
readFileFromRemote
|
|
244
258
|
};
|
|
245
259
|
|
|
246
260
|
// src/shared/spinner.ts
|
|
@@ -375,6 +389,7 @@ var getAvailableBlocks = async (templateInfo) => {
|
|
|
375
389
|
// src/services/updater.ts
|
|
376
390
|
var import_node_path6 = __toESM(require("path"));
|
|
377
391
|
var import_fs_extra6 = __toESM(require("fs-extra"));
|
|
392
|
+
var import_merge = __toESM(require("lodash/merge"));
|
|
378
393
|
|
|
379
394
|
// src/services/template.ts
|
|
380
395
|
var import_node_path5 = __toESM(require("path"));
|
|
@@ -405,7 +420,7 @@ function getBasedOnInfo(cwd = ".") {
|
|
|
405
420
|
}
|
|
406
421
|
function saveBasedOnInfo(info, cwd = ".") {
|
|
407
422
|
debug("Save info");
|
|
408
|
-
import_fs_extra5.default.
|
|
423
|
+
import_fs_extra5.default.writeFileSync(import_node_path5.default.join(cwd, basedOnFile), JSON.stringify(info, null, 2));
|
|
409
424
|
}
|
|
410
425
|
function updateBasedOnInfo(updates, cwd = ".") {
|
|
411
426
|
const info = getBasedOnInfo(cwd);
|
|
@@ -464,7 +479,9 @@ var textList = async (opts) => {
|
|
|
464
479
|
// src/services/updater.ts
|
|
465
480
|
async function updateFromRemote(name, source = "", ignore = [], destPath = ".") {
|
|
466
481
|
debug("Updating from remote");
|
|
467
|
-
|
|
482
|
+
let basedOnInfo = getBasedOnInfo(destPath);
|
|
483
|
+
const remoteBloxFile = await git.readFileFromRemote(name, ".blox");
|
|
484
|
+
basedOnInfo = (0, import_merge.default)(basedOnInfo, remoteBloxFile);
|
|
468
485
|
const fromBasedCommit = basedOnInfo.bases?.[name]?.commit;
|
|
469
486
|
const fromCommit = fromBasedCommit || basedOnInfo.commit;
|
|
470
487
|
if (!fromCommit) {
|
|
@@ -479,6 +496,7 @@ async function updateFromRemote(name, source = "", ignore = [], destPath = ".")
|
|
|
479
496
|
return;
|
|
480
497
|
}
|
|
481
498
|
const patchFilePath = import_node_path6.default.join(destPath, "diff.patch");
|
|
499
|
+
ignore.push("./.blox");
|
|
482
500
|
await git.createPatch(fromCommit, toCommit, patchFilePath, ignore);
|
|
483
501
|
const changes = await git.getChangesLog(fromCommit, toCommit);
|
|
484
502
|
const deletePatchFile = async () => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@naseej/blox",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.22",
|
|
4
4
|
"description": "blox cli",
|
|
5
5
|
"bin": {
|
|
6
6
|
"blox": "./bin/run"
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
"@types/fs-extra": "11.0.4",
|
|
42
42
|
"@types/ms": "0.7.34",
|
|
43
43
|
"@types/ejs": "3.1.5",
|
|
44
|
+
"@types/lodash": "4.17.20",
|
|
44
45
|
"eslint": "^8.57.0",
|
|
45
46
|
"vitest": "2.1.8",
|
|
46
47
|
"prettier": "^3.2.5",
|
|
@@ -69,6 +70,7 @@
|
|
|
69
70
|
"@commander-js/extra-typings": "12.1.0",
|
|
70
71
|
"commander": "12.1.0",
|
|
71
72
|
"ms": "2.1.3",
|
|
72
|
-
"dayjs": "1.11.13"
|
|
73
|
+
"dayjs": "1.11.13",
|
|
74
|
+
"lodash": "^4.17.21"
|
|
73
75
|
}
|
|
74
76
|
}
|