@oh-gc/cli 0.4.3 → 0.4.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/README.md +2 -2
- package/dist/git/index.js +12 -15
- package/dist/git/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -141,13 +141,13 @@ Stored at `~/.config/gitcode-cli/config.json`. Set via `oh-gc auth:login`, remov
|
|
|
141
141
|
|
|
142
142
|
### Remote
|
|
143
143
|
|
|
144
|
-
By default `oh-gc` uses the `origin` remote. To use a different remote for a specific repo, run `oh-gc repo:set-remote <name>`. This writes a `.gitcode` file in the repo root:
|
|
144
|
+
By default `oh-gc` uses the `origin` remote. To use a different remote for a specific repo, run `oh-gc repo:set-remote <name>`. This writes a `.gitcode/oh-gc-config.json` file in the repo root:
|
|
145
145
|
|
|
146
146
|
```json
|
|
147
147
|
{ "remote": "upstream" }
|
|
148
148
|
```
|
|
149
149
|
|
|
150
|
-
You can commit or gitignore
|
|
150
|
+
You can commit or gitignore the `.gitcode/` directory — `oh-gc` never modifies `.gitignore`.
|
|
151
151
|
|
|
152
152
|
### Proxy
|
|
153
153
|
|
package/dist/git/index.js
CHANGED
|
@@ -9,21 +9,15 @@ exports.resolveRepo = resolveRepo;
|
|
|
9
9
|
exports.getForkOwner = getForkOwner;
|
|
10
10
|
const node_child_process_1 = require("node:child_process");
|
|
11
11
|
const node_fs_1 = require("node:fs");
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
try {
|
|
17
|
-
return (0, node_fs_1.statSync)(GITCODE_FILE).isFile();
|
|
18
|
-
}
|
|
19
|
-
catch {
|
|
20
|
-
return false;
|
|
21
|
-
}
|
|
12
|
+
const GITCODE_DIR = '.gitcode';
|
|
13
|
+
const GITCODE_CONFIG = `${GITCODE_DIR}/oh-gc-config.json`;
|
|
14
|
+
function configExists() {
|
|
15
|
+
return (0, node_fs_1.existsSync)(GITCODE_CONFIG);
|
|
22
16
|
}
|
|
23
17
|
function getConfiguredRemote() {
|
|
24
|
-
if (
|
|
18
|
+
if (configExists()) {
|
|
25
19
|
try {
|
|
26
|
-
const data = JSON.parse((0, node_fs_1.readFileSync)(
|
|
20
|
+
const data = JSON.parse((0, node_fs_1.readFileSync)(GITCODE_CONFIG, 'utf8'));
|
|
27
21
|
if (data.remote)
|
|
28
22
|
return data.remote;
|
|
29
23
|
}
|
|
@@ -34,11 +28,14 @@ function getConfiguredRemote() {
|
|
|
34
28
|
return 'origin';
|
|
35
29
|
}
|
|
36
30
|
function setConfiguredRemote(remote) {
|
|
37
|
-
|
|
38
|
-
|
|
31
|
+
if (!(0, node_fs_1.existsSync)(GITCODE_DIR)) {
|
|
32
|
+
(0, node_fs_1.mkdirSync)(GITCODE_DIR, { recursive: true });
|
|
33
|
+
}
|
|
34
|
+
const existing = configExists()
|
|
35
|
+
? JSON.parse((0, node_fs_1.readFileSync)(GITCODE_CONFIG, 'utf8'))
|
|
39
36
|
: {};
|
|
40
37
|
existing.remote = remote;
|
|
41
|
-
(0, node_fs_1.writeFileSync)(
|
|
38
|
+
(0, node_fs_1.writeFileSync)(GITCODE_CONFIG, JSON.stringify(existing, null, 2));
|
|
42
39
|
}
|
|
43
40
|
function getRemoteUrl(remote) {
|
|
44
41
|
try {
|
package/dist/git/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/git/index.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/git/index.ts"],"names":[],"mappings":";;AAcA,kDAUC;AAED,kDASC;AAED,oCAMC;AAED,wCAMC;AAKD,0CAMC;AAED,kCAIC;AAKD,oCAQC;AAjFD,2DAA6C;AAC7C,qCAA4E;AAE5E,MAAM,WAAW,GAAG,UAAU,CAAA;AAC9B,MAAM,cAAc,GAAG,GAAG,WAAW,oBAAoB,CAAA;AAMzD,SAAS,YAA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