Skip to content

Commit

Permalink
upgrade: turbo (#986)
Browse files Browse the repository at this point in the history
Co-authored-by: dsinghvi <[email protected]>
  • Loading branch information
abvthecity and dsinghvi authored Jun 8, 2024
1 parent 80c2af9 commit 7d5b7f6
Show file tree
Hide file tree
Showing 15 changed files with 47 additions and 63 deletions.
8 changes: 1 addition & 7 deletions .github/workflows/deploy-fdr-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,9 @@ jobs:
# which makes steps.has-changed.outputs.RESULT = 'true'
run: npx turbo-ignore ${{ env.PACKAGE_NAME }} || echo "RESULT=true" >> $GITHUB_OUTPUT

- name: 🪴 Generate Fern SDKs
run: |
pnpm fern generate --local --api fdr --group local --log-level debug
env:
FERN_TOKEN: ${{ secrets.FERN_TOKEN }}

- name: 🧪 Build and test
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
run: |
pnpm turbo codegen build test --filter=${{ env.PACKAGE_NAME }}
pnpm --filter "@fern-platform/fdr" sentry:sourcemaps
Expand Down
8 changes: 1 addition & 7 deletions .github/workflows/deploy-fdr-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,6 @@ jobs:
- name: 📥 Install
uses: ./.github/actions/install

- name: 🪴 Generate Code
run: |
pnpm fern generate --local --api fdr --group local --log-level debug
env:
FERN_TOKEN: ${{ secrets.FERN_TOKEN }}

- name: 🧪 Build and test
run: pnpm turbo build test --filter=${{ env.PACKAGE_NAME }}

Expand Down Expand Up @@ -97,4 +91,4 @@ jobs:
healthchecks:
needs: deploy_prod
uses: ./.github/workflows/healthcheck.yml
secrets: inherit
secrets: inherit
4 changes: 1 addition & 3 deletions .github/workflows/fdr-ete.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,4 @@ jobs:
# TODO: re-enable when moving to turbo
# pnpm turbo --filter= docker:local
run: |
cd servers/fdr
pnpm run docker:local
pnpm run test:ete
pnpm --filter=@fern-platform/fdr docker:local test:ete
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
"tailwindcss": "^3.4.3",
"ts-node": "^10.9.1",
"tsx": "^4.7.1",
"turbo": "^1.12.5",
"turbo": "^2.0.1",
"typescript": "5.4.3",
"typescript-plugin-css-modules": "^5.1.0",
"vitest": "^1.5.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/fdr-sdk/turbo.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://turbo.build/schema.json",
"extends": ["//"],
"pipeline": {
"tasks": {
"compile": {
"outputs": ["dist/**"],
"dependsOn": ["^build", "^compile", "codegen"]
Expand Down
14 changes: 7 additions & 7 deletions packages/template-resolver/src/SnippetTemplateResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class SnippetTemplateResolver {

private accessParameterPayloadByPath(
parameterPayloads?: ParameterPayload[],
locationPath?: string
locationPath?: string,
): unknown | undefined {
const splitPath = locationPath?.split(".") ?? [];
const parameterName = splitPath.shift();
Expand Down Expand Up @@ -88,7 +88,7 @@ export class SnippetTemplateResolver {
invocation: template.templateString.replace(
// TODO: fix the typescript generator to create literals not as types
TemplateSentinel,
""
"",
),
};
}
Expand Down Expand Up @@ -118,7 +118,7 @@ export class SnippetTemplateResolver {
invocation: template.templateString.replace(
// TODO: fix the typescript generator to create literals not as types
TemplateSentinel,
evaluatedInputs.map((input) => input.invocation).join(template.inputDelimiter ?? ", ")
evaluatedInputs.map((input) => input.invocation).join(template.inputDelimiter ?? ", "),
),
}
: undefined;
Expand All @@ -143,7 +143,7 @@ export class SnippetTemplateResolver {
imports: imports.concat(evaluatedInputs.flatMap((input) => input.imports)),
invocation: template.containerTemplateString.replace(
TemplateSentinel,
evaluatedInputs.map((input) => input.invocation).join(template.delimiter ?? ", ")
evaluatedInputs.map((input) => input.invocation).join(template.delimiter ?? ", "),
),
};
}
Expand Down Expand Up @@ -173,7 +173,7 @@ export class SnippetTemplateResolver {
imports: imports.concat(evaluatedInputs.flatMap((input) => input.imports)),
invocation: template.containerTemplateString.replace(
TemplateSentinel,
evaluatedInputs.map((input) => input.invocation).join(template.delimiter ?? ", ")
evaluatedInputs.map((input) => input.invocation).join(template.delimiter ?? ", "),
),
};
}
Expand All @@ -200,7 +200,7 @@ export class SnippetTemplateResolver {
const maybeUnionValue = this.getPayloadValue(
// Defaults to relative since the python generator didn't specify this on historical templates
template.templateInput ?? { location: "RELATIVE" },
payloadOverride
payloadOverride,
);
if (maybeUnionValue == null || !isPlainObject(maybeUnionValue) || !(discriminator in maybeUnionValue)) {
return undefined;
Expand All @@ -219,7 +219,7 @@ export class SnippetTemplateResolver {

const evaluatedMember: V1Snippet | undefined = this.resolveV1Template(
selectedMemberTemplate,
payloadOverride
payloadOverride,
);
return evaluatedMember != null
? {
Expand Down
3 changes: 1 addition & 2 deletions packages/template-resolver/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"extends": "@fern-platform/configs/tsconfig/library.json",
"compilerOptions": { "outDir": "./dist", "rootDir": "./src" },
"include": ["./src/**/*"],
"references": [{ "path": "../commons/core-utils" }]
"include": ["./src/**/*"]
}
2 changes: 1 addition & 1 deletion packages/template-resolver/turbo.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://turbo.build/schema.json",
"extends": ["//"],
"pipeline": {
"tasks": {
"compile": {
"outputs": ["dist/**"],
"dependsOn": ["^build", "^compile", "codegen"]
Expand Down
44 changes: 22 additions & 22 deletions pnpm-lock.yaml

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

11 changes: 5 additions & 6 deletions servers/fdr/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ RUN apk update

# Produce a pruned version of the monorepo
WORKDIR /app
# Install pnpm
RUN npm install -g turbo
RUN npm install -g [email protected]
COPY . .
RUN turbo prune @fern-platform/fdr --docker

Expand All @@ -33,9 +32,9 @@ COPY --from=builder /app/out/full/ .
COPY turbo.json turbo.json
COPY shared shared
COPY fern fern
# RUN pnpm turbo run compile --filter=@fern-platform/fdr
RUN pnpm --filter=@fern-api/fdr-sdk compile
RUN pnpm run compile --filter=@fern-platform/fdr
RUN pnpm turbo --filter=@fern-api/fdr-sdk compile
RUN pnpm turbo --filter=@fern-platform/fdr codegen
RUN pnpm turbo --filter=@fern-platform/fdr compile

FROM base AS runner
WORKDIR /app
Expand All @@ -47,4 +46,4 @@ ENV DATABASE_URL=$DATABASE_URL

COPY --from=installer /app .

ENTRYPOINT ["/bin/sh", "/app/servers/fdr/scripts/run.sh"]
ENTRYPOINT ["/bin/sh", "/app/servers/fdr/scripts/run.sh"]
2 changes: 1 addition & 1 deletion servers/fdr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
"docker:local": "dotenv -e .env.test -- ./create_docker.sh local",
"docker:dev": "dotenv -e .env.dev -- ./create_docker.sh",
"docker:prod": "dotenv -e .env.prod -- ./create_docker.sh",
"test": "vitest src/__test__/unit-tests --globals",
"test": "vitest src/__test__/unit-tests --globals --run",
"lint:eslint": "eslint --max-warnings 0 . --ignore-path=../../.eslintignore",
"lint:eslint:fix": "pnpm lint:eslint --fix",
"test:local": "dotenv -e .env.test -- vitest src/__test__/local --globals --config src/__test__/local/vitest.config.ts",
Expand Down
5 changes: 2 additions & 3 deletions servers/fdr/scripts/run.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/bin/sh
npm install -g prisma
prisma migrate deploy --schema /app/servers/fdr/prisma/schema.prisma
node --experimental-specifier-resolution=node /app/servers/fdr/dist/server.js
prisma migrate deploy --schema /fdr/prisma/schema.prisma
node --experimental-specifier-resolution=node /fdr/dist/server.js
2 changes: 1 addition & 1 deletion servers/fdr/turbo.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://turbo.build/schema.json",
"extends": ["//"],
"pipeline": {
"tasks": {
"compile": {
"outputs": ["dist/**"],
"dependsOn": ["^build", "^compile", "codegen"]
Expand Down
1 change: 1 addition & 0 deletions shared/.prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ clis/docs-migrator/src/__test__/fixtures/bland/api-reference/endpoint/call.mdx
**/__test__/**/*.json
**/__test__/fixtures/
**/__test__/outputs/
.turbo
2 changes: 1 addition & 1 deletion turbo.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://turbo.build/schema.json",
"pipeline": {
"tasks": {
"build": {
"outputs": ["dist/**", ".next/**", "!.next/cache/**"],
"dependsOn": ["^build", "^compile", "codegen"]
Expand Down

0 comments on commit 7d5b7f6

Please sign in to comment.