@cj-ways/orgclone 0.3.0 → 0.5.0

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.
Files changed (3) hide show
  1. package/README.md +22 -14
  2. package/install.js +4 -2
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -17,14 +17,18 @@ npm install -g @cj-ways/orgclone
17
17
  # Clone a GitHub org (GitHub is the default)
18
18
  orgclone clone my-org
19
19
 
20
+ # Interactively pick which repos to clone
21
+ orgclone clone my-org --pick
22
+
20
23
  # Clone a GitLab group
21
24
  orgclone clone my-group --gitlab
22
25
 
23
26
  # Preview what would be cloned
24
27
  orgclone clone my-org --dry-run
25
28
 
26
- # Switch default platform to GitLab permanently
27
- orgclone default gitlab
29
+ # Change defaults permanently
30
+ orgclone default platform gitlab
31
+ orgclone default dest ~/projects
28
32
  ```
29
33
 
30
34
  Repos land in `~/Desktop/my-org/` by default. Run it again on the same folder and it `git pull`s everything — no re-cloning.
@@ -47,22 +51,25 @@ Repos land in `~/Desktop/my-org/` by default. Run it again on the same folder an
47
51
  ```
48
52
  orgclone clone <name> [options]
49
53
 
50
- name org name (GitHub) or group path (GitLab)
54
+ name org name (GitHub) or group path (GitLab)
51
55
 
52
- Options:
53
- --gitlab Use GitLab instead of the default platform (GitHub)
54
- -t, --token API token or set GITHUB_TOKEN / GITLAB_TOKEN env var
55
- -d, --dest Destination folder (default: ~/Desktop/<name>)
56
- -e, --exclude Comma-separated repo names to skip
56
+ --gitlab Use GitLab instead of the default platform
57
+ --pick Interactively select which repos to clone
58
+ -t, --token API token (or set GITHUB_TOKEN / GITLAB_TOKEN)
59
+ -d, --dest Destination folder (default: ~/Desktop/<name>)
60
+ -e, --exclude Comma-separated repo names to skip
57
61
  --skip-archived Skip archived repositories
58
- --ssh Use SSH URLs instead of HTTPS
59
- --gitlab-url Self-hosted GitLab URL (default: https://gitlab.com)
60
- --dry-run List repos without cloning
62
+ --gitlab-url Self-hosted GitLab URL (default: https://gitlab.com)
63
+ --dry-run List repos without cloning
64
+
65
+ orgclone default <setting> <value>
61
66
 
62
- orgclone default <platform>
67
+ platform github or gitlab
68
+ dest path to clone into (e.g. ~/projects)
63
69
 
64
- Change the default platform permanently (saved to ~/.orgclone.yml)
65
- Example: orgclone default gitlab
70
+ Examples:
71
+ orgclone default platform gitlab
72
+ orgclone default dest ~/projects
66
73
  ```
67
74
 
68
75
  ---
@@ -97,6 +104,7 @@ Run `orgclone init` to generate `~/.orgclone.yml`:
97
104
 
98
105
  ```yaml
99
106
  default_dest: ~/Desktop
107
+ default_platform: github # or gitlab
100
108
 
101
109
  github:
102
110
  token: ghp_xxx # or: export GITHUB_TOKEN=ghp_xxx
package/install.js CHANGED
@@ -5,6 +5,7 @@
5
5
  */
6
6
 
7
7
  const https = require("https");
8
+ const http = require("http");
8
9
  const fs = require("fs");
9
10
  const path = require("path");
10
11
  const os = require("os");
@@ -31,8 +32,9 @@ function getPlatformTarget() {
31
32
  function download(url, dest) {
32
33
  return new Promise((resolve, reject) => {
33
34
  const follow = (u) => {
34
- https.get(u, { headers: { "User-Agent": "orgclone-installer" } }, (res) => {
35
- if (res.statusCode === 301 || res.statusCode === 302) return follow(res.headers.location);
35
+ const client = u.startsWith("https") ? https : http;
36
+ client.get(u, { headers: { "User-Agent": "orgclone-installer" } }, (res) => {
37
+ if ([301, 302, 303].includes(res.statusCode)) return follow(res.headers.location);
36
38
  if (res.statusCode !== 200) return reject(new Error(`HTTP ${res.statusCode}`));
37
39
  const file = fs.createWriteStream(dest);
38
40
  res.pipe(file);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cj-ways/orgclone",
3
- "version": "0.3.0",
4
- "binaryVersion": "0.3.0",
3
+ "version": "0.5.0",
4
+ "binaryVersion": "0.5.0",
5
5
  "description": "Clone entire GitHub organizations or GitLab groups with one command. Supports public and private repos, SSH, token auth, and config files.",
6
6
  "license": "MIT",
7
7
  "author": "cj-ways",