Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
// "auth:status"
// "portal:quickstart",
// "portal:generate",
// "portal:new:toc",
// "portal:toc:new",
//"--expand-endpoints",
//"--expand-models",
// "--force",
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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 <value>] [--folder <value>] [--force] [--expand-endpoints]
$ apimatic portal:toc:new [--destination <value>] [--folder <value>] [--force] [--expand-endpoints]
[--expand-models]

FLAGS
Expand All @@ -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`

Expand Down
Original file line number Diff line number Diff line change
@@ -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";

Expand Down Expand Up @@ -178,4 +178,4 @@ export class PortalNewTocAction {
return defaultSpecFolder;
}
}
}
}
Original file line number Diff line number Diff line change
@@ -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) {}
Expand Down
Original file line number Diff line number Diff line change
@@ -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<TocGroup[]> {
Expand Down
Original file line number Diff line number Diff line change
@@ -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(
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
`
];
Expand All @@ -56,7 +56,7 @@ A new toc file has been created at ./portal/content/toc.yml
}

async run(): Promise<void> {
const { flags } = await this.parse(PortalNewToc);
const { flags } = await this.parse(PortalTocNew);
const portalNewTocAction = new PortalNewTocAction();
const result = await portalNewTocAction.createToc(
flags.folder,
Expand All @@ -71,4 +71,4 @@ A new toc file has been created at ./portal/content/toc.yml
this.error(result.error!);
}
}
}
}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -143,4 +143,4 @@ describe("SdlParser", () => {
expect(groupNames).to.deep.equal(["Authentication", "Products"]);
});
});
});
});
Original file line number Diff line number Diff line change
@@ -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";

Expand Down
Original file line number Diff line number Diff line change
@@ -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", () => {
Expand Down