Skip to content

Commit

Permalink
chore(go): Setup go-v2 package layout (#5179)
Browse files Browse the repository at this point in the history
  • Loading branch information
amckinney authored Nov 15, 2024
1 parent ebb120d commit d14c499
Show file tree
Hide file tree
Showing 59 changed files with 349 additions and 16 deletions.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "@fern-api/go-codegen",
"name": "@fern-api/go-ast",
"version": "0.0.0",
"repository": {
"type": "git",
"url": "https://github.com/fern-api/fern.git",
"directory": "generators/go-v2/codegen"
"directory": "generators/go-v2/ast"
},
"files": [
"lib"
Expand Down Expand Up @@ -47,4 +47,4 @@
"vitest": "^2.1.4",
"zod": "^3.22.3"
}
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
15 changes: 15 additions & 0 deletions generators/go-v2/base/.depcheckrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"ignores": [
"@types/jest",
"globals",
"globals",
"@types/node",
"esbuild",
"@yarnpkg/esbuild-plugin-pnp",
"@fern-fern/ir-sdk"
],
"ignore-patterns": [
"lib",
"dist"
]
}
1 change: 1 addition & 0 deletions generators/go-v2/base/.prettierrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require("../../../.prettierrc.json");
44 changes: 44 additions & 0 deletions generators/go-v2/base/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"name": "@fern-api/go-base",
"version": "0.0.0",
"repository": {
"type": "git",
"url": "https://github.com/fern-api/fern.git",
"directory": "generators/go-v2/base"
},
"files": [
"lib"
],
"type": "module",
"source": "src/index.ts",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"sideEffects": false,
"scripts": {
"clean": "rm -rf ./lib && tsc --build --clean",
"compile": "tsc --build",
"test": "vitest --passWithNoTests --run",
"test:update": "vitest --passWithNoTests --run -u",
"lint:eslint": "eslint --max-warnings 0 . --ignore-path=../../../.eslintignore",
"lint:eslint:fix": "yarn lint:eslint --fix",
"format": "prettier --write --ignore-unknown --ignore-path ../../../shared/.prettierignore \"**\"",
"format:check": "prettier --check --ignore-unknown --ignore-path ../../../shared/.prettierignore \"**\"",
"organize-imports": "organize-imports-cli tsconfig.json",
"depcheck": "depcheck",
"dist:cli": "pnpm compile && tsup ./src/cli.ts --format cjs",
"publish:cli": "pnpm dist:cli && cd dist && yarn npm publish",
"dockerTagLatest": "pnpm dist:cli && docker build -f ./Dockerfile -t fernapi/fern-go-model:latest ../../.."
},
"devDependencies": {
"@types/node": "18.7.18",
"@yarnpkg/esbuild-plugin-pnp": "^3.0.0-rc.14",
"depcheck": "^1.4.6",
"esbuild": "^0.24.0",
"eslint": "^8.56.0",
"organize-imports-cli": "^0.10.0",
"prettier": "^2.7.1",
"tsup": "^8.0.2",
"typescript": "4.6.4",
"vitest": "^2.0.5"
}
}
6 changes: 6 additions & 0 deletions generators/go-v2/base/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
void runCli();

export async function runCli(): Promise<void> {
// eslint-disable-next-line no-console
console.log("Noop...");
}
2 changes: 2 additions & 0 deletions generators/go-v2/base/src/project/GoProject.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// eslint-disable-next-line @typescript-eslint/no-extraneous-class
export class GoProject {}
1 change: 1 addition & 0 deletions generators/go-v2/base/src/project/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { GoProject } from "./GoProject";
11 changes: 11 additions & 0 deletions generators/go-v2/base/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"extends": "../../../shared/tsconfig.shared.json",
"compilerOptions": { "composite": true, "outDir": "lib", "rootDir": "src" },
"include": ["./src/**/*"],
"references": [
{ "path": "../../../packages/commons/core-utils" },
{ "path": "../../../packages/commons/fs-utils" },
{ "path": "../../commons" },
{ "path": "../ast" }
]
}
4 changes: 2 additions & 2 deletions generators/go-v2/dynamic-snippets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"@fern-api/fern-definition-schema": "workspace:*",
"@fern-api/fs-utils": "workspace:*",
"@fern-api/generator-commons": "workspace:*",
"@fern-api/go-codegen": "workspace:*",
"@fern-api/go-ast": "workspace:*",
"@fern-api/go-formatter": "workspace:*",
"@fern-api/ir-generator": "workspace:*",
"@fern-api/ir-sdk": "workspace:*",
Expand All @@ -51,4 +51,4 @@
"typescript": "4.6.4",
"vitest": "^2.0.5"
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AbstractFormatter, FernGeneratorExec } from "@fern-api/generator-commons";
import { go } from "@fern-api/go-codegen";
import { go } from "@fern-api/go-ast";
import { DynamicSnippetsGeneratorContext } from "./context/DynamicSnippetsGeneratorContext";
import { dynamic as DynamicSnippets } from "@fern-fern/ir-sdk/api";
import { AbstractDynamicSnippetsGenerator } from "@fern-api/dynamic-snippets";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { FernGeneratorExec } from "@fern-api/generator-commons";
import { BaseGoCustomConfigSchema } from "@fern-api/go-codegen";
import { BaseGoCustomConfigSchema } from "@fern-api/go-ast";

