@naseej/blox 0.1.3 → 0.1.5
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 -3
- 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.5";
|
|
35
35
|
|
|
36
36
|
// src/services/git.ts
|
|
37
37
|
var import_node_path = __toESM(require("path"));
|
|
@@ -106,6 +106,22 @@ var clone = (repoUrl, options, shellOptions = {}) => {
|
|
|
106
106
|
...shellOptions
|
|
107
107
|
});
|
|
108
108
|
};
|
|
109
|
+
var updateRemote = async (name, source, shellOptions = {}) => {
|
|
110
|
+
debug("updateRemote");
|
|
111
|
+
debug({ name, source });
|
|
112
|
+
try {
|
|
113
|
+
await $("git", ["remote", "add", name, source], {
|
|
114
|
+
...defaultShellOptions,
|
|
115
|
+
...shellOptions
|
|
116
|
+
});
|
|
117
|
+
} catch {
|
|
118
|
+
}
|
|
119
|
+
await $("git", ["remote", "set-url", name, source], {
|
|
120
|
+
...defaultShellOptions,
|
|
121
|
+
...shellOptions
|
|
122
|
+
});
|
|
123
|
+
await $("git", ["fetch", name], { ...defaultShellOptions, ...shellOptions });
|
|
124
|
+
};
|
|
109
125
|
var update = (shellOptions = {}) => {
|
|
110
126
|
return $("git", ["pull", "--progress"], { ...defaultShellOptions, ...shellOptions });
|
|
111
127
|
};
|
|
@@ -151,7 +167,8 @@ var git = {
|
|
|
151
167
|
init,
|
|
152
168
|
getLatestCommit,
|
|
153
169
|
createPatch,
|
|
154
|
-
applyPatch
|
|
170
|
+
applyPatch,
|
|
171
|
+
updateRemote
|
|
155
172
|
};
|
|
156
173
|
|
|
157
174
|
// src/services/registry.ts
|
|
@@ -514,9 +531,11 @@ async function updateFromRemote(name, source = "", destPath = ".") {
|
|
|
514
531
|
import_fs_extra6.default.ensureDirSync(appPaths.temp);
|
|
515
532
|
const tmpClone = import_node_path5.default.join(appPaths.temp, name);
|
|
516
533
|
await import_fs_extra6.default.remove(tmpClone);
|
|
534
|
+
await git.updateRemote(name, source);
|
|
517
535
|
await git.clone(source, name, { cwd: appPaths.temp });
|
|
518
536
|
const fromCommit = getBasedOnInfo(destPath).commit;
|
|
519
537
|
const toCommit = await git.getLatestCommit(tmpClone);
|
|
538
|
+
debug({ fromCommit, toCommit });
|
|
520
539
|
await git.createPatch(tmpClone, fromCommit, toCommit);
|
|
521
540
|
const patchFilePath = import_node_path5.default.join(destPath, patchFileName);
|
|
522
541
|
import_fs_extra6.default.moveSync(import_node_path5.default.join(tmpClone, patchFileName), patchFilePath);
|
|
@@ -525,7 +544,9 @@ async function updateFromRemote(name, source = "", destPath = ".") {
|
|
|
525
544
|
} catch {
|
|
526
545
|
}
|
|
527
546
|
updateBasedOnInfo({ commit: toCommit }, destPath);
|
|
528
|
-
|
|
547
|
+
if (!isDebugMode()) {
|
|
548
|
+
await import_fs_extra6.default.unlink(patchFilePath);
|
|
549
|
+
}
|
|
529
550
|
await import_fs_extra6.default.remove(tmpClone);
|
|
530
551
|
}
|
|
531
552
|
|
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
|