@liangmi/mo 0.0.5 → 1.0.1
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 +32 -101
- package/config_schema.json +16 -0
- package/dist/chunk-CBBoxR_p.mjs +26 -0
- package/dist/devtools-BHS22BGO.mjs +3569 -0
- package/dist/mo-inner.mjs +26 -34
- package/dist/mo.mjs +25698 -4890
- package/dist/{runner-BDAeQY-R.mjs → runner-DW0Q4OMK.mjs} +16 -29
- package/package.json +8 -5
package/README.md
CHANGED
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
**M**anage your **O**pensource projects!
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
```text
|
|
5
|
+
`mo` keeps your GitHub repos organized under a single root directory:
|
|
8
6
|
|
|
7
|
+
```
|
|
9
8
|
~/code
|
|
10
9
|
├── vitejs
|
|
11
10
|
│ ├── vite
|
|
@@ -13,107 +12,64 @@ It just keeps your repos organized like this:
|
|
|
13
12
|
└── vuejs
|
|
14
13
|
├── core
|
|
15
14
|
└── vue
|
|
16
|
-
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
## Install
|
|
20
|
-
|
|
21
|
-
```bash
|
|
22
|
-
|
|
23
|
-
vp install -g @liangmi/mo
|
|
24
|
-
|
|
25
15
|
```
|
|
26
16
|
|
|
27
17
|
## Requirements
|
|
28
18
|
|
|
29
|
-
- macOS or Linux
|
|
30
|
-
- global install (local install is not supported for runtime usage)
|
|
19
|
+
- macOS or Linux
|
|
31
20
|
- `git`
|
|
32
21
|
- GitHub CLI `gh` authenticated (`gh auth status`)
|
|
33
22
|
|
|
34
|
-
##
|
|
35
|
-
|
|
36
|
-
Run setup once:
|
|
23
|
+
## Install
|
|
37
24
|
|
|
38
25
|
```bash
|
|
39
|
-
mo
|
|
26
|
+
npm install -g @liangmi/mo
|
|
40
27
|
```
|
|
41
28
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
1. check `git`
|
|
45
|
-
2. check `gh` authentication
|
|
46
|
-
3. ask for your projects root directory
|
|
47
|
-
4. ask which shell(s) you use (`zsh`, `bash`, `fish`)
|
|
48
|
-
5. optionally collect aliases for `mo clone`, `mo list`, and `mo cd`
|
|
49
|
-
6. write `~/.config/morc.json`
|
|
50
|
-
7. sync managed shellrc blocks
|
|
29
|
+
## Setup
|
|
51
30
|
|
|
52
|
-
|
|
31
|
+
Run once to initialize config and shell integration:
|
|
53
32
|
|
|
54
33
|
```bash
|
|
55
|
-
mo
|
|
56
|
-
mo list
|
|
57
|
-
mo cd
|
|
34
|
+
mo setup
|
|
58
35
|
```
|
|
59
36
|
|
|
60
37
|
## Commands
|
|
61
38
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
Initialize config and shell integration
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
Alias: `mo ls`
|
|
83
|
-
|
|
84
|
-
### `mo cd [target]`
|
|
85
|
-
|
|
86
|
-
Resolve and jump to a managed path in your shell integration function.
|
|
87
|
-
|
|
88
|
-
Without `target`, it opens an interactive selector for:
|
|
89
|
-
|
|
90
|
-
- root
|
|
91
|
-
- owner directory
|
|
92
|
-
- repository directory
|
|
93
|
-
|
|
94
|
-
With `target`, supported forms are:
|
|
95
|
-
|
|
96
|
-
- `root` or `.`
|
|
97
|
-
- `<owner>`
|
|
98
|
-
- `<owner>/<repo>`
|
|
99
|
-
|
|
100
|
-
Alias: `mo d`
|
|
39
|
+
| Command | Alias | Description |
|
|
40
|
+
| ------------------------- | ------- | ----------------------------------------- |
|
|
41
|
+
| `mo setup` | | Initialize config and shell integration |
|
|
42
|
+
| `mo clone <owner>/<repo>` | `mo c` | Clone a repo into `<root>/<owner>/<repo>` |
|
|
43
|
+
| `mo list` | `mo ls` | List all managed repos |
|
|
44
|
+
| `mo cd [owner[/repo]]` | `mo d` | Jump to root, owner, or repo directory |
|
|
45
|
+
| `mo edit [owner[/repo]]` | `mo e` | Open a repo in your editor |
|
|
46
|
+
| `mo open [owner[/repo]]` | `mo o` | Open a repo in Finder/Explorer |
|
|
47
|
+
|
|
48
|
+
`mo cd`, `mo edit`, and `mo open` open an interactive selector when called without arguments.
|
|
49
|
+
|
|
50
|
+
> [!TIP]
|
|
51
|
+
> If you are using `mo` with VS Code based editors, you can add this line to your editor config to prevent `mo edit` popping up a new separated window.
|
|
52
|
+
>
|
|
53
|
+
> ```json
|
|
54
|
+
> "window.openFoldersInNewWindow": "off"
|
|
55
|
+
> ```
|
|
56
|
+
>
|
|
57
|
+
> Setting `code -r` as your editor in `mo setup` have the same effect as well.
|
|
101
58
|
|
|
102
59
|
## Config
|
|
103
60
|
|
|
104
|
-
|
|
61
|
+
The config file should be generated by running `mo setup`. Modifying `~/.config/morc.json` manually is not recommended.
|
|
105
62
|
|
|
106
|
-
|
|
107
|
-
~/.config/morc.json
|
|
108
|
-
```
|
|
63
|
+
Please follow the [config_schema.json](./config_schema.json) if you are developing `mo`.
|
|
109
64
|
|
|
110
|
-
|
|
65
|
+
`~/.config/morc.json`:
|
|
111
66
|
|
|
112
67
|
```json
|
|
113
68
|
{
|
|
114
69
|
"$schema": "https://raw.githubusercontent.com/liangmiQwQ/mo/main/config_schema.json",
|
|
115
70
|
"root": "~/code",
|
|
116
71
|
"shells": ["zsh"],
|
|
72
|
+
"editor": "code",
|
|
117
73
|
"alias": {
|
|
118
74
|
"clone": ["k"],
|
|
119
75
|
"list": ["li"],
|
|
@@ -122,34 +78,9 @@ Example:
|
|
|
122
78
|
}
|
|
123
79
|
```
|
|
124
80
|
|
|
125
|
-
### Fields
|
|
126
|
-
|
|
127
|
-
- `root` (required): absolute path or `~` path for your projects directory
|
|
128
|
-
- `shells` (required): one or more of `zsh`, `bash`, `fish`
|
|
129
|
-
- `alias` (optional): alias arrays for `clone`, `list`, `cd`
|
|
130
|
-
|
|
131
|
-
Alias names must match:
|
|
132
|
-
|
|
133
|
-
```text
|
|
134
|
-
[A-Za-z_][A-Za-z0-9_-]*
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
## Shell Integration
|
|
138
|
-
|
|
139
|
-
`mo` manages shell integration blocks in your shellrc files:
|
|
140
|
-
|
|
141
|
-
- `~/.zshrc`
|
|
142
|
-
- `~/.bashrc`
|
|
143
|
-
- `~/.config/fish/config.fish`
|
|
144
|
-
|
|
145
|
-
## Notes
|
|
146
|
-
|
|
147
|
-
- If you run config-required commands without config, `mo` prompts you to run `mo setup`.
|
|
148
|
-
- `mo list` only shows repositories that are Git repos with a GitHub remote.
|
|
149
|
-
|
|
150
81
|
## Contribution
|
|
151
82
|
|
|
152
|
-
|
|
83
|
+
See [ROADMAP.md](./ROADMAP.md) for what's planned.
|
|
153
84
|
|
|
154
85
|
## License
|
|
155
86
|
|
package/config_schema.json
CHANGED
|
@@ -53,6 +53,22 @@
|
|
|
53
53
|
"pattern": "^[A-Za-z_][A-Za-z0-9_-]*$"
|
|
54
54
|
},
|
|
55
55
|
"uniqueItems": true
|
|
56
|
+
},
|
|
57
|
+
"edit": {
|
|
58
|
+
"type": "array",
|
|
59
|
+
"items": {
|
|
60
|
+
"type": "string",
|
|
61
|
+
"pattern": "^[A-Za-z_][A-Za-z0-9_-]*$"
|
|
62
|
+
},
|
|
63
|
+
"uniqueItems": true
|
|
64
|
+
},
|
|
65
|
+
"open": {
|
|
66
|
+
"type": "array",
|
|
67
|
+
"items": {
|
|
68
|
+
"type": "string",
|
|
69
|
+
"pattern": "^[A-Za-z_][A-Za-z0-9_-]*$"
|
|
70
|
+
},
|
|
71
|
+
"uniqueItems": true
|
|
56
72
|
}
|
|
57
73
|
},
|
|
58
74
|
"additionalProperties": false
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
//#region \0rolldown/runtime.js
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
12
|
+
key = keys[i];
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
14
|
+
get: ((k) => from[k]).bind(null, key),
|
|
15
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
21
|
+
value: mod,
|
|
22
|
+
enumerable: true
|
|
23
|
+
}) : target, mod));
|
|
24
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
25
|
+
//#endregion
|
|
26
|
+
export { __require as n, __toESM as r, __commonJSMin as t };
|