Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
armandobelardo committed Apr 19, 2024
1 parent c1eb6b4 commit 3f5eb1f
Show file tree
Hide file tree
Showing 10 changed files with 9 additions and 59 deletions.
2 changes: 1 addition & 1 deletion generators/commons/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"@fern-api/fs-utils": "workspace:*",
"@fern-api/logger": "workspace:*",
"@fern-api/logging-execa": "workspace:*",
"@fern-fern/generator-exec-sdk": "^0.0.730",
"@fern-fern/generator-exec-sdk": "^0.0.748",
"@fern-fern/ir-sdk": "0.0.3294",
"tmp-promise": "^3.0.3",
"zod": "^3.22.3"
Expand Down
2 changes: 1 addition & 1 deletion generators/csharp/sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"@fern-api/fern-csharp-model": "workspace:*",
"@fern-api/fs-utils": "workspace:*",
"@fern-api/generator-commons": "workspace:*",
"@fern-fern/generator-exec-sdk": "^0.0.730",
"@fern-fern/generator-exec-sdk": "^0.0.748",
"@fern-fern/ir-sdk": "0.0.3318",
"lodash-es": "^4.17.21",
"zod": "^3.22.3"
Expand Down
2 changes: 1 addition & 1 deletion generators/ruby/codegen/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
},
"dependencies": {
"@fern-api/fs-utils": "workspace:*",
"@fern-fern/generator-exec-sdk": "^0.0.730",
"@fern-fern/generator-exec-sdk": "^0.0.748",
"@fern-fern/ir-sdk": "^32",
"lodash-es": "^4.17.21",
"url-join": "^5.0.0"
Expand Down
2 changes: 1 addition & 1 deletion generators/ruby/model/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"@fern-api/generator-commons": "workspace:*",
"@fern-api/ruby-codegen": "workspace:*",
"@fern-api/ruby-generator-cli": "workspace:*",
"@fern-fern/generator-exec-sdk": "^0.0.730",
"@fern-fern/generator-exec-sdk": "^0.0.748",
"@fern-fern/ir-sdk": "^32",
"zod": "^3.22.3"
},
Expand Down
2 changes: 1 addition & 1 deletion generators/ruby/sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"@fern-api/generator-commons": "workspace:*",
"@fern-api/ruby-codegen": "workspace:*",
"@fern-api/ruby-generator-cli": "workspace:*",
"@fern-fern/generator-exec-sdk": "^0.0.730",
"@fern-fern/generator-exec-sdk": "^0.0.748",
"@fern-fern/ir-sdk": "^32",
"zod": "^3.22.3"
},
Expand Down
2 changes: 1 addition & 1 deletion generators/typescript/express/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"dockerTagVersion": "./docker/create_docker.sh"
},
"devDependencies": {
"@fern-fern/generator-exec-sdk": "^0.0.730",
"@fern-fern/generator-exec-sdk": "^0.0.748",
"@fern-fern/ir-sdk": "^37.0.0",
"@fern-typescript/abstract-generator-cli": "workspace:*",
"@fern-typescript/commons": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion generators/typescript/sdk/generator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"dependencies": {
"@fern-api/core-utils": "workspace:*",
"@fern-api/fs-utils": "workspace:*",
"@fern-fern/generator-exec-sdk": "^0.0.730",
"@fern-fern/generator-exec-sdk": "^0.0.748",
"@fern-fern/ir-sdk": "^37.0.0",
"@fern-typescript/commons": "workspace:*",
"@fern-typescript/contexts": "workspace:*",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"@fern-api/fs-utils": "workspace:*",
"@fern-api/generator-commons": "workspace:*",
"@fern-api/logger": "workspace:*",
"@fern-fern/generator-exec-sdk": "^0.0.730",
"@fern-fern/generator-exec-sdk": "^0.0.748",
"@fern-fern/ir-sdk": "^37.0.0",
"@fern-typescript/commons": "workspace:*",
"@fern-typescript/contexts": "workspace:*"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
import { FernToken } from "@fern-api/auth";
import { generatorsYml } from "@fern-api/configuration";
import { createFdrTestService } from "@fern-api/core";
import { AbsoluteFilePath } from "@fern-api/fs-utils";
import { TaskContext } from "@fern-api/task-context";
import { FernWorkspace } from "@fern-api/workspace-loader";
import { SnippetRegistryEntry } from "@fern-fern/fdr-test-sdk/api";
import * as FdrSerialization from "@fern-fern/fdr-test-sdk/serialization";
import { FernFiddle } from "@fern-fern/fiddle-sdk";
import { existsSync } from "fs";
import { readFile } from "fs/promises";
import { downloadSnippetsForTask } from "./downloadSnippetsForTask";
import { runRemoteGenerationForGenerator } from "./runRemoteGenerationForGenerator";

Expand Down Expand Up @@ -88,48 +83,3 @@ export async function runRemoteGenerationForAPIWorkspace({
snippetsProducedBy
};
}

async function registerSnippetTemplatesToFdr({
token,
organization,
workspace,
context,
snippetTemplatesPath
}: {
token: FernToken;
organization: string;
workspace: FernWorkspace;
context: TaskContext;
snippetTemplatesPath: AbsoluteFilePath;
}) {
// Process snippet templates here:
const fdr = createFdrTestService({ token: token.value });
try {
// TODO: This should live in generator exec, beside the snippets.json path
// Read in snippet templates from disk and submit to FDR for registration
if (!existsSync(snippetTemplatesPath)) {
context.logger.warn("Snippet templates file not found, no templates registered.");
return;
}
const templatesString = (await readFile(snippetTemplatesPath)).toString();
const templatesJson = JSON.parse(templatesString);
if (!Array.isArray(templatesJson)) {
context.logger.error("Snippet templates were malformed, continuing.");
return;
}
const snippetTemplates: SnippetRegistryEntry[] = templatesJson.map((templateJson) =>
FdrSerialization.SnippetRegistryEntry.parseOrThrow(templateJson, {
unrecognizedObjectKeys: "passthrough"
})
);
await fdr.template.registerBatch({
orgId: organization,
apiId: workspace.name,
snippets: snippetTemplates,
// TODO: Store the API definition ID in the generator invocation for future retrieval
apiDefinitionId: ""
});
} catch (e) {
context.logger.error("Failed to register snippet templates, continuing.", e);
}
}
2 changes: 1 addition & 1 deletion packages/seed/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"@fern-api/task-context": "workspace:*",
"@fern-api/workspace-loader": "workspace:*",
"@fern-fern/fiddle-sdk": "^0.0.508",
"@fern-fern/generator-exec-sdk": "^0.0.730",
"@fern-fern/generator-exec-sdk": "^0.0.748",
"@types/pretty-ms": "^5.0.1",
"chalk": "^5.0.1",
"console-table-printer": "^2.12.0",
Expand Down

0 comments on commit 3f5eb1f

Please sign in to comment.