diff --git a/.vscode/launch.json b/.vscode/launch.json index a576f17d..6507bd48 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -20,7 +20,7 @@ // "auth:status" // "portal:quickstart", // "portal:generate", - // "portal:new:toc", + // "portal:toc:new", //"--expand-endpoints", //"--expand-models", // "--force", diff --git a/README.md b/README.md index 9f51b627..4447ce30 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ USAGE * [`apimatic autocomplete [SHELL]`](#apimatic-autocomplete-shell) * [`apimatic help [COMMAND]`](#apimatic-help-command) * [`apimatic portal:generate`](#apimatic-portalgenerate) -* [`apimatic portal:new:toc`](#apimatic-portalnewtoc) +* [`apimatic portal:toc:new`](#apimatic-portaltocnew) * [`apimatic portal:quickstart`](#apimatic-portalquickstart) * [`apimatic portal:serve`](#apimatic-portalserve) * [`apimatic sdk:generate`](#apimatic-sdkgenerate) @@ -244,13 +244,13 @@ EXAMPLES _See code: [src/commands/portal/generate.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/portal/generate.ts)_ -## `apimatic portal:new:toc` +## `apimatic portal:toc:new` Generates a TOC file based on the content directory and spec folder provided in your working directory ``` USAGE - $ apimatic portal:new:toc [--destination ] [--folder ] [--force] [--expand-endpoints] + $ apimatic portal:toc:new [--destination ] [--folder ] [--force] [--expand-endpoints] [--expand-models] FLAGS @@ -276,17 +276,17 @@ DESCRIPTION https://docs.apimatic.io/platform-api/#/http/guides/generating-on-prem-api-portal/overview-generating-api-portal EXAMPLES - $ apimatic portal:new:toc --destination="./portal/content/" + $ apimatic portal:toc:new --destination="./portal/content/" A new toc file has been created at ./portal/content/toc.yml - $ apimatic portal:new:toc --folder="./my-project" + $ apimatic portal:toc:new --folder="./my-project" A new toc file has been created at ./my-project/content/toc.yml - $ apimatic portal:new:toc --folder="./my-project" --destination="./portal/content/" + $ apimatic portal:toc:new --folder="./my-project" --destination="./portal/content/" A new toc file has been created at ./portal/content/toc.yml ``` -_See code: [src/commands/portal/new/toc.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/portal/new/toc.ts)_ +_See code: [src/commands/portal/toc/new/toc.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/portal/toc/new/toc.ts)_ ## `apimatic portal:quickstart` diff --git a/src/actions/portal/new/toc.ts b/src/actions/portal/toc/new-toc.ts similarity index 96% rename from src/actions/portal/new/toc.ts rename to src/actions/portal/toc/new-toc.ts index a4b59c91..34a630ad 100644 --- a/src/actions/portal/new/toc.ts +++ b/src/actions/portal/toc/new-toc.ts @@ -1,11 +1,11 @@ import * as path from "path"; import * as fs from "fs-extra"; -import { PortalNewTocPrompts } from "../../../prompts/portal/new/toc"; +import { PortalNewTocPrompts } from "../../../prompts/portal/toc/new-toc"; import { Result } from "../../../types/common/result"; import { getMessageInRedColor } from "../../../utils/utils"; -import { SdlParser } from "../../../application/portal/new/toc/sdl-parser"; -import { TocStructureGenerator } from "../../../application/portal/new/toc/toc-structure-generator"; -import { TocContentParser } from "../../../application/portal/new/toc/toc-content-parser"; +import { SdlParser } from "../../../application/portal/toc/sdl-parser"; +import { TocStructureGenerator } from "../../../application/portal/toc/toc-structure-generator"; +import { TocContentParser } from "../../../application/portal/toc/toc-content-parser"; import { TocEndpoint, TocGroup, TocModel } from "../../../types/toc/toc"; import { PortalService } from "../../../infrastructure/services/portal-service"; @@ -178,4 +178,4 @@ export class PortalNewTocAction { return defaultSpecFolder; } } -} +} \ No newline at end of file diff --git a/src/application/portal/new/toc/sdl-parser.ts b/src/application/portal/toc/sdl-parser.ts similarity index 86% rename from src/application/portal/new/toc/sdl-parser.ts rename to src/application/portal/toc/sdl-parser.ts index 4abd855c..93325349 100644 --- a/src/application/portal/new/toc/sdl-parser.ts +++ b/src/application/portal/toc/sdl-parser.ts @@ -1,9 +1,9 @@ import * as path from "path"; -import { PortalService } from "../../../../infrastructure/services/portal-service"; -import { validateAndZipPortalSource, deleteFile } from "../../../../utils/utils"; -import { TocEndpoint, TocModel } from "../../../../types/toc/toc"; -import { Result } from "../../../../types/common/result"; -import { Sdl, SdlEndpoint, SdlModel } from "../../../../types/sdl/sdl"; +import { PortalService } from "../../../infrastructure/services/portal-service"; +import { validateAndZipPortalSource, deleteFile } from "../../../utils/utils"; +import { TocEndpoint, TocModel } from "../../../types/toc/toc"; +import { Result } from "../../../types/common/result"; +import { Sdl, SdlEndpoint, SdlModel } from "../../../types/sdl/sdl"; export class SdlParser { constructor(private readonly portalService: PortalService) {} diff --git a/src/application/portal/new/toc/toc-content-parser.ts b/src/application/portal/toc/toc-content-parser.ts similarity index 95% rename from src/application/portal/new/toc/toc-content-parser.ts rename to src/application/portal/toc/toc-content-parser.ts index 2e7e01aa..ca139f30 100644 --- a/src/application/portal/new/toc/toc-content-parser.ts +++ b/src/application/portal/toc/toc-content-parser.ts @@ -1,6 +1,6 @@ import * as path from "path"; import * as fs from "fs-extra"; -import { TocGroup, TocCustomPage } from "../../../../types/toc/toc"; +import { TocGroup, TocCustomPage } from "../../../types/toc/toc"; export class TocContentParser { async parseContentFolder(contentFolderPath: string, workingDirectory: string): Promise { diff --git a/src/application/portal/new/toc/toc-structure-generator.ts b/src/application/portal/toc/toc-structure-generator.ts similarity index 98% rename from src/application/portal/new/toc/toc-structure-generator.ts rename to src/application/portal/toc/toc-structure-generator.ts index f86e33e1..e6e318fc 100644 --- a/src/application/portal/new/toc/toc-structure-generator.ts +++ b/src/application/portal/toc/toc-structure-generator.ts @@ -1,5 +1,5 @@ import { stringify } from "yaml"; -import { Toc, TocGroup, TocEndpoint, TocModel, TocEndpointGroupOverview } from "../../../../types/toc/toc"; +import { Toc, TocGroup, TocEndpoint, TocModel, TocEndpointGroupOverview } from "../../../types/toc/toc"; export class TocStructureGenerator { createTocStructure( diff --git a/src/commands/portal/new/toc.ts b/src/commands/portal/toc/new.ts similarity index 86% rename from src/commands/portal/new/toc.ts rename to src/commands/portal/toc/new.ts index 8690c50e..d9683407 100644 --- a/src/commands/portal/new/toc.ts +++ b/src/commands/portal/toc/new.ts @@ -1,10 +1,10 @@ import * as path from "path"; import { Command, Flags } from "@oclif/core"; -import { PortalNewTocAction } from "../../../actions/portal/new/toc"; +import { PortalNewTocAction } from "../../../actions/portal/toc/new-toc"; const DEFAULT_FOLDER = process.cwd(); -export default class PortalNewToc extends Command { +export default class PortalTocNew extends Command { static summary = 'Generates a TOC file based on the content directory and spec folder provided in your working directory'; static description = `This command generates a new Table of Contents (TOC) file used in the @@ -40,13 +40,13 @@ https://docs.apimatic.io/platform-api/#/http/guides/generating-on-prem-api-porta }; static examples = [ - `$ apimatic portal:new:toc --destination="./portal/content/" + `$ apimatic portal:toc:new --destination="./portal/content/" A new toc file has been created at ./portal/content/toc.yml `, - `$ apimatic portal:new:toc --folder="./my-project" + `$ apimatic portal:toc:new --folder="./my-project" A new toc file has been created at ./my-project/content/toc.yml `, - `$ apimatic portal:new:toc --folder="./my-project" --destination="./portal/content/" + `$ apimatic portal:toc:new --folder="./my-project" --destination="./portal/content/" A new toc file has been created at ./portal/content/toc.yml ` ]; @@ -56,7 +56,7 @@ A new toc file has been created at ./portal/content/toc.yml } async run(): Promise { - const { flags } = await this.parse(PortalNewToc); + const { flags } = await this.parse(PortalTocNew); const portalNewTocAction = new PortalNewTocAction(); const result = await portalNewTocAction.createToc( flags.folder, @@ -71,4 +71,4 @@ A new toc file has been created at ./portal/content/toc.yml this.error(result.error!); } } -} \ No newline at end of file +} \ No newline at end of file diff --git a/src/prompts/portal/new/toc.ts b/src/prompts/portal/toc/new-toc.ts similarity index 100% rename from src/prompts/portal/new/toc.ts rename to src/prompts/portal/toc/new-toc.ts diff --git a/test/actions/portal/new/toc.test.ts b/test/actions/portal/toc/new-toc.test.ts similarity index 99% rename from test/actions/portal/new/toc.test.ts rename to test/actions/portal/toc/new-toc.test.ts index f758f931..ed721d30 100644 --- a/test/actions/portal/new/toc.test.ts +++ b/test/actions/portal/toc/new-toc.test.ts @@ -2,7 +2,7 @@ import { expect } from "chai"; import * as path from "path"; import * as fs from "fs-extra"; import { dir as tmpDir, DirectoryResult } from "tmp-promise"; -import { PortalNewTocAction } from "../../../../src/actions/portal/new/toc"; +import { PortalNewTocAction } from "../../../../src/actions/portal/toc/new-toc"; describe("PortalNewTocAction", () => { let TEST_WORKING_DIR: string; diff --git a/test/application/portal/new/toc/sdl-parser.test.ts b/test/application/portal/toc/new/sdl-parser.test.ts similarity index 99% rename from test/application/portal/new/toc/sdl-parser.test.ts rename to test/application/portal/toc/new/sdl-parser.test.ts index 0d2cbd4f..0e86b838 100644 --- a/test/application/portal/new/toc/sdl-parser.test.ts +++ b/test/application/portal/toc/new/sdl-parser.test.ts @@ -1,7 +1,7 @@ import { expect } from "chai"; import * as path from "path"; import * as fs from "fs-extra"; -import { SdlParser } from "../../../../../src/application/portal/new/toc/sdl-parser"; +import { SdlParser } from "../../../../../src/application/portal/toc/sdl-parser"; import { PortalService } from "../../../../../src/infrastructure/services/portal-service"; import { Result } from "../../../../../src/types/common/result"; import { Sdl } from "../../../../../src/types/sdl/sdl"; @@ -143,4 +143,4 @@ describe("SdlParser", () => { expect(groupNames).to.deep.equal(["Authentication", "Products"]); }); }); -}); +}); \ No newline at end of file diff --git a/test/application/portal/new/toc/toc-content-parser.test.ts b/test/application/portal/toc/new/toc-content-parser.test.ts similarity index 99% rename from test/application/portal/new/toc/toc-content-parser.test.ts rename to test/application/portal/toc/new/toc-content-parser.test.ts index 5a101dde..12026eca 100644 --- a/test/application/portal/new/toc/toc-content-parser.test.ts +++ b/test/application/portal/toc/new/toc-content-parser.test.ts @@ -1,7 +1,7 @@ import { expect } from "chai"; import * as path from "path"; import * as fs from "fs-extra"; -import { TocContentParser } from "../../../../../src/application/portal/new/toc/toc-content-parser"; +import { TocContentParser } from "../../../../../src/application/portal/toc/toc-content-parser"; import { TocGroup } from "../../../../../src/types/toc/toc"; import { dir as tmpDir, DirectoryResult } from "tmp-promise"; diff --git a/test/application/portal/new/toc/toc-structure-generator.test.ts b/test/application/portal/toc/new/toc-structure-generator.test.ts similarity index 99% rename from test/application/portal/new/toc/toc-structure-generator.test.ts rename to test/application/portal/toc/new/toc-structure-generator.test.ts index 7b5e56e2..cdf48517 100644 --- a/test/application/portal/new/toc/toc-structure-generator.test.ts +++ b/test/application/portal/toc/new/toc-structure-generator.test.ts @@ -1,5 +1,5 @@ import { expect } from "chai"; -import { TocStructureGenerator } from "../../../../../src/application/portal/new/toc/toc-structure-generator"; +import { TocStructureGenerator } from "../../../../../src/application/portal/toc/toc-structure-generator"; import { TocEndpoint, TocGroup, TocModel, Toc, TocCustomPage } from "../../../../../src/types/toc/toc"; describe("TocStructureGenerator", () => {