Skip to content

Commit

Permalink
fix(cli): add install command name
Browse files Browse the repository at this point in the history
  • Loading branch information
lennykean committed Feb 15, 2021
1 parent 7d1772a commit 8942ba6
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 6 deletions.
18 changes: 13 additions & 5 deletions cli/global/services/mvf-manager.service.ts
Expand Up @@ -24,7 +24,9 @@ export class MvfManagerService {
* @param requestedVersion The requested version in the format of #.#.# (no v prefix)
*/
async update(requestedVersion: string | null) {
const installUrl = await this.getInstallUrlForRequestedVersion(requestedVersion);
const installUrl = await this.getInstallUrlForRequestedVersion(
requestedVersion,
);

await this.runInstall(
installUrl,
Expand Down Expand Up @@ -81,9 +83,11 @@ export class MvfManagerService {
};
}

private async getInstallUrlForRequestedVersion(requestedVersion: string | null) {
private async getInstallUrlForRequestedVersion(
requestedVersion: string | null,
) {
let installUrl = "https://deno.land/x/momentum/cli/main.ts";

const versionInfo = await this.getVersionInfoFromDenoLand();

const version = versionInfo.latest;
Expand Down Expand Up @@ -156,15 +160,19 @@ export class MvfManagerService {
"--unstable",
"-A",
"-f",
`-c`,
"-n",
"mvf",
"-c",
tsConfigAbsolutePath,
cliMainTsUrl,
]);

if (!results.status.success) {
console.error(`Error installing: ${results.stderror}`);
} else {
console.log("Successfully installed mvf! Run `mvf --version` to validate.");
console.log(
"Successfully installed mvf! Run `mvf --version` to validate.",
);
}
}

Expand Down
20 changes: 19 additions & 1 deletion cli/main.ts
@@ -1,8 +1,26 @@
import { LoggingFilter, LogLevel } from "../core/mod.ts";
import { Injectable } from "../di/mod.ts";
import { CliModule } from "./cli/cli.module.ts";
import { CliService } from "./cli/cli.service.ts";
import { platformMomentum } from "./deps.ts";

const platform = await platformMomentum().bootstrapModule(CliModule);
@Injectable()
class InternalLoggingFilter implements LoggingFilter {
filterLog(
_logTime: Date,
_level: LogLevel,
_data: unknown[],
_error?: unknown,
namespace?: string,
loggerName?: string,
): boolean {
return namespace !== "Momentum" && loggerName != "Internal";
}
}

const platform = await platformMomentum()
.registerGlobalLoggingFilter(InternalLoggingFilter)
.bootstrapModule(CliModule);

const program = await platform.resolve<CliService>(CliService);

Expand Down
3 changes: 3 additions & 0 deletions core/platform.ts
Expand Up @@ -138,6 +138,7 @@ export abstract class Platform {
} else {
this.#container.registerValue(LOGGING_PROVIDER, loggingProvider);
}
return this;
}

/**
Expand All @@ -151,6 +152,7 @@ export abstract class Platform {
} else {
this.#container.registerValue(LOGGING_FILTER, loggingFilter);
}
return this;
}

/**
Expand All @@ -164,6 +166,7 @@ export abstract class Platform {
} else {
this.#container.registerValue(LOGGING_FORMATTER, loggingFormatter);
}
return this;
}

async preBootstrap(): Promise<void> {}
Expand Down

0 comments on commit 8942ba6

Please sign in to comment.