Skip to content

Commit

Permalink
use swc for parse schema (#796)
Browse files Browse the repository at this point in the history
  • Loading branch information
lolopinto authored Mar 15, 2022
1 parent 6f4e85b commit d9e8608
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ jobs:
uses: actions/setup-node@v2
with:
node-version: 16.x
- run: npm install -g ts-node prettier typescript
- run: npm install -g ts-node prettier typescript @swc/core @swc/cli
- run: |
cd ts
npm ci
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/go_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ jobs:
uses: actions/setup-node@v2
with:
node-version: 16.x
- run: npm install -g ts-node prettier typescript
- run: npm install -g ts-node prettier typescript @swc/core @swc/cli
- run: |
cd ts
npm ci
Expand Down
6 changes: 5 additions & 1 deletion examples/simple/src/ent/contact.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { GraphQLString } from "graphql";
import { ContactBase } from "./internal";
import {
PrivacyPolicy,
Expand All @@ -19,7 +20,10 @@ export class Contact extends ContactBase {
rules: [new AllowIfViewerIsRule("userID"), AlwaysDenyRule],
};

@gqlField()
@gqlField({
type: GraphQLString,
name: "fullName",
})
get fullName(): string {
return this.firstName + " " + this.lastName;
}
Expand Down
5 changes: 4 additions & 1 deletion examples/simple/src/ent/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ export class User extends UserBase {
],
};

@gqlField()
@gqlField({
type: GraphQLString,
name: "fullName",
})
get fullName(): string {
return this.firstName + " " + this.lastName;
}
Expand Down
1 change: 1 addition & 0 deletions internal/schema/input/parse_ts.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ func GetRawSchema(dirPath string, fromTest bool) ([]byte, error) {

cmdArgs = append(
cmdArgs,
"--swc",
util.GetPathToScript("scripts/read_schema.ts", fromTest),
"--path",
schemaPath,
Expand Down

0 comments on commit d9e8608

Please sign in to comment.