@ekkolyth/miso 0.3.1 → 0.3.2
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 +50 -33
- package/bin/miso-darwin-amd64 +0 -0
- package/bin/miso-darwin-arm64 +0 -0
- package/bin/miso-linux-amd64 +0 -0
- package/bin/miso-linux-arm64 +0 -0
- package/bin/miso-windows-amd64.exe +0 -0
- package/bin/misox-darwin-amd64 +0 -0
- package/bin/misox-darwin-arm64 +0 -0
- package/bin/misox-linux-amd64 +0 -0
- package/bin/misox-linux-arm64 +0 -0
- package/bin/misox-windows-amd64.exe +0 -0
- package/package.json +6 -1
- package/scripts/postinstall.mjs +102 -0
package/README.md
CHANGED
|
@@ -14,21 +14,12 @@ Miso doesn't care where you work or what tools you use. It sits as a light wrapp
|
|
|
14
14
|
|
|
15
15
|
### Installation
|
|
16
16
|
|
|
17
|
-
#### Install via Go
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
go install github.com/ekkolyth/miso@latest
|
|
21
|
-
```
|
|
22
|
-
|
|
23
17
|
#### Install via npm
|
|
18
|
+
|
|
24
19
|
Global Install (recommended)
|
|
25
|
-
```bash
|
|
26
|
-
npm install -g @ekkolyth/miso
|
|
27
|
-
```
|
|
28
20
|
|
|
29
|
-
Local Install
|
|
30
21
|
```bash
|
|
31
|
-
npm install @ekkolyth/miso
|
|
22
|
+
npm install -g @ekkolyth/miso
|
|
32
23
|
```
|
|
33
24
|
|
|
34
25
|
Then run `miso init` to add miso to your project:
|
|
@@ -37,31 +28,57 @@ Then run `miso init` to add miso to your project:
|
|
|
37
28
|
miso init
|
|
38
29
|
```
|
|
39
30
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
## Supported commands
|
|
43
|
-
|
|
44
|
-
- `miso init`
|
|
45
|
-
- `miso version`
|
|
46
|
-
- `miso install`
|
|
47
|
-
- `miso add <pkg>`
|
|
48
|
-
- `miso remove <pkg>`
|
|
49
|
-
- `miso dev <args>`
|
|
50
|
-
- `miso <script> [-- <args>]`
|
|
51
|
-
|
|
52
|
-
## `miso.json`
|
|
31
|
+
### Example miso.json (Kitchen Sink)
|
|
53
32
|
|
|
54
33
|
```json
|
|
55
34
|
{
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
|
|
35
|
+
"$schema": "https://misojs.dev/miso.schema.json",
|
|
36
|
+
"package-manager": "bun",
|
|
37
|
+
"name": "my-project",
|
|
38
|
+
"scripts": "./scripts",
|
|
39
|
+
"shell": "bash",
|
|
40
|
+
"flags": {
|
|
41
|
+
"add": ["--dev"],
|
|
42
|
+
"remove": [],
|
|
43
|
+
"install": ["--frozen-lockfile"],
|
|
44
|
+
"dev": ["--env"]
|
|
45
|
+
},
|
|
46
|
+
"env": {
|
|
47
|
+
"path": [".env.local", ".env"],
|
|
48
|
+
"required": "all",
|
|
49
|
+
"variables": {
|
|
50
|
+
"PORT": "port",
|
|
51
|
+
"DATABASE_URL": "url",
|
|
52
|
+
"API_KEY": {
|
|
53
|
+
"type": "string",
|
|
54
|
+
"min": 1,
|
|
55
|
+
"max": 32
|
|
56
|
+
},
|
|
57
|
+
"NODE_ENV": {
|
|
58
|
+
"type": "enum",
|
|
59
|
+
"values": ["development", "production", "test"],
|
|
60
|
+
"optional": true
|
|
61
|
+
},
|
|
62
|
+
"REDIS_URL": {
|
|
63
|
+
"type": "url",
|
|
64
|
+
"schemes": ["redis", "rediss"]
|
|
65
|
+
},
|
|
66
|
+
"RATE_LIMIT": {
|
|
67
|
+
"type": "int+",
|
|
68
|
+
"min": 1,
|
|
69
|
+
"max": 1000
|
|
70
|
+
},
|
|
71
|
+
"FEATURE_FLAGS": "json",
|
|
72
|
+
"USER_ID": "uuid",
|
|
73
|
+
"ADMIN_EMAIL": "email",
|
|
74
|
+
"DEBUG_MODE": "bool",
|
|
75
|
+
"SLUG": {
|
|
76
|
+
"type": "pattern",
|
|
77
|
+
"pattern": "^[a-z0-9-]+$"
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
62
81
|
}
|
|
63
82
|
```
|
|
64
83
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
## Contributions welcome!
|
|
84
|
+
### Contributions welcome!
|
package/bin/miso-darwin-amd64
CHANGED
|
Binary file
|
package/bin/miso-darwin-arm64
CHANGED
|
Binary file
|
package/bin/miso-linux-amd64
CHANGED
|
Binary file
|
package/bin/miso-linux-arm64
CHANGED
|
Binary file
|
|
Binary file
|
package/bin/misox-darwin-amd64
CHANGED
|
Binary file
|
package/bin/misox-darwin-arm64
CHANGED
|
Binary file
|
package/bin/misox-linux-amd64
CHANGED
|
Binary file
|
package/bin/misox-linux-arm64
CHANGED
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -3,11 +3,16 @@
|
|
|
3
3
|
"miso": "miso.mjs",
|
|
4
4
|
"misox": "misox.mjs"
|
|
5
5
|
},
|
|
6
|
+
"scripts": {
|
|
7
|
+
"postinstall": "node scripts/postinstall.mjs"
|
|
8
|
+
},
|
|
6
9
|
"description": "the agnostic package manager",
|
|
10
|
+
"homepage": "https://misojs.dev",
|
|
7
11
|
"files": [
|
|
8
12
|
"README.md",
|
|
9
13
|
"miso.mjs",
|
|
10
14
|
"misox.mjs",
|
|
15
|
+
"scripts/postinstall.mjs",
|
|
11
16
|
"bin/miso-darwin-amd64",
|
|
12
17
|
"bin/miso-darwin-arm64",
|
|
13
18
|
"bin/miso-linux-amd64",
|
|
@@ -25,5 +30,5 @@
|
|
|
25
30
|
"type": "git",
|
|
26
31
|
"url": "git+https://github.com/ekkolyth/miso.git"
|
|
27
32
|
},
|
|
28
|
-
"version": "0.3.
|
|
33
|
+
"version": "0.3.2"
|
|
29
34
|
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Postinstall: automatically install shell completions.
|
|
5
|
+
* Runs on npm install (global or local) and when using the local install script.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { readFileSync, writeFileSync, existsSync } from 'node:fs';
|
|
9
|
+
import { dirname, join } from 'node:path';
|
|
10
|
+
import { fileURLToPath } from 'node:url';
|
|
11
|
+
|
|
12
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
13
|
+
|
|
14
|
+
if (!process.env.HOME) process.exit(0);
|
|
15
|
+
|
|
16
|
+
const SCRIPTS = {
|
|
17
|
+
bash: `_miso_completion() {
|
|
18
|
+
local cur prev
|
|
19
|
+
cur="${"$"}{COMP_WORDS[COMP_CWORD]}"
|
|
20
|
+
if [ $COMP_CWORD -ge 1 ]; then
|
|
21
|
+
prev="${"$"}{COMP_WORDS[COMP_CWORD-1]}"
|
|
22
|
+
else
|
|
23
|
+
prev="miso"
|
|
24
|
+
fi
|
|
25
|
+
COMPREPLY=($(miso __complete miso "$cur" "$prev" 2>/dev/null))
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
complete -F _miso_completion miso
|
|
29
|
+
`,
|
|
30
|
+
zsh: `_miso() {
|
|
31
|
+
local cur="${"$"}{words[CURRENT]}"
|
|
32
|
+
local prev="${"$"}{words[CURRENT-1]}"
|
|
33
|
+
local -a completions
|
|
34
|
+
completions=("${"$"}{(f)$(miso __complete miso "$cur" "$prev" 2>/dev/null)}")
|
|
35
|
+
compadd -a completions
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
compdef _miso miso
|
|
39
|
+
`,
|
|
40
|
+
fish: `function __miso_complete
|
|
41
|
+
set -l cl (commandline -cp)
|
|
42
|
+
set -l tokens (string split " " -- $cl)
|
|
43
|
+
set -l cur ""
|
|
44
|
+
set -l prev "miso"
|
|
45
|
+
if test (count $tokens) -ge 2
|
|
46
|
+
set cur $tokens[-1]
|
|
47
|
+
set prev $tokens[-2]
|
|
48
|
+
else if test (count $tokens) -eq 1
|
|
49
|
+
set prev $tokens[1]
|
|
50
|
+
end
|
|
51
|
+
miso __complete miso "$cur" "$prev"
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
complete -c miso -a '(__miso_complete)'
|
|
55
|
+
`,
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
function getShell() {
|
|
59
|
+
const shell = process.env.SHELL || '';
|
|
60
|
+
const base = shell.split('/').pop() || '';
|
|
61
|
+
if (base.startsWith('bash')) return 'bash';
|
|
62
|
+
if (base.startsWith('zsh')) return 'zsh';
|
|
63
|
+
if (base.startsWith('fish')) return 'fish';
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function getConfigPath(shell) {
|
|
68
|
+
const home = process.env.HOME;
|
|
69
|
+
switch (shell) {
|
|
70
|
+
case 'bash': return join(home, '.bashrc');
|
|
71
|
+
case 'zsh': return join(home, '.zshrc');
|
|
72
|
+
case 'fish': return join(home, '.config', 'fish', 'config.fish');
|
|
73
|
+
default: return null;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function isInstalled(configPath, shell) {
|
|
78
|
+
if (!existsSync(configPath)) return false;
|
|
79
|
+
const content = readFileSync(configPath, 'utf8');
|
|
80
|
+
if (shell === 'bash') return content.includes('_miso_completion');
|
|
81
|
+
if (shell === 'zsh') return content.includes('compdef _miso miso');
|
|
82
|
+
if (shell === 'fish') return content.includes('complete -c miso');
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const shell = getShell();
|
|
87
|
+
if (!shell) process.exit(0);
|
|
88
|
+
|
|
89
|
+
const configPath = getConfigPath(shell);
|
|
90
|
+
if (!configPath) process.exit(0);
|
|
91
|
+
|
|
92
|
+
if (isInstalled(configPath, shell)) process.exit(0);
|
|
93
|
+
|
|
94
|
+
const script = SCRIPTS[shell];
|
|
95
|
+
const toAppend = `\n# Miso shell completion\n${script}`;
|
|
96
|
+
|
|
97
|
+
try {
|
|
98
|
+
const content = existsSync(configPath) ? readFileSync(configPath, 'utf8') : '';
|
|
99
|
+
writeFileSync(configPath, content + toAppend, 'utf8');
|
|
100
|
+
} catch {
|
|
101
|
+
process.exit(0);
|
|
102
|
+
}
|