Skip to content

Commit 4512d41

Browse files
authored
Merge pull request #159 from contentstack/refactor/base-command
Refactor: move base command file from command folder
2 parents f3c012a + a59089a commit 4512d41

File tree

10 files changed

+181
-166
lines changed

10 files changed

+181
-166
lines changed

package-lock.json

Lines changed: 64 additions & 77 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
"/oclif.manifest.json"
1818
],
1919
"dependencies": {
20-
"@contentstack/cli-command": "^1.2.11",
21-
"@contentstack/cli-utilities": "^1.5.1",
20+
"@contentstack/cli-command": "^1.2.16",
21+
"@contentstack/cli-utilities": "^1.5.8",
2222
"adm-zip": "^0.5.10",
2323
"chalk": "^4.1.2",
2424
"lodash": "^4.17.21",

src/commands/app/base-command.ts renamed to src/base-command.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ import {
1414
cliux,
1515
} from "@contentstack/cli-utilities";
1616

17-
import config from "../../config";
18-
import { ConfigType, LogFn } from "../../types";
19-
import { Logger, getDeveloperHubUrl } from "../../util";
20-
import messages, { $t, commonMsg } from "../../messages";
17+
import config from "./config";
18+
import { ConfigType, LogFn } from "./types";
19+
import { Logger, getDeveloperHubUrl } from "./util";
20+
import messages, { $t, commonMsg } from "./messages";
2121

2222
export type Flags<T extends typeof Command> = Interfaces.InferredFlags<
2323
(typeof BaseCommand)["baseFlags"] & T["flags"]
@@ -42,8 +42,6 @@ export abstract class BaseCommand<T extends typeof Command> extends Command {
4242
protected flags!: Flags<T>;
4343
protected args!: Args<T>;
4444

45-
static hidden = true;
46-
4745
// NOTE define flags that can be inherited by any command that extends BaseCommand
4846
static baseFlags: FlagInput = {
4947
org: Flags.string({

src/commands/app/create.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {
1616
} from "fs";
1717
import { ux, cliux, flags, HttpClient } from "@contentstack/cli-utilities";
1818

19-
import { BaseCommand } from "./base-command";
19+
import { BaseCommand } from "../../base-command";
2020
import { AppManifest, AppType } from "../../types";
2121
import { appCreate, commonMsg } from "../../messages";
2222
import {
@@ -28,7 +28,6 @@ import {
2828

2929
export default class Create extends BaseCommand<typeof Create> {
3030
private appData!: AppManifest;
31-
static hidden: boolean = false;
3231

3332
static description =
3433
"Create a new app in Developer Hub and optionally clone a boilerplate locally.";

src/commands/app/delete.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
import { BaseCommand } from "./base-command";
1+
import { BaseCommand } from "../../base-command";
22
import { cliux, flags } from "@contentstack/cli-utilities";
33
import { $t, commonMsg, deleteAppMsg } from "../../messages";
44
import { getOrg, fetchAppInstallations, deleteApp, getApp } from "../../util";
55

66
export default class Delete extends BaseCommand<typeof Delete> {
7-
static hidden: boolean = false;
8-
97
static description = "Delete app from marketplace";
108

119
static examples = [

src/commands/app/get.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
import { BaseCommand } from "./base-command";
1+
import { BaseCommand } from "../../base-command";
22
import { getOrg, getApp, writeFile, fetchApp } from "../../util";
33
import { flags } from "@contentstack/cli-utilities";
44
import { commonMsg } from "../../messages";
55

66
export default class Get extends BaseCommand<typeof Get> {
7-
static hidden: boolean = false;
8-
97
static description = "Get details of an app in developer hub";
108

119
static examples = [

src/commands/app/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ import { print } from "../../util/log";
77
export default class App extends Command {
88
static description = "Apps CLI plugin";
99

10-
static hidden: boolean = true;
11-
1210
static examples = [
1311
"$ <%= config.bin %> <%= command.id %>:create",
1412
"$ <%= config.bin %> <%= command.id %>:get",

0 commit comments

Comments
 (0)