@naseej/blox 0.1.3 → 0.1.4
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 +12 -9
- package/package.json +1 -1
- package/readme.md +6 -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.4";
|
|
35
35
|
|
|
36
36
|
// src/services/git.ts
|
|
37
37
|
var import_node_path = __toESM(require("path"));
|
|
@@ -120,17 +120,17 @@ var getLatestCommit = async (cwd) => {
|
|
|
120
120
|
});
|
|
121
121
|
return commit.replace(/\n/g, "");
|
|
122
122
|
};
|
|
123
|
-
var
|
|
123
|
+
var patchesDir = ".update_patches";
|
|
124
124
|
var createPatch = async (cwd, fromCommit, toCommit) => {
|
|
125
|
-
return $("git", ["
|
|
125
|
+
return $("git", ["format-patch", "-o", patchesDir, `${fromCommit}..${toCommit}`], { cwd });
|
|
126
126
|
};
|
|
127
|
-
var applyPatch = (
|
|
127
|
+
var applyPatch = (patchs, cwd = ".") => {
|
|
128
128
|
const args = ["apply", "-3"];
|
|
129
129
|
if (cwd != ".") {
|
|
130
130
|
args.push("--directory");
|
|
131
131
|
args.push(cwd);
|
|
132
132
|
}
|
|
133
|
-
args.push(patch);
|
|
133
|
+
args.push(`${patchs}/*.patch`);
|
|
134
134
|
return $("git", args);
|
|
135
135
|
};
|
|
136
136
|
var unInit = (cwd) => {
|
|
@@ -517,15 +517,18 @@ async function updateFromRemote(name, source = "", destPath = ".") {
|
|
|
517
517
|
await git.clone(source, name, { cwd: appPaths.temp });
|
|
518
518
|
const fromCommit = getBasedOnInfo(destPath).commit;
|
|
519
519
|
const toCommit = await git.getLatestCommit(tmpClone);
|
|
520
|
+
debug({ fromCommit, toCommit });
|
|
520
521
|
await git.createPatch(tmpClone, fromCommit, toCommit);
|
|
521
|
-
const
|
|
522
|
-
import_fs_extra6.default.moveSync(import_node_path5.default.join(tmpClone,
|
|
522
|
+
const patchDirPath = import_node_path5.default.join(destPath, patchesDir);
|
|
523
|
+
import_fs_extra6.default.moveSync(import_node_path5.default.join(tmpClone, patchesDir), patchDirPath);
|
|
523
524
|
try {
|
|
524
|
-
await git.applyPatch(
|
|
525
|
+
await git.applyPatch(patchDirPath, destPath);
|
|
525
526
|
} catch {
|
|
526
527
|
}
|
|
527
528
|
updateBasedOnInfo({ commit: toCommit }, destPath);
|
|
528
|
-
|
|
529
|
+
if (!isDebugMode()) {
|
|
530
|
+
await import_fs_extra6.default.remove(patchDirPath);
|
|
531
|
+
}
|
|
529
532
|
await import_fs_extra6.default.remove(tmpClone);
|
|
530
533
|
}
|
|
531
534
|
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -5,11 +5,16 @@
|
|
|
5
5
|
|
|
6
6
|
BLOX is started kit built to speed Medad Product development by providing prebuild blocks of code that can be added with all its provided functionalities in one cli command.
|
|
7
7
|
|
|
8
|
+
### Prerequisites
|
|
9
|
+
|
|
10
|
+
- Install [yarn](https://classic.yarnpkg.com/lang/en/docs/install/)
|
|
11
|
+
|
|
8
12
|
### Install
|
|
13
|
+
|
|
9
14
|
It can have many way to be installed, mainly as global npm package
|
|
10
15
|
|
|
11
16
|
```shell
|
|
12
|
-
|
|
17
|
+
npm install -g patch-package @naseej/blox
|
|
13
18
|
```
|
|
14
19
|
|
|
15
20
|
* make sure npm is already in you $Path to be able to use blox globally
|