Skip to content

Commit

Permalink
feat: Use dot notation instead of directory slash.
Browse files Browse the repository at this point in the history
  • Loading branch information
vicary committed Oct 13, 2022
1 parent f082618 commit 7b78863
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
9 changes: 8 additions & 1 deletion dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,14 @@ const manifest = {
${
modules.map((file, i) => {
const { dir, name } = parse(file);
return `"${join(dir.slice(1), name)}": $${i}`;
const key = [
// Remove leading slash
dir.slice(1),
name,
].map((v) => v.trim()).filter(Boolean)
.join(".");
return `"${key}": $${i}`;
}).join(",\n ")
}
},
Expand Down
3 changes: 1 addition & 2 deletions schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import type {
IFieldResolver,
IResolvers,
} from "https://cdn.skypack.dev/@graphql-tools/utils?dts";
import { sep } from "https://deno.land/[email protected]/path/mod.ts";

export type Callable = (...args: any[]) => any;

Expand Down Expand Up @@ -43,7 +42,7 @@ export const fromManifest = <
if (!resolver) return;

const resolverObj: IResolvers = {};
const pathSegments = name.split(sep);
const pathSegments = name.split(".");
const isSubscription = pathSegments[0] === "Subscription";

let currentPath = resolverObj;
Expand Down

0 comments on commit 7b78863

Please sign in to comment.