const DEFAULT_CONFIG: FernGeneratorExec.GeneratorConfig = {
dryRun: false,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { FernGeneratorExec } from "@fern-api/generator-commons";
import { BaseGoCustomConfigSchema, resolveRootImportPath } from "@fern-api/go-codegen";
import { BaseGoCustomConfigSchema, resolveRootImportPath } from "@fern-api/go-ast";
import { FernFilepath, dynamic as DynamicSnippets, TypeId, Name } from "@fern-fern/ir-sdk/api";
import { HttpEndpointReferenceParser } from "@fern-api/fern-definition-schema";
import { TypeInstance } from "../TypeInstance";
import { DiscriminatedUnionTypeInstance } from "../DiscriminatedUnionTypeInstance";
import { DynamicTypeMapper } from "./DynamicTypeMapper";
import { DynamicTypeInstantiationMapper } from "./DynamicTypeInstantiationMapper";
import { go } from "@fern-api/go-codegen";
import { go } from "@fern-api/go-ast";
import path from "path";
import { ErrorReporter, Severity } from "./ErrorReporter";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { assertNever } from "@fern-api/core-utils";
import { go } from "@fern-api/go-codegen";
import { go } from "@fern-api/go-ast";
import { DynamicSnippetsGeneratorContext } from "./DynamicSnippetsGeneratorContext";
import { dynamic as DynamicSnippets, PrimitiveTypeV1 } from "@fern-fern/ir-sdk/api";
import { DiscriminatedUnionTypeInstance } from "../DiscriminatedUnionTypeInstance";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { assertNever } from "@fern-api/core-utils";
import { go } from "@fern-api/go-codegen";
import { go } from "@fern-api/go-ast";
import { DynamicSnippetsGeneratorContext } from "./DynamicSnippetsGeneratorContext";
import { dynamic as DynamicSnippets, PrimitiveTypeV1 } from "@fern-fern/ir-sdk/api";
import { Severity } from "./ErrorReporter";
Expand Down
2 changes: 1 addition & 1 deletion generators/go-v2/dynamic-snippets/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
{ "path": "../../../packages/cli/workspace-loader" },
{ "path": "../../../packages/ir-sdk" },
{ "path": "../../commons" },
{ "path": "../codegen" },
{ "path": "../ast" },
{ "path": "../formatter" }
]
}
2 changes: 1 addition & 1 deletion generators/go-v2/formatter/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
{ "path": "../../../packages/commons/fs-utils" },
{ "path": "../../../packages/cli/fern-definition/schema" },
{ "path": "../../commons" },
{ "path": "../codegen" }
{ "path": "../ast" }
]
}
15 changes: 15 additions & 0 deletions generators/go-v2/model/.depcheckrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"ignores": [
"@types/jest",
"globals",
"globals",
"@types/node",
"esbuild",
"@yarnpkg/esbuild-plugin-pnp",
"@fern-fern/ir-sdk"
],
"ignore-patterns": [
"lib",
"dist"
]
}
1 change: 1 addition & 0 deletions generators/go-v2/model/.prettierrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require("../../../.prettierrc.json");
44 changes: 44 additions & 0 deletions generators/go-v2/model/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"name": "@fern-api/go-model",
"version": "0.0.0",
"repository": {
"type": "git",
"url": "https://github.com/fern-api/fern.git",
"directory": "generators/go-v2/model"
},
"files": [
"lib"
],
"type": "module",
"source": "src/index.ts",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"sideEffects": false,
"scripts": {
"clean": "rm -rf ./lib && tsc --build --clean",
"compile": "tsc --build",
"test": "vitest --passWithNoTests --run",
"test:update": "vitest --passWithNoTests --run -u",
"lint:eslint": "eslint --max-warnings 0 . --ignore-path=../../../.eslintignore",
"lint:eslint:fix": "yarn lint:eslint --fix",
"format": "prettier --write --ignore-unknown --ignore-path ../../../shared/.prettierignore \"**\"",
"format:check": "prettier --check --ignore-unknown --ignore-path ../../../shared/.prettierignore \"**\"",
"organize-imports": "organize-imports-cli tsconfig.json",
"depcheck": "depcheck",
"dist:cli": "pnpm compile && tsup ./src/cli.ts --format cjs",
"publish:cli": "pnpm dist:cli && cd dist && yarn npm publish",
"dockerTagLatest": "pnpm dist:cli && docker build -f ./Dockerfile -t fernapi/fern-go-model:latest ../../.."
},
"devDependencies": {
"@types/node": "18.7.18",
"@yarnpkg/esbuild-plugin-pnp": "^3.0.0-rc.14",
"depcheck": "^1.4.6",
"esbuild": "^0.24.0",
"eslint": "^8.56.0",
"organize-imports-cli": "^0.10.0",
"prettier": "^2.7.1",
"tsup": "^8.0.2",
"typescript": "4.6.4",
"vitest": "^2.0.5"
}
}
6 changes: 6 additions & 0 deletions generators/go-v2/model/src/cli.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
void runCli();

