@apimatic/cli 1.1.0-beta.1 → 1.1.0-beta.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +53 -10
- package/lib/actions/action-result.d.ts +12 -6
- package/lib/actions/action-result.js +36 -10
- package/lib/actions/action-result.js.map +1 -1
- package/lib/actions/api/validate.d.ts +3 -1
- package/lib/actions/api/validate.js +14 -3
- package/lib/actions/api/validate.js.map +1 -1
- package/lib/actions/portal/copilot.js +2 -2
- package/lib/actions/portal/generate.js +7 -1
- package/lib/actions/portal/generate.js.map +1 -1
- package/lib/actions/portal/quickstart.d.ts +4 -3
- package/lib/actions/portal/quickstart.js +42 -19
- package/lib/actions/portal/quickstart.js.map +1 -1
- package/lib/actions/portal/serve.js +0 -14
- package/lib/actions/portal/serve.js.map +1 -1
- package/lib/actions/portal/toc/new-toc.d.ts +5 -5
- package/lib/actions/portal/toc/new-toc.js +39 -40
- package/lib/actions/portal/toc/new-toc.js.map +1 -1
- package/lib/actions/sdk/generate.d.ts +4 -1
- package/lib/actions/sdk/generate.js +62 -17
- package/lib/actions/sdk/generate.js.map +1 -1
- package/lib/actions/sdk/merge-source-tree.d.ts +12 -0
- package/lib/actions/sdk/merge-source-tree.js +78 -0
- package/lib/actions/sdk/merge-source-tree.js.map +1 -0
- package/lib/actions/sdk/quickstart.d.ts +6 -3
- package/lib/actions/sdk/quickstart.js +48 -26
- package/lib/actions/sdk/quickstart.js.map +1 -1
- package/lib/actions/sdk/save-changes.d.ts +8 -0
- package/lib/actions/sdk/save-changes.js +93 -0
- package/lib/actions/sdk/save-changes.js.map +1 -0
- package/lib/application/portal/toc/toc-structure-generator.d.ts +23 -2
- package/lib/application/portal/toc/toc-structure-generator.js +131 -60
- package/lib/application/portal/toc/toc-structure-generator.js.map +1 -1
- package/lib/commands/portal/recipe/new.js +2 -2
- package/lib/commands/portal/recipe/new.js.map +1 -1
- package/lib/commands/portal/toc/new.d.ts +5 -3
- package/lib/commands/portal/toc/new.js +34 -26
- package/lib/commands/portal/toc/new.js.map +1 -1
- package/lib/commands/quickstart.js +1 -1
- package/lib/commands/quickstart.js.map +1 -1
- package/lib/commands/sdk/generate.d.ts +4 -2
- package/lib/commands/sdk/generate.js +29 -11
- package/lib/commands/sdk/generate.js.map +1 -1
- package/lib/commands/sdk/save-changes.d.ts +14 -0
- package/lib/commands/sdk/save-changes.js +51 -0
- package/lib/commands/sdk/save-changes.js.map +1 -0
- package/lib/hooks/not-found.js +1 -1
- package/lib/hooks/not-found.js.map +1 -1
- package/lib/infrastructure/debounce-service.js +3 -0
- package/lib/infrastructure/debounce-service.js.map +1 -1
- package/lib/infrastructure/file-service.d.ts +6 -0
- package/lib/infrastructure/file-service.js +58 -1
- package/lib/infrastructure/file-service.js.map +1 -1
- package/lib/infrastructure/git-service.d.ts +15 -0
- package/lib/infrastructure/git-service.js +93 -0
- package/lib/infrastructure/git-service.js.map +1 -0
- package/lib/infrastructure/launcher-service.d.ts +2 -0
- package/lib/infrastructure/launcher-service.js +22 -1
- package/lib/infrastructure/launcher-service.js.map +1 -1
- package/lib/infrastructure/service-error.d.ts +13 -2
- package/lib/infrastructure/service-error.js +23 -9
- package/lib/infrastructure/service-error.js.map +1 -1
- package/lib/infrastructure/services/api-service.d.ts +2 -1
- package/lib/infrastructure/services/api-service.js +24 -0
- package/lib/infrastructure/services/api-service.js.map +1 -1
- package/lib/infrastructure/services/portal-service.d.ts +6 -4
- package/lib/infrastructure/services/portal-service.js +96 -59
- package/lib/infrastructure/services/portal-service.js.map +1 -1
- package/lib/infrastructure/services/validation-service.d.ts +28 -2
- package/lib/infrastructure/services/validation-service.js +108 -15
- package/lib/infrastructure/services/validation-service.js.map +1 -1
- package/lib/infrastructure/zip-service.js +1 -1
- package/lib/infrastructure/zip-service.js.map +1 -1
- package/lib/prompts/api/validate.d.ts +5 -2
- package/lib/prompts/api/validate.js +36 -0
- package/lib/prompts/api/validate.js.map +1 -1
- package/lib/prompts/format.d.ts +1 -1
- package/lib/prompts/format.js.map +1 -1
- package/lib/prompts/portal/generate.d.ts +1 -1
- package/lib/prompts/portal/generate.js +9 -3
- package/lib/prompts/portal/generate.js.map +1 -1
- package/lib/prompts/portal/quickstart.d.ts +3 -0
- package/lib/prompts/portal/quickstart.js +39 -2
- package/lib/prompts/portal/quickstart.js.map +1 -1
- package/lib/prompts/portal/toc/new-toc.d.ts +1 -1
- package/lib/prompts/portal/toc/new-toc.js +10 -2
- package/lib/prompts/portal/toc/new-toc.js.map +1 -1
- package/lib/prompts/sdk/generate.d.ts +11 -4
- package/lib/prompts/sdk/generate.js +37 -11
- package/lib/prompts/sdk/generate.js.map +1 -1
- package/lib/prompts/sdk/merge-source-tree.d.ts +22 -0
- package/lib/prompts/sdk/merge-source-tree.js +90 -0
- package/lib/prompts/sdk/merge-source-tree.js.map +1 -0
- package/lib/prompts/sdk/quickstart.d.ts +4 -1
- package/lib/prompts/sdk/quickstart.js +41 -4
- package/lib/prompts/sdk/quickstart.js.map +1 -1
- package/lib/prompts/sdk/save-changes.d.ts +21 -0
- package/lib/prompts/sdk/save-changes.js +84 -0
- package/lib/prompts/sdk/save-changes.js.map +1 -0
- package/lib/types/build/build.d.ts +2 -0
- package/lib/types/build/build.js.map +1 -1
- package/lib/types/build-context.d.ts +10 -0
- package/lib/types/build-context.js +71 -1
- package/lib/types/build-context.js.map +1 -1
- package/lib/types/events/sdk-changes-saved.d.ts +8 -0
- package/lib/types/events/sdk-changes-saved.js +11 -0
- package/lib/types/events/sdk-changes-saved.js.map +1 -0
- package/lib/types/events/sdk-changes-tracked.d.ts +8 -0
- package/lib/types/events/sdk-changes-tracked.js +11 -0
- package/lib/types/events/sdk-changes-tracked.js.map +1 -0
- package/lib/types/events/sdk-conflicts-resolved.d.ts +8 -0
- package/lib/types/events/sdk-conflicts-resolved.js +11 -0
- package/lib/types/events/sdk-conflicts-resolved.js.map +1 -0
- package/lib/types/file/directory.d.ts +10 -1
- package/lib/types/file/directory.js +63 -5
- package/lib/types/file/directory.js.map +1 -1
- package/lib/types/file/directoryPath.js.map +1 -1
- package/lib/types/merge-source-tree-context.d.ts +28 -0
- package/lib/types/merge-source-tree-context.js +62 -0
- package/lib/types/merge-source-tree-context.js.map +1 -0
- package/lib/types/save-changes-context.d.ts +17 -0
- package/lib/types/save-changes-context.js +42 -0
- package/lib/types/save-changes-context.js.map +1 -0
- package/lib/types/sdk-context.d.ts +5 -4
- package/lib/types/sdk-context.js +26 -13
- package/lib/types/sdk-context.js.map +1 -1
- package/lib/types/sdl/sdl.d.ts +20 -3
- package/lib/types/sdl/sdl.js +120 -22
- package/lib/types/sdl/sdl.js.map +1 -1
- package/lib/types/spec-context.js.map +1 -1
- package/lib/types/temp-context.js.map +1 -1
- package/lib/types/toc/toc.d.ts +31 -6
- package/lib/utils/string-utils.d.ts +1 -0
- package/lib/utils/string-utils.js +42 -0
- package/lib/utils/string-utils.js.map +1 -1
- package/package.json +3 -2
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { PortalService } from "../../../infrastructure/services/portal-service.js";
|
|
1
|
+
import { PortalNewTocPrompts } from '../../../prompts/portal/toc/new-toc.js';
|
|
2
|
+
import { TocStructureGenerator } from '../../../application/portal/toc/toc-structure-generator.js';
|
|
3
|
+
import { ActionResult } from '../../action-result.js';
|
|
4
|
+
import { TocContext } from '../../../types/toc-context.js';
|
|
5
|
+
import { FileService } from '../../../infrastructure/file-service.js';
|
|
6
|
+
import { BuildContext } from '../../../types/build-context.js';
|
|
7
|
+
import { extractCallbacksForToc, extractEndpointGroupsForToc, extractModelsForToc, extractWebhooksForToc } from '../../../types/sdl/sdl.js';
|
|
8
|
+
import { withDirPath } from '../../../infrastructure/tmp-extensions.js';
|
|
9
|
+
import { TempContext } from '../../../types/temp-context.js';
|
|
10
|
+
import { PortalService } from '../../../infrastructure/services/portal-service.js';
|
|
12
11
|
export class ContentContext {
|
|
13
12
|
constructor(contentDirectory) {
|
|
14
13
|
this.contentDirectory = contentDirectory;
|
|
@@ -31,7 +30,7 @@ export class PortalNewTocAction {
|
|
|
31
30
|
this.fileService = new FileService();
|
|
32
31
|
this.portalService = new PortalService();
|
|
33
32
|
}
|
|
34
|
-
async execute(buildDirectory, tocDirectory, force = false, expandEndpoints = false, expandModels = false) {
|
|
33
|
+
async execute(buildDirectory, tocDirectory, force = false, expandEndpoints = false, expandModels = false, expandWebhooks = false, expandCallbacks = false) {
|
|
35
34
|
var _a, _b;
|
|
36
35
|
// Validate build directory
|
|
37
36
|
const buildContext = new BuildContext(buildDirectory);
|
|
@@ -40,43 +39,43 @@ export class PortalNewTocAction {
|
|
|
40
39
|
return ActionResult.failed();
|
|
41
40
|
}
|
|
42
41
|
const buildConfig = await buildContext.getBuildFileContents();
|
|
43
|
-
const contentDirectory = buildDirectory.join((_b = (_a = buildConfig.generatePortal) === null || _a === void 0 ? void 0 : _a.contentFolder) !== null && _b !== void 0 ? _b :
|
|
42
|
+
const contentDirectory = buildDirectory.join((_b = (_a = buildConfig.generatePortal) === null || _a === void 0 ? void 0 : _a.contentFolder) !== null && _b !== void 0 ? _b : 'content');
|
|
44
43
|
const tocDir = tocDirectory !== null && tocDirectory !== void 0 ? tocDirectory : contentDirectory;
|
|
45
44
|
const tocContext = new TocContext(tocDir);
|
|
46
45
|
if (!force && (await tocContext.exists()) && !(await this.prompts.overwriteToc(tocContext.tocPath))) {
|
|
47
46
|
this.prompts.tocFileAlreadyExists();
|
|
48
47
|
return ActionResult.cancelled();
|
|
49
48
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
49
|
+
const sdlTocComponents = await (async () => {
|
|
50
|
+
const defaultComponents = {
|
|
51
|
+
endpointGroups: new Map(),
|
|
52
|
+
models: [],
|
|
53
|
+
webhookGroups: new Map(),
|
|
54
|
+
callbackGroups: new Map()
|
|
55
|
+
};
|
|
56
|
+
const specDirectory = buildDirectory.join('spec');
|
|
53
57
|
if (!(await this.fileService.directoryExists(specDirectory))) {
|
|
54
58
|
this.prompts.fallingBackToDefault();
|
|
59
|
+
return defaultComponents;
|
|
55
60
|
}
|
|
56
|
-
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
return ok({ endpointGroups: new Map(), models: [] });
|
|
66
|
-
}
|
|
67
|
-
return ok(getEndpointGroupsAndModels(result.value));
|
|
68
|
-
}
|
|
69
|
-
finally {
|
|
70
|
-
specFileStream.close();
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
if (sdlResult.isErr()) {
|
|
74
|
-
this.prompts.logError(sdlResult.error);
|
|
75
|
-
return ActionResult.failed();
|
|
61
|
+
return await withDirPath(async (tempDirectory) => {
|
|
62
|
+
const tempContext = new TempContext(tempDirectory);
|
|
63
|
+
const specZipPath = await tempContext.zip(specDirectory);
|
|
64
|
+
const specFileStream = await this.fileService.getStream(specZipPath);
|
|
65
|
+
const result = await this.prompts.extractComponents(this.portalService.generateSdl(specFileStream, this.configDirectory, this.commandMetadata), expandEndpoints, expandModels, expandWebhooks, expandCallbacks);
|
|
66
|
+
specFileStream.close();
|
|
67
|
+
if (result.isErr()) {
|
|
68
|
+
this.prompts.fallingBackToDefault();
|
|
69
|
+
return defaultComponents;
|
|
76
70
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
71
|
+
return {
|
|
72
|
+
endpointGroups: extractEndpointGroupsForToc(result.value),
|
|
73
|
+
models: extractModelsForToc(result.value),
|
|
74
|
+
webhookGroups: extractWebhooksForToc(result.value),
|
|
75
|
+
callbackGroups: extractCallbacksForToc(result.value)
|
|
76
|
+
};
|
|
77
|
+
});
|
|
78
|
+
})();
|
|
80
79
|
const contentContext = new ContentContext(contentDirectory);
|
|
81
80
|
const contentExists = await contentContext.exists();
|
|
82
81
|
let contentGroups;
|
|
@@ -87,7 +86,7 @@ export class PortalNewTocAction {
|
|
|
87
86
|
else {
|
|
88
87
|
contentGroups = await contentContext.extractContentGroups();
|
|
89
88
|
}
|
|
90
|
-
const toc = this.tocGenerator.createTocStructure(
|
|
89
|
+
const toc = this.tocGenerator.createTocStructure({ data: sdlTocComponents.endpointGroups, expand: expandEndpoints }, { data: sdlTocComponents.models, expand: expandModels }, { data: sdlTocComponents.webhookGroups, expand: expandWebhooks }, { data: sdlTocComponents.callbackGroups, expand: expandCallbacks }, contentGroups);
|
|
91
90
|
const yamlString = this.tocGenerator.transformToYaml(toc);
|
|
92
91
|
const tocFilePath = await tocContext.save(yamlString);
|
|
93
92
|
this.prompts.tocCreated(tocFilePath);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"new-toc.js","sourceRoot":"","sources":["../../../../src/actions/portal/toc/new-toc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"new-toc.js","sourceRoot":"","sources":["../../../../src/actions/portal/toc/new-toc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,qBAAqB,EAAE,MAAM,4DAA4D,CAAC;AAInG,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EACL,sBAAsB,EACtB,2BAA2B,EAC3B,mBAAmB,EACnB,qBAAqB,EAEtB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,M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,GAAG,MAAM,cAAc,CAAC,oBAAoB,EAAE,CAAC;QAC9D,CAAC;QAED,MAAM,GAAG,GAAG,IAAI,CAAC,YAAY,CAAC,kBAAkB,CAC9C,EAAE,IAAI,EAAE,gBAAgB,CAAC,cAAc,EAAE,MAAM,EAAE,eAAe,EAAE,EAClE,EAAE,IAAI,EAAE,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,EACvD,EAAE,IAAI,EAAE,gBAAgB,CAAC,aAAa,EAAE,MAAM,EAAE,cAAc,EAAE,EAChE,EAAE,IAAI,EAAE,gBAAgB,CAAC,cAAc,EAAE,MAAM,EAAE,eAAe,EAAE,EAClE,aAAa,CACd,CAAC;QACF,MAAM,UAAU,GAAG,IAAI,CAAC,YAAY,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;QAC1D,MAAM,WAAW,GAAG,MAAM,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAEtD,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;QAErC,OAAO,YAAY,CAAC,OAAO,EAAE,CAAC;IAChC,CAAC;CACF"}
|
|
@@ -9,5 +9,8 @@ export declare class GenerateAction {
|
|
|
9
9
|
private readonly commandMetadata;
|
|
10
10
|
private readonly authKey;
|
|
11
11
|
constructor(configDir: DirectoryPath, commandMetadata: CommandMetadata, authKey?: string | null);
|
|
12
|
-
readonly execute: (
|
|
12
|
+
readonly execute: (buildDirectory: DirectoryPath, destinationSdkDirectory: DirectoryPath, language: Language, force: boolean, zipSdk: boolean, skipChanges: boolean, trackChanges: boolean, apiVersion?: string) => Promise<ActionResult<{
|
|
13
|
+
sourceTreeTrackingInitiated: boolean;
|
|
14
|
+
conflictsResolved: boolean;
|
|
15
|
+
}>>;
|
|
13
16
|
}
|
|
@@ -2,41 +2,86 @@ import { PortalService } from "../../infrastructure/services/portal-service.js";
|
|
|
2
2
|
import { ActionResult } from "../action-result.js";
|
|
3
3
|
import { withDirPath } from "../../infrastructure/tmp-extensions.js";
|
|
4
4
|
import { SdkContext } from "../../types/sdk-context.js";
|
|
5
|
-
import { SpecContext } from "../../types/spec-context.js";
|
|
6
5
|
import { SdkGeneratePrompts } from "../../prompts/sdk/generate.js";
|
|
7
6
|
import { TempContext } from "../../types/temp-context.js";
|
|
7
|
+
import { MergeSourceTreeAction } from "./merge-source-tree.js";
|
|
8
|
+
import { BuildContext } from "../../types/build-context.js";
|
|
8
9
|
export class GenerateAction {
|
|
9
10
|
constructor(configDir, commandMetadata, authKey = null) {
|
|
10
11
|
this.prompts = new SdkGeneratePrompts();
|
|
11
12
|
this.portalService = new PortalService();
|
|
12
|
-
this.execute = async (
|
|
13
|
-
if (
|
|
14
|
-
this.prompts.
|
|
13
|
+
this.execute = async (buildDirectory, destinationSdkDirectory, language, force, zipSdk, skipChanges, trackChanges, apiVersion) => {
|
|
14
|
+
if (buildDirectory.isEqual(destinationSdkDirectory)) {
|
|
15
|
+
this.prompts.sameBuildAndSdkDir(buildDirectory);
|
|
15
16
|
return ActionResult.failed();
|
|
16
17
|
}
|
|
17
|
-
const
|
|
18
|
-
if (!(await
|
|
19
|
-
this.prompts.
|
|
18
|
+
const rootBuildContext = new BuildContext(buildDirectory);
|
|
19
|
+
if (!(await rootBuildContext.exists())) {
|
|
20
|
+
this.prompts.srcDirectoryEmpty(buildDirectory);
|
|
20
21
|
return ActionResult.failed();
|
|
21
22
|
}
|
|
22
|
-
const
|
|
23
|
-
|
|
23
|
+
const versionedContextGetter = async () => {
|
|
24
|
+
if (!await rootBuildContext.isVersionedBuild()) {
|
|
25
|
+
if (apiVersion)
|
|
26
|
+
this.prompts.apiVersionOnlyApplicableWithVersionedBuild();
|
|
27
|
+
return { version: undefined, buildContext: rootBuildContext };
|
|
28
|
+
}
|
|
29
|
+
const versionedBuildDirectory = await rootBuildContext.getVersionedBuildDirectory();
|
|
30
|
+
if (!versionedBuildDirectory) {
|
|
31
|
+
this.prompts.invalidVersionedDocsDirectory(buildDirectory);
|
|
32
|
+
return ActionResult.failed();
|
|
33
|
+
}
|
|
34
|
+
const singleVersionedBuildDirectory = await rootBuildContext.getSingleVersionedBuildDirectory();
|
|
35
|
+
if (!apiVersion && singleVersionedBuildDirectory) {
|
|
36
|
+
return {
|
|
37
|
+
version: singleVersionedBuildDirectory.leafName(),
|
|
38
|
+
buildContext: new BuildContext(singleVersionedBuildDirectory)
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
const selectedVersionedBuildDirectory = await rootBuildContext.getSelectedVersionedBuildDirectory(apiVersion ? async () => apiVersion : this.prompts.selectVersion);
|
|
42
|
+
if (!selectedVersionedBuildDirectory) {
|
|
43
|
+
this.prompts.versionNotFound();
|
|
44
|
+
return ActionResult.failed();
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
version: selectedVersionedBuildDirectory.leafName(),
|
|
48
|
+
buildContext: new BuildContext(selectedVersionedBuildDirectory)
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
const versionedContext = await versionedContextGetter();
|
|
52
|
+
if (versionedContext instanceof ActionResult) {
|
|
53
|
+
return versionedContext;
|
|
54
|
+
}
|
|
55
|
+
const { version, buildContext } = versionedContext;
|
|
56
|
+
if (!(await buildContext.getSpecContext().validate())) {
|
|
57
|
+
this.prompts.specDirectoryEmpty(buildDirectory);
|
|
58
|
+
return ActionResult.failed();
|
|
59
|
+
}
|
|
60
|
+
const hasSdkSourceTree = await buildContext.hasSdkSourceTree(language);
|
|
61
|
+
const sdkContext = new SdkContext(language, destinationSdkDirectory, skipChanges && hasSdkSourceTree, version);
|
|
62
|
+
if (!force && await sdkContext.exists() && !(await this.prompts.overwriteSdk(destinationSdkDirectory))) {
|
|
24
63
|
this.prompts.destinationDirNotEmpty();
|
|
25
64
|
return ActionResult.cancelled();
|
|
26
65
|
}
|
|
27
66
|
return await withDirPath(async (tempDirectory) => {
|
|
28
67
|
const tempContext = new TempContext(tempDirectory);
|
|
29
|
-
const
|
|
30
|
-
const response = await this.prompts.generateSDK(this.portalService.generateSdk(
|
|
31
|
-
// TODO: this should be service error
|
|
68
|
+
const buildZipPath = await tempContext.zip(buildContext.getBuildDirectory());
|
|
69
|
+
const response = await this.prompts.generateSDK(this.portalService.generateSdk(buildZipPath, language, this.configDir, this.commandMetadata, this.authKey));
|
|
32
70
|
if (response.isErr()) {
|
|
33
|
-
this.prompts.
|
|
71
|
+
this.prompts.sdkGenerationServiceError(response.error);
|
|
34
72
|
return ActionResult.failed();
|
|
35
73
|
}
|
|
36
|
-
const
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
74
|
+
const responseSdkZipPath = await tempContext.save(response.value.sdk);
|
|
75
|
+
const tempSdk = await sdkContext.loadSdkInTempDirectory(tempDirectory, responseSdkZipPath);
|
|
76
|
+
if (!trackChanges && !hasSdkSourceTree) {
|
|
77
|
+
this.prompts.sdkGenerated(await sdkContext.save(tempSdk, zipSdk));
|
|
78
|
+
return ActionResult.success();
|
|
79
|
+
}
|
|
80
|
+
const sdkSourceTreeTempFilePath = await tempContext.save(response.value.sdkSourceTree);
|
|
81
|
+
const tempSdkWithSourceTree = await sdkContext.loadSdkWithSourceTreeInTempDirectory(tempDirectory, responseSdkZipPath, sdkSourceTreeTempFilePath);
|
|
82
|
+
const destinationSourceTreePath = buildContext.getSdkSourceTree(language);
|
|
83
|
+
const mergeSourceTree = new MergeSourceTreeAction();
|
|
84
|
+
return await mergeSourceTree.execute(tempSdkWithSourceTree, tempSdk, destinationSourceTreePath, trackChanges, skipChanges, hasSdkSourceTree, language, destinationSdkDirectory, version, zipSdk);
|
|
40
85
|
});
|
|
41
86
|
};
|
|
42
87
|
this.configDir = configDir;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.js","sourceRoot":"","sources":["../../../src/actions/sdk/generate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iDAAiD,CAAC;AAEhF,OAAO,EAAE,YAAY,EAAE,MAAM,qBA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OAAO,EAAE,yBAAyB,EAAE,YAAY,EAAE,WAAW,EAAE,gBAAgB,EACtG,QAAQ,EAAE,uBAAuB,EAAE,OAAO,EAAE,MAAM,CACnD,CAAC;YACJ,CAAC,CAAC,CAAC;QACL,CAAC,CAAC;QAnHA,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;QACvC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;CAiHF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { DirectoryPath } from "../../types/file/directoryPath.js";
|
|
2
|
+
import { FilePath } from "../../types/file/filePath.js";
|
|
3
|
+
import { Language } from "../../types/sdk/generate.js";
|
|
4
|
+
import { ActionResult } from "../action-result.js";
|
|
5
|
+
export declare class MergeSourceTreeAction {
|
|
6
|
+
private readonly prompts;
|
|
7
|
+
private readonly launcherService;
|
|
8
|
+
readonly execute: (sdkWithSourceTree: DirectoryPath, sdkWithoutSourceTree: DirectoryPath, destinationSourceTreePath: FilePath, trackChanges: boolean, skipChanges: boolean, hasSdkSourceTree: boolean, language: Language, outputSdkDirectory: DirectoryPath, version: string | undefined, zipSdk: boolean) => Promise<ActionResult<{
|
|
9
|
+
sourceTreeTrackingInitiated: boolean;
|
|
10
|
+
conflictsResolved: boolean;
|
|
11
|
+
}>>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { LauncherService } from "../../infrastructure/launcher-service.js";
|
|
2
|
+
import { MergeSourceTreePrompts } from "../../prompts/sdk/merge-source-tree.js";
|
|
3
|
+
import { ActionResult } from "../action-result.js";
|
|
4
|
+
import isInCi from "is-in-ci";
|
|
5
|
+
import { MergeSourceTreeContext } from "../../types/merge-source-tree-context.js";
|
|
6
|
+
import { SdkContext } from "../../types/sdk-context.js";
|
|
7
|
+
export class MergeSourceTreeAction {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.prompts = new MergeSourceTreePrompts();
|
|
10
|
+
this.launcherService = new LauncherService();
|
|
11
|
+
this.execute = async (sdkWithSourceTree, sdkWithoutSourceTree, destinationSourceTreePath, trackChanges, skipChanges, hasSdkSourceTree, language, outputSdkDirectory, version, zipSdk) => {
|
|
12
|
+
const mergeSourceTreeContext = new MergeSourceTreeContext(sdkWithSourceTree, sdkWithoutSourceTree, destinationSourceTreePath, trackChanges, skipChanges, hasSdkSourceTree);
|
|
13
|
+
const sdkContext = new SdkContext(language, outputSdkDirectory, skipChanges && hasSdkSourceTree, version);
|
|
14
|
+
const saveSdk = async () => await sdkContext.save(sdkWithoutSourceTree, zipSdk);
|
|
15
|
+
const { hasSkippedChangesEnabled, hasSkippedCustomizations } = await mergeSourceTreeContext.saveSkippingChanges();
|
|
16
|
+
if (hasSkippedCustomizations) {
|
|
17
|
+
this.prompts.successfullySkippedChanges(language);
|
|
18
|
+
this.prompts.sdkGenerated(await saveSdk());
|
|
19
|
+
return ActionResult.success();
|
|
20
|
+
}
|
|
21
|
+
if (hasSkippedChangesEnabled) {
|
|
22
|
+
this.prompts.sdkGenerated(await saveSdk());
|
|
23
|
+
return ActionResult.success();
|
|
24
|
+
}
|
|
25
|
+
const { hasSourceTreeTracked, hasSourceTreeAlreadyTracked, hasAppliedCustomizations } = await mergeSourceTreeContext.saveWithoutConflicts();
|
|
26
|
+
if (hasAppliedCustomizations) {
|
|
27
|
+
this.prompts.successfullyAppliedChanges(language);
|
|
28
|
+
this.prompts.sdkGeneratedWithSourceTree(await saveSdk(), destinationSourceTreePath);
|
|
29
|
+
return ActionResult.success();
|
|
30
|
+
}
|
|
31
|
+
if (hasSourceTreeAlreadyTracked) {
|
|
32
|
+
this.prompts.changeTrackingAlreadyEnabled(language);
|
|
33
|
+
this.prompts.sdkGeneratedWithSourceTree(await saveSdk(), destinationSourceTreePath);
|
|
34
|
+
return ActionResult.success();
|
|
35
|
+
}
|
|
36
|
+
if (hasSourceTreeTracked) {
|
|
37
|
+
this.prompts.sdkGenerated(await saveSdk());
|
|
38
|
+
this.prompts.changeTrackingEnabled(language, destinationSourceTreePath);
|
|
39
|
+
return ActionResult.success({ sourceTreeTrackingInitiated: true, conflictsResolved: false });
|
|
40
|
+
}
|
|
41
|
+
this.prompts.startApplyingConflictedChanges(language);
|
|
42
|
+
let conflictedFilesDirectory = await mergeSourceTreeContext.getConflictedFilesDirectory();
|
|
43
|
+
if (isInCi) {
|
|
44
|
+
this.prompts.conflictsDetectedInCi(language, conflictedFilesDirectory);
|
|
45
|
+
return ActionResult.failed();
|
|
46
|
+
}
|
|
47
|
+
while (!conflictedFilesDirectory.isEmpty()) {
|
|
48
|
+
this.prompts.conflictsDetected(conflictedFilesDirectory);
|
|
49
|
+
if (!await this.prompts.resolveNowOrAbandon()) {
|
|
50
|
+
this.prompts.mergeAbandoned(language);
|
|
51
|
+
return ActionResult.failed();
|
|
52
|
+
}
|
|
53
|
+
if (await this.launcherService.isIdeAvailable()) {
|
|
54
|
+
this.prompts.openingVsCodeForConflictResolution(language);
|
|
55
|
+
await this.launcherService.openFolderInIdeWithWait(sdkWithSourceTree, conflictedFilesDirectory.getAllFiles());
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
this.prompts.openFilesForConflictResolution(language, sdkWithSourceTree);
|
|
59
|
+
}
|
|
60
|
+
const response = await this.prompts.confirmConflictsResolved();
|
|
61
|
+
if (response === "cancelled") {
|
|
62
|
+
this.prompts.mergeAbandoned(language);
|
|
63
|
+
return ActionResult.failed();
|
|
64
|
+
}
|
|
65
|
+
if (response === "resolved") {
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
conflictedFilesDirectory = await mergeSourceTreeContext.getConflictedFilesDirectory();
|
|
69
|
+
}
|
|
70
|
+
await mergeSourceTreeContext.saveWithResolvedConflicts();
|
|
71
|
+
this.prompts.conflictsResolved(language);
|
|
72
|
+
this.prompts.sdkGeneratedWithSourceTree(await saveSdk(), destinationSourceTreePath);
|
|
73
|
+
await mergeSourceTreeContext.cleanUp(() => this.prompts.directoryStillOpen(sdkWithSourceTree));
|
|
74
|
+
return ActionResult.success({ sourceTreeTrackingInitiated: false, conflictsResolved: true });
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=merge-source-tree.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merge-source-tree.js","sourceRoot":"","sources":["../../../src/actions/sdk/merge-source-tree.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAC3E,OAAO,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AAEhF,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,MAAM,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,sBAAsB,EAAE,MAAM,0CAA0C,CAAC;AAClF,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAExD,MAAM,OAAO,qBAAqB;IAAlC;QACmB,YAAO,GAAG,IAAI,sBAAsB,EAAE,CAAC;QACvC,oBAAe,GAAG,IAAI,eAAe,EAAE,CAAC;QAEzC,YAAO,GAAG,KAAK,EAC7B,iBAAgC,EAChC,oBAAmC,EACnC,yBAAmC,EACnC,YAAqB,EACrB,WAAoB,EACpB,gBAAyB,EACzB,QAAkB,EAClB,kBAAiC,EACjC,OAA2B,EAC3B,MAAe,EAC4E,EAAE;YAC7F,MAAM,sBAAsB,GAAG,IAAI,sBAAsB,CACvD,iBAAiB,EAAE,oBAAoB,EAAE,yBAAyB,EAClE,YAAY,EAAE,WAAW,EAAE,gBAAgB,CAC5C,CAAC;YACF,MAAM,UAAU,GAAG,IAAI,UAAU,CAAC,QAAQ,EAAE,kBAAkB,EAAE,WAAW,IAAI,gBAAgB,EAAE,OAAO,CAAC,CAAC;YAC1G,MAAM,OAAO,GAAG,KAAK,IAAI,EAAE,CAAC,MAAM,UAAU,CAAC,IAAI,CAAC,oBAAoB,EAA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/D,IAAI,QAAQ,KAAK,WAAW,EAAE,CAAC;oBAC7B,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;oBACtC,OAAO,YAAY,CAAC,MAAM,EAAE,CAAC;gBAC/B,CAAC;gBAED,IAAI,QAAQ,KAAK,UAAU,EAAE,CAAC;oBAC5B,MAAM;gBACR,CAAC;gBAED,wBAAwB,GAAG,MAAM,sBAAsB,CAAC,2BAA2B,EAAE,CAAC;YACxF,CAAC;YAED,MAAM,sBAAsB,CAAC,yBAAyB,EAAE,CAAC;YACzD,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;YACzC,IAAI,CAAC,OAAO,CAAC,0BAA0B,CAAC,MAAM,OAAO,EAAE,EAAE,yBAAyB,CAAC,CAAC;YAEpF,MAAM,sBAAsB,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,iBAAiB,CAAC,CAAC,CAAC;YAC/F,OAAO,YAAY,CAAC,OAAO,CAAC,EAAC,2BAA2B,EAAE,KAAK,EAAE,iBAAiB,EAAE,IAAI,EAAC,CAAC,CAAC;QAC7F,CAAC,CAAC;IACJ,CAAC;CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ActionResult } from
|
|
2
|
-
import { CommandMetadata } from
|
|
3
|
-
import { DirectoryPath } from
|
|
1
|
+
import { ActionResult } from '../action-result.js';
|
|
2
|
+
import { CommandMetadata } from '../../types/common/command-metadata.js';
|
|
3
|
+
import { DirectoryPath } from '../../types/file/directoryPath.js';
|
|
4
4
|
export declare class SdkQuickstartAction {
|
|
5
5
|
private readonly configDir;
|
|
6
6
|
private readonly commandMetadata;
|
|
@@ -9,6 +9,9 @@ export declare class SdkQuickstartAction {
|
|
|
9
9
|
private readonly fileService;
|
|
10
10
|
private readonly launcherService;
|
|
11
11
|
private readonly zipService;
|
|
12
|
+
private readonly validationService;
|
|
13
|
+
private readonly metadataFileUrl;
|
|
14
|
+
private readonly defaultSpecUrl;
|
|
12
15
|
constructor(configDir: DirectoryPath, commandMetadata: CommandMetadata);
|
|
13
16
|
readonly execute: () => Promise<ActionResult>;
|
|
14
17
|
}
|
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
import { SdkQuickstartPrompts } from
|
|
2
|
-
import { ActionResult } from
|
|
3
|
-
import { UrlPath } from
|
|
4
|
-
import { LoginAction } from
|
|
5
|
-
import { getAuthInfo } from
|
|
6
|
-
import { withDirPath } from
|
|
7
|
-
import { FilePath } from
|
|
8
|
-
import { SpecContext } from
|
|
9
|
-
import { ValidateAction } from
|
|
10
|
-
import { FileDownloadService } from
|
|
11
|
-
import { FileService } from
|
|
12
|
-
import { GenerateAction } from
|
|
13
|
-
import { LauncherService } from
|
|
14
|
-
import { ZipService } from
|
|
15
|
-
import { FileName } from
|
|
16
|
-
|
|
17
|
-
const metadataFileUrl = new UrlPath(`https://raw.githubusercontent.com/apimatic/sample-docs-as-code-portal/refs/heads/master/src/spec/APIMATIC-META.json`);
|
|
1
|
+
import { SdkQuickstartPrompts } from '../../prompts/sdk/quickstart.js';
|
|
2
|
+
import { ActionResult } from '../action-result.js';
|
|
3
|
+
import { UrlPath } from '../../types/file/urlPath.js';
|
|
4
|
+
import { LoginAction } from '../auth/login.js';
|
|
5
|
+
import { getAuthInfo } from '../../client-utils/auth-manager.js';
|
|
6
|
+
import { withDirPath } from '../../infrastructure/tmp-extensions.js';
|
|
7
|
+
import { FilePath } from '../../types/file/filePath.js';
|
|
8
|
+
import { SpecContext } from '../../types/spec-context.js';
|
|
9
|
+
import { ValidateAction } from '../api/validate.js';
|
|
10
|
+
import { FileDownloadService } from '../../infrastructure/services/file-download-service.js';
|
|
11
|
+
import { FileService } from '../../infrastructure/file-service.js';
|
|
12
|
+
import { GenerateAction } from './generate.js';
|
|
13
|
+
import { LauncherService } from '../../infrastructure/launcher-service.js';
|
|
14
|
+
import { ZipService } from '../../infrastructure/zip-service.js';
|
|
15
|
+
import { FileName } from '../../types/file/fileName.js';
|
|
16
|
+
import { ValidationService } from '../../infrastructure/services/validation-service.js';
|
|
18
17
|
export class SdkQuickstartAction {
|
|
19
18
|
constructor(configDir, commandMetadata) {
|
|
20
19
|
this.configDir = configDir;
|
|
@@ -24,6 +23,9 @@ export class SdkQuickstartAction {
|
|
|
24
23
|
this.fileService = new FileService();
|
|
25
24
|
this.launcherService = new LauncherService();
|
|
26
25
|
this.zipService = new ZipService();
|
|
26
|
+
this.validationService = new ValidationService(this.configDir);
|
|
27
|
+
this.metadataFileUrl = new UrlPath(`https://raw.githubusercontent.com/apimatic/sample-docs-as-code-portal/refs/heads/master/src/spec/APIMATIC-META.json`);
|
|
28
|
+
this.defaultSpecUrl = new UrlPath(`https://raw.githubusercontent.com/apimatic/sample-docs-as-code-portal/refs/heads/master/src/spec/openapi.json`);
|
|
27
29
|
this.execute = async () => {
|
|
28
30
|
const storedAuth = await getAuthInfo(this.configDir.toString());
|
|
29
31
|
if (!(storedAuth === null || storedAuth === void 0 ? void 0 : storedAuth.authKey)) {
|
|
@@ -33,11 +35,12 @@ export class SdkQuickstartAction {
|
|
|
33
35
|
}
|
|
34
36
|
}
|
|
35
37
|
return await withDirPath(async (tempDirectory) => {
|
|
38
|
+
var _a;
|
|
36
39
|
// Step 1/4
|
|
37
40
|
this.prompts.importSpecStep();
|
|
38
41
|
let specPath;
|
|
39
42
|
while (!specPath) {
|
|
40
|
-
const inputPath = await this.prompts.specPathPrompt(defaultSpecUrl);
|
|
43
|
+
const inputPath = await this.prompts.specPathPrompt(this.defaultSpecUrl);
|
|
41
44
|
if (!inputPath) {
|
|
42
45
|
this.prompts.noSpecSpecified();
|
|
43
46
|
return ActionResult.cancelled();
|
|
@@ -72,7 +75,7 @@ export class SdkQuickstartAction {
|
|
|
72
75
|
this.prompts.fixYourSpec();
|
|
73
76
|
return ActionResult.cancelled();
|
|
74
77
|
}
|
|
75
|
-
const downloadFileResult = await this.prompts.downloadSpecFile(this.fileDownloadService.downloadFile(defaultSpecUrl));
|
|
78
|
+
const downloadFileResult = await this.prompts.downloadSpecFile(this.fileDownloadService.downloadFile(this.defaultSpecUrl));
|
|
76
79
|
if (downloadFileResult.isErr()) {
|
|
77
80
|
this.prompts.serviceError(downloadFileResult.error);
|
|
78
81
|
}
|
|
@@ -81,6 +84,25 @@ export class SdkQuickstartAction {
|
|
|
81
84
|
specPath = await specContext.save(downloadFileResult.value.stream, downloadFileResult.value.filename);
|
|
82
85
|
}
|
|
83
86
|
}
|
|
87
|
+
if (validationResult.isSuccess()) {
|
|
88
|
+
const unallowed = validationResult.getValue();
|
|
89
|
+
if (unallowed && (((_a = unallowed.Features) === null || _a === void 0 ? void 0 : _a.length) > 0 || unallowed.EndpointCount > unallowed.EndpointLimit)) {
|
|
90
|
+
const config = {
|
|
91
|
+
features: unallowed.Features.filter((name) => !!name),
|
|
92
|
+
endpointsToKeep: unallowed.EndpointLimit
|
|
93
|
+
};
|
|
94
|
+
const stripUnallowedFeaturesResult = await this.validationService.stripUnallowedFeatures(specPath, config);
|
|
95
|
+
if (stripUnallowedFeaturesResult.isErr()) {
|
|
96
|
+
this.prompts.splitSpecDetected(unallowed);
|
|
97
|
+
return ActionResult.failed();
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
this.prompts.stripUnallowedFeaturesStep(unallowed);
|
|
101
|
+
const specContext = new SpecContext(tempDirectory);
|
|
102
|
+
specPath = await specContext.save(stripUnallowedFeaturesResult.value, new FileName('pruned-spec.zip'));
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
84
106
|
// Step 3/4
|
|
85
107
|
this.prompts.selectLanguageStep();
|
|
86
108
|
const language = await this.prompts.selectLanguagePrompt();
|
|
@@ -109,12 +131,12 @@ export class SdkQuickstartAction {
|
|
|
109
131
|
break;
|
|
110
132
|
}
|
|
111
133
|
// Setup source directory with the spec folder
|
|
112
|
-
const apimaticMetaFile = await this.prompts.downloadMetadataFile(this.fileDownloadService.downloadFile(metadataFileUrl));
|
|
134
|
+
const apimaticMetaFile = await this.prompts.downloadMetadataFile(this.fileDownloadService.downloadFile(this.metadataFileUrl));
|
|
113
135
|
if (apimaticMetaFile.isErr()) {
|
|
114
136
|
this.prompts.serviceError(apimaticMetaFile.error);
|
|
115
137
|
return ActionResult.failed();
|
|
116
138
|
}
|
|
117
|
-
const tempSpecDirectory = tempDirectory.join(
|
|
139
|
+
const tempSpecDirectory = tempDirectory.join('spec');
|
|
118
140
|
await this.fileService.createDirectoryIfNotExists(tempSpecDirectory);
|
|
119
141
|
const metadataFilePath = new FilePath(tempSpecDirectory, apimaticMetaFile.value.filename);
|
|
120
142
|
await this.fileService.writeFile(metadataFilePath, apimaticMetaFile.value.stream);
|
|
@@ -124,19 +146,19 @@ export class SdkQuickstartAction {
|
|
|
124
146
|
else {
|
|
125
147
|
await this.fileService.copyToDir(specPath, tempSpecDirectory);
|
|
126
148
|
}
|
|
127
|
-
const sourceDirectory = inputDirectory.join(
|
|
128
|
-
const specDirectory = sourceDirectory.join(
|
|
149
|
+
const sourceDirectory = inputDirectory.join('src');
|
|
150
|
+
const specDirectory = sourceDirectory.join('spec');
|
|
129
151
|
await this.fileService.copyDirectoryContents(tempSpecDirectory, specDirectory);
|
|
130
152
|
const srcDirectoryStructure = await this.fileService.getDirectory(sourceDirectory);
|
|
131
153
|
this.prompts.printDirectoryStructure(inputDirectory, srcDirectoryStructure);
|
|
132
|
-
const sdkDirectory = inputDirectory.join(
|
|
154
|
+
const sdkDirectory = inputDirectory.join('sdk');
|
|
133
155
|
const sdkGenerateAction = new GenerateAction(this.configDir, this.commandMetadata);
|
|
134
|
-
const result = await sdkGenerateAction.execute(
|
|
156
|
+
const result = await sdkGenerateAction.execute(sourceDirectory, sdkDirectory, language, true, false, false, false);
|
|
135
157
|
if (result.isFailed()) {
|
|
136
158
|
return ActionResult.failed();
|
|
137
159
|
}
|
|
138
160
|
const languageDirectory = sdkDirectory.join(language);
|
|
139
|
-
const readmeFilePath = new FilePath(languageDirectory, new FileName(
|
|
161
|
+
const readmeFilePath = new FilePath(languageDirectory, new FileName('README.md'));
|
|
140
162
|
if (await this.launcherService.openFolderInIde(languageDirectory, readmeFilePath)) {
|
|
141
163
|
this.prompts.sdkOpenedInEditor();
|
|
142
164
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quickstart.js","sourceRoot":"","sources":["../../../src/actions/sdk/quickstart.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAG/C,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,wDAAwD,CAAC;AAC7F,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"quickstart.js","sourceRoot":"","sources":["../../../src/actions/sdk/quickstart.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,YAAY,E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G,MAAM,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC;gBACnF,IAAI,CAAC,OAAO,CAAC,uBAAuB,CAAC,cAAc,EAAE,qBAAqB,CAAC,CAAC;gBAE5E,MAAM,YAAY,GAAG,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;gBAChD,MAAM,iBAAiB,GAAG,IAAI,cAAc,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;gBACnF,MAAM,MAAM,GAAG,MAAM,iBAAiB,CAAC,OAAO,CAAC,eAAe,EAAE,YAAY,EAAE,QAAoB,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;gBAC/H,IAAI,MAAM,CAAC,QAAQ,EAAE,EAAE,CAAC;oBACtB,OAAO,YAAY,CAAC,MAAM,EAAE,CAAC;gBAC/B,CAAC;gBAED,MAAM,iBAAiB,GAAG,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;gBACtD,MAAM,cAAc,GAAG,IAAI,QAAQ,CAAC,iBAAiB,EAAE,IAAI,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC;gBAClF,IAAI,MAAM,IAAI,CAAC,eAAe,CAAC,eAAe,CAAC,iBAAiB,EAAE,cAAc,CAAC,EAAE,CAAC;oBAClF,IAAI,CAAC,OAAO,CAAC,iBAAiB,EAAE,CAAC;gBACnC,CAAC;gBAED,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC;gBACjD,OAAO,YAAY,CAAC,OAAO,EAAE,CAAC;YAChC,CAAC,CAAC,CAAC;QACL,CAAC,CAAC;IAjKyG,CAAC;CAkK7G"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { DirectoryPath } from "../../types/file/directoryPath.js";
|
|
2
|
+
import { ActionResult } from "../action-result.js";
|
|
3
|
+
import { Language } from "../../types/sdk/generate.js";
|
|
4
|
+
export declare class SaveChangesAction {
|
|
5
|
+
private readonly prompts;
|
|
6
|
+
private readonly launcherService;
|
|
7
|
+
readonly execute: (workingDirectory: DirectoryPath, buildDirectory: DirectoryPath, sdkDirectory: DirectoryPath | undefined, language: Language, apiVersion?: string) => Promise<ActionResult>;
|
|
8
|
+
}
|