Skip to content

Commit

Permalink
(chore): locally generate ir-sdk for the latest IR (#2863)
Browse files Browse the repository at this point in the history
* locally generate ir sdk

* fix imports

* prettierignore ir-sdk

* move generate ir sdks to github workflows

* try again

* fix eslintignore

* fix

* fix

* again

* fix shit

* fix format:fix

* fix

* add workflows to check ir
  • Loading branch information
dsinghvi authored Feb 2, 2024
1 parent a334950 commit 5f5bbeb
Show file tree
Hide file tree
Showing 850 changed files with 10,217 additions and 167 deletions.
19 changes: 0 additions & 19 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,17 +117,6 @@ jobs:
command: |
yarn workspace @fern-api/cli publish:cli:prod --tag latest
publish-ir-sdk:
docker:
- image: cimg/node:18.8.0
steps:
- checkout
- run:
name: Publish ir sdks
command: |
export FERN_TOKEN="$FERN_ORG_TOKEN_PROD"
npx fern-api generate --api ir-types-v31 --group sdks
workflows:
version: 2
build:
Expand Down Expand Up @@ -175,11 +164,3 @@ workflows:
- auth0-prod
- posthog

- publish-ir-sdk:
filters:
branches:
only: main
tags:
only: /.*/
context:
- fern-tokens
4 changes: 3 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ dist
.husky
generated
bundle.c?js
.pnp*
.pnp*
packages/ir-sdk/**

35 changes: 35 additions & 0 deletions .github/workflows/ir-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: ir

on:
workflow_dispatch:
pull_request:
branches:
- main
push:
branches:
- main

jobs:
check:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Fern
run: npm install -g fern-api

- name: Check IR Definitions
run: |
cd packages/ir-sdk
fern check
- name: Check IR Definitions
env:
FERN_TOKEN: dummy
run: |
cd packages/ir-sdk
yarn generate
- name: Ensure no changes to git-tracked files
run: git --no-pager diff --exit-code
26 changes: 26 additions & 0 deletions .github/workflows/ir-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: ir-publish

on:
workflow_dispatch:
push:
branches:
- main
paths:
- "packages/ir-sdk/fern/apis/ir-types-latest/**"

jobs:
sdks:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Fern
run: npm install -g fern-api

- name: Release IR SDKs
env:
FERN_TOKEN: ${{ secrets.FERN_TOKEN }}
run: |
cd packages/ir-sdk
fern generate --api ir-types-latest --group sdks --log-level debug
40 changes: 31 additions & 9 deletions .pnp.cjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion generators/ruby/sdk/src/utils/EndpointGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,9 +296,12 @@ export class EndpointGenerator {
})
]
});
if (prop.type.some((cr) => cr === FileClassReference)) {
const isFileReference = prop.type.some((cr) => cr === FileClassReference);
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
if (isFileReference) {
return [
prop.wireValue ?? prop.name,
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
prop.isOptional
? new ConditionalStatement({
if_: {
Expand Down
2 changes: 1 addition & 1 deletion lint-staged.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
"**/*.ts{,x}": [
"eslint --fix --max-warnings 0 --no-eslintrc --config .eslintrc.lint-staged.js",
"eslint --fix --max-warnings 0 --no-eslintrc --config .eslintrc.lint-staged.js --ignore-path .eslintignore",
"yarn format:fix",
],
"**/*.{js,json,yml,html,css,less,scss,md}": "yarn format",
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"compile": "yarn workspace @fern-api/compile-root run compile",
"test": "yarn compile && jest --passWithNoTests",
"test:ete": "yarn workspace @fern-api/cli dist:cli:dev && yarn workspace @fern-api/seed-cli dist:cli && yarn workspace @fern-api/ete-tests test",
"lint:eslint": "eslint --max-warnings 0 . --report-unused-disable-directives",
"lint:eslint": "eslint --max-warnings 0 . --report-unused-disable-directives --ignore-path .eslintignore",
"lint:eslint:fix": "yarn lint:eslint --fix",
"lint:monorepo": "mrlint lint",
"lint:monorepo:fix": "yarn lint:monorepo --fix",
Expand All @@ -44,7 +44,8 @@
"root-package:check": "yarn fern-script check-root-package",
"root-package:fix": "yarn root-package:check --fix",
"demo-setup": "yarn workspace @fern-api/demo-setup dist:cli && node $(yarn workspace @fern-api/demo-setup bin demo-setup)",
"seed:local": "yarn workspace @fern-api/seed-cli dist:cli && node $(yarn workspace @fern-api/seed-cli bin seed)"
"seed:local": "yarn workspace @fern-api/seed-cli dist:cli && node $(yarn workspace @fern-api/seed-cli bin seed)",
"ir:generate": "yarn workspace @fern-api/ir-sdk generate"
},
"devDependencies": {
"@babel/core": "^7.23.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"@fern-api/init": "workspace:*",
"@fern-api/ir-generator": "workspace:*",
"@fern-api/ir-migrations": "workspace:*",
"@fern-api/ir-sdk": "workspace:*",
"@fern-api/local-workspace-runner": "workspace:*",
"@fern-api/logger": "workspace:*",
"@fern-api/logging-execa": "workspace:*",
Expand All @@ -69,7 +70,6 @@
"@fern-api/yaml-migrations": "workspace:*",
"@fern-api/yaml-schema": "workspace:*",
"@fern-fern/fiddle-sdk": "^0.0.386",
"@fern-fern/ir-sdk": "0.0.3294",
"ansi-escapes": "^5.0.0",
"axios": "^0.27.2",
"boxen": "^7.0.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Audiences } from "@fern-api/config-management-commons";
import { GenerationLanguage } from "@fern-api/generators-configuration";
import { generateIntermediateRepresentation } from "@fern-api/ir-generator";
import { IntermediateRepresentation } from "@fern-api/ir-sdk";
import { TaskContext } from "@fern-api/task-context";
import { FernWorkspace } from "@fern-api/workspace-loader";
import { IntermediateRepresentation } from "@fern-fern/ir-sdk/api";
import { validateAPIWorkspaceAndLogIssues } from "../validate/validateAPIWorkspaceAndLogIssues";

export async function generateIrForFernWorkspace({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { migrateIntermediateRepresentationThroughVersion } from "@fern-api/ir-mi
import { Project } from "@fern-api/project-loader";
import { TaskContext } from "@fern-api/task-context";
import { convertOpenApiWorkspaceToFernWorkspace, FernWorkspace } from "@fern-api/workspace-loader";
import * as IrSerialization from "@fern-fern/ir-sdk/serialization";
import { serialization as IrSerialization } from "@fern-api/ir-sdk";
import { writeFile } from "fs/promises";
import path from "path";
import { CliContext } from "../../cli-context/CliContext";
Expand Down
1 change: 1 addition & 0 deletions packages/cli/cli/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
{ "path": "../../commons/fs-utils" },
{ "path": "../../commons/logging-execa" },
{ "path": "../../core" },
{ "path": "../../ir-sdk" },
{ "path": "../auth" },
{ "path": "../config-management/commons" },
{ "path": "../config-management/generators-configuration" },
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/generation/ir-generator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@
"@fern-api/core-utils": "workspace:*",
"@fern-api/fs-utils": "workspace:*",
"@fern-api/generators-configuration": "workspace:*",
"@fern-api/ir-sdk": "workspace:*",
"@fern-api/project-configuration": "workspace:*",
"@fern-api/project-loader": "workspace:*",
"@fern-api/task-context": "workspace:*",
"@fern-api/workspace-loader": "workspace:*",
"@fern-api/yaml-schema": "workspace:*",
"@fern-fern/ir-sdk": "0.0.3294",
"lodash-es": "^4.17.21",
"prettier": "^2.7.1",
"url-join": "^5.0.0"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { RelativeFilePath } from "@fern-api/fs-utils";
import { FernFilepath, TypeReference } from "@fern-api/ir-sdk";
import { DefinitionFileSchema, RootApiFileSchema } from "@fern-api/yaml-schema";
import { FernFilepath, TypeReference } from "@fern-fern/ir-sdk/api";
import { mapValues } from "lodash-es";
import { CasingsGenerator } from "./casings/CasingsGenerator";
import { convertToFernFilepath } from "./utils/convertToFernFilepath";
Expand Down
3 changes: 1 addition & 2 deletions packages/cli/generation/ir-generator/src/IdGenerator.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { FernIr } from "@fern-fern/ir-sdk";
import { DeclaredErrorName, DeclaredServiceName, DeclaredTypeName, FernFilepath } from "@fern-fern/ir-sdk/api";
import { DeclaredErrorName, DeclaredServiceName, DeclaredTypeName, FernFilepath, FernIr } from "@fern-api/ir-sdk";

export const IdGenerator = {
generateTypeId: (typeName: Omit<DeclaredTypeName, "typeId">): FernIr.commons.TypeId => {
Expand Down
Loading

0 comments on commit 5f5bbeb

Please sign in to comment.