export async function runCli(): Promise<void> {
// eslint-disable-next-line no-console
console.log("no-op");
}
11 changes: 11 additions & 0 deletions generators/go-v2/model/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"extends": "../../../shared/tsconfig.shared.json",
"compilerOptions": { "composite": true, "outDir": "lib", "rootDir": "src" },
"include": ["./src/**/*"],
"references": [
{ "path": "../../../packages/commons/core-utils" },
{ "path": "../../../packages/commons/fs-utils" },
{ "path": "../../commons" },
{ "path": "../ast" }
]
}
15 changes: 15 additions & 0 deletions generators/go-v2/sdk/.depcheckrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"ignores": [
"@types/jest",
"globals",
"globals",
"@types/node",
"esbuild",
"@yarnpkg/esbuild-plugin-pnp",
"@fern-fern/ir-sdk"
],
"ignore-patterns": [
"lib",
"dist"
]
}
1 change: 1 addition & 0 deletions generators/go-v2/sdk/.prettierrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require("../../../.prettierrc.json");
44 changes: 44 additions & 0 deletions generators/go-v2/sdk/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"name": "@fern-api/go-sdk",
"version": "0.0.0",
"repository": {
"type": "git",
"url": "https://github.com/fern-api/fern.git",
"directory": "generators/go-v2/sdk"
},
"files": [
"lib"
],
"type": "module",
"source": "src/index.ts",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"sideEffects": false,
"scripts": {
"clean": "rm -rf ./lib && tsc --build --clean",
"compile": "tsc --build",
"test": "vitest --passWithNoTests --run",
"test:update": "vitest --passWithNoTests --run -u",
"lint:eslint": "eslint --max-warnings 0 . --ignore-path=../../../.eslintignore",
"lint:eslint:fix": "yarn lint:eslint --fix",
"format": "prettier --write --ignore-unknown --ignore-path ../../../shared/.prettierignore \"**\"",
"format:check": "prettier --check --ignore-unknown --ignore-path ../../../shared/.prettierignore \"**\"",
"organize-imports": "organize-imports-cli tsconfig.json",
"depcheck": "depcheck",
"dist:cli": "pnpm compile && tsup ./src/cli.ts --format cjs",
"publish:cli": "pnpm dist:cli && cd dist && yarn npm publish",
"dockerTagLatest": "pnpm dist:cli && docker build -f ./Dockerfile -t fernapi/fern-go-sdk:latest ../../.."
},
"devDependencies": {
"@types/node": "18.7.18",
"@yarnpkg/esbuild-plugin-pnp": "^3.0.0-rc.14",
"depcheck": "^1.4.6",
"esbuild": "^0.24.0",
"eslint": "^8.56.0",
"organize-imports-cli": "^0.10.0",
"prettier": "^2.7.1",
"tsup": "^8.0.2",
"typescript": "4.6.4",
"vitest": "^2.0.5"
}
}
6 changes: 6 additions & 0 deletions generators/go-v2/sdk/src/cli.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
void runCli();

export async function runCli(): Promise<void> {
// eslint-disable-next-line no-console
console.log("no-op");
}
11 changes: 11 additions & 0 deletions generators/go-v2/sdk/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"extends": "../../../shared/tsconfig.shared.json",
"compilerOptions": { "composite": true, "outDir": "lib", "rootDir": "src" },
"include": ["./src/**/*"],
"references": [
{ "path": "../../../packages/commons/core-utils" },
{ "path": "../../../packages/commons/fs-utils" },
{ "path": "../../commons" },
{ "path": "../ast" }
]
}
Loading

0 comments on commit d14c499

Please sign in to comment.