/
index.ts
88 lines (78 loc) · 4.92 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
import { IProject, IonicEnvironment } from '../definitions';
import { CommandMap, Namespace, NamespaceMap } from '../lib/namespace';
export interface IonicEnvironmentDeps {
readonly env: IonicEnvironment;
readonly project?: IProject;
}
export class IonicNamespace extends Namespace {
protected _env: IonicEnvironment;
protected _project: IProject | undefined;
constructor({ env, project }: IonicEnvironmentDeps) {
super(undefined);
this._env = env;
this._project = project;
}
get project(): IProject | undefined {
return this._project;
}
set project(p: IProject | undefined) {
this._project = p;
}
get env(): IonicEnvironment {
return this._env;
}
set env(env: IonicEnvironment) {
this._env = env;
}
async getMetadata() {
return {
name: 'ionic',
summary: '',
};
}
async getNamespaces(): Promise<NamespaceMap> {
return new NamespaceMap([
['config', async () => { const { ConfigNamespace } = await import('./config/index'); return new ConfigNamespace(this); }],
['cordova', async () => { const { CordovaNamespace } = await import('./cordova/index'); return new CordovaNamespace(this); }],
['capacitor', async () => { const { CapacitorNamespace } = await import('./capacitor/index'); return new CapacitorNamespace(this); }],
['deploy', async () => { const { DeployNamespace } = await import('./deploy/index'); return new DeployNamespace(this); }],
['git', async () => { const { GitNamespace } = await import('./git/index'); return new GitNamespace(this); }],
['package', async () => { const { PackageNamespace } = await import('./package/index'); return new PackageNamespace(this); }],
['ssl', async () => { const { SSLNamespace } = await import('./ssl/index'); return new SSLNamespace(this); }],
['ssh', async () => { const { SSHNamespace } = await import('./ssh/index'); return new SSHNamespace(this); }],
['monitoring', async () => { const { MonitoringNamespace } = await import('./monitoring/index'); return new MonitoringNamespace(this); }],
['doctor', async () => { const { DoctorNamespace } = await import('./doctor/index'); return new DoctorNamespace(this); }],
['integrations', async () => { const { IntegrationsNamespace } = await import('./integrations/index'); return new IntegrationsNamespace(this); }],
['enterprise', async () => { const { EnterpriseNamespace } = await import('./enterprise/index'); return new EnterpriseNamespace(this); }],
['cap', 'capacitor'],
['cdv', 'cordova'],
['i', 'integrations'],
['integration', 'integrations'],
]);
}
async getCommands(): Promise<CommandMap> {
return new CommandMap([
['build', async () => { const { BuildCommand } = await import('./build'); return new BuildCommand(this); }],
['completion', async () => { const { CompletionCommand } = await import('./completion'); return new CompletionCommand(this); }],
['docs', async () => { const { DocsCommand } = await import('./docs'); return new DocsCommand(this); }],
['generate', async () => { const { GenerateCommand } = await import('./generate'); return new GenerateCommand(this); }],
['help', async () => { const { HelpCommand } = await import('./help'); return new HelpCommand(this); }],
['info', async () => { const { InfoCommand } = await import('./info'); return new InfoCommand(this); }],
['init', async () => { const { InitCommand } = await import('./init'); return new InitCommand(this); }],
['ionitron', async () => { const { IonitronCommand } = await import('./ionitron'); return new IonitronCommand(this); }],
['link', async () => { const { LinkCommand } = await import('./link'); return new LinkCommand(this); }],
['login', async () => { const { LoginCommand } = await import('./login'); return new LoginCommand(this); }],
['logout', async () => { const { LogoutCommand } = await import('./logout'); return new LogoutCommand(this); }],
['repair', async () => { const { RepairCommand } = await import('./repair'); return new RepairCommand(this); }],
['serve', async () => { const { ServeCommand } = await import('./serve'); return new ServeCommand(this); }],
['share', async () => { const { ShareCommand } = await import('./share'); return new ShareCommand(this); }],
['signup', async () => { const { SignupCommand } = await import('./signup'); return new SignupCommand(this); }],
['start', async () => { const { StartCommand } = await import('./start'); return new StartCommand(this); }],
['state', async () => { const { StateCommand } = await import('./state'); return new StateCommand(this); }],
['telemetry', async () => { const { TelemetryCommand } = await import('./telemetry'); return new TelemetryCommand(this); }],
['version', async () => { const { VersionCommand } = await import('./version'); return new VersionCommand(this); }],
['g', 'generate'],
['s', 'serve'],
]);
}
}