-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathindex.ts
70 lines (56 loc) · 1.73 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import meow from 'meow'
import { auto } from './auto.ts'
import { scala } from './scala'
import { meowWithSubcommands } from '../../utils/meow-with-subcommands'
import type { CliSubcommand } from '../../utils/meow-with-subcommands'
const description = 'Generate a dependency manifest for given file or dir'
const help = (name: string) => `
Usage
$ ${name} <language> <target>
Generates a declarative dependency manifest (like a package.json for Node.JS
or requirements.txt for PyPi), but for certain supported ecosystems
where it's common to use a dynamic manifest, like Scala's sbt.
Only certain languages are supported and there may be language specific
configurations available. See \`manifest <language> --help\` for usage details
per language.
Currently supported language: scala
Examples
$ ${name} scala .
To have it auto-detect and attempt to run:
$ ${name} yolo
`
export const manifest: CliSubcommand = {
description,
hidden: true,
async run(argv, importMeta, { parentName }) {
const name = `${parentName} manifest`
// Note: this won't catch `socket manifest -xyz --help` sort of cases which
// would fallback to the default meow help behavior. That's fine.
if (argv.length === 0 || argv[0] === '--help') {
meow(help(name), {
argv: ['--help'] as const, // meow will exit() when --help is passed
description,
importMeta
})
}
await meowWithSubcommands(
{
scala,
auto
},
{
argv,
aliases: {
yolo: {
description: auto.description,
hidden: true,
argv: ['auto']
}
},
description,
importMeta,
name
}
)
}
}