Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
LunaticMuch committed Apr 14, 2023
1 parent 7d82d0b commit e1a7b12
Show file tree
Hide file tree
Showing 16 changed files with 7,278 additions and 7,342 deletions.
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
example
6 changes: 3 additions & 3 deletions example/next.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
}
reactStrictMode: true,
};

module.exports = nextConfig
module.exports = nextConfig;
2 changes: 2 additions & 0 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
"lint": "next lint"
},
"dependencies": {
"@graphql-tools/graphql-file-loader": "^7.5.17",
"@graphql-tools/load": "^7.8.14",
"@types/node": "18.15.11",
"@types/react": "18.0.34",
"@types/react-dom": "18.0.11",
Expand Down
65 changes: 65 additions & 0 deletions example/pages/schema/[...type].tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import { loadSchemaSync } from "@graphql-tools/load";
import { GraphQLFileLoader } from "@graphql-tools/graphql-file-loader";

// const mySchema = await loadSchema("../schema/schema.graphql", {
// loaders: [new GraphQLFileLoader()],
// });

import { schemaParser } from "../../../lib/index.js";

const loadedSchema = loadSchemaSync("../../../schema/schema.graphql", {
loaders: [new GraphQLFileLoader()],
});

const t = new schemaParser(loadedSchema);

console.log(loadedSchema);

export default function Post({ postData }) {
return (
<div className="h-screen p-16 text-gray-100 bg-gray-800">
<div className="text-3xl font-bold text-center">{postData.title}</div>
<div className="my-8 text-justify text-gray-200">
{postData.description}
</div>
<div className="text-gray-400">Published On: {postData.date}</div>
</div>
);
}

export async function getStaticProps(context) {
const { type } = context.params;
console.log(type);
return {
props: {
postData: {
description: "ciao come va?",
title: "CIAO",
date: "2020-02-02",
},
},
};
}

export async function getStaticPaths() {
const routes = t.getRoutes();
console.log(routes);
return routes;
// const paths = [
// ["object", "author"],
// ["scalar", "id"],
// ["scalar", "string"],
// ["object", "post"],
// ["scalar", "int"],
// ["object", "query"],
// ["object", "mutation"],
// ["scalar", "boolean"],
// ];
// return {
// paths: [
// { params: { type: ["object", "author"] } },
// { params: { type: ["object", "mutation"] } },
// ],
// fallback: true,
// };
}
7 changes: 7 additions & 0 deletions example/pages/schema/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export default function SchemaIndex() {
return (
<main className="flex flex-col items-center justify-between min-h-screen p-24">
this is the index!
</main>
);
}
115 changes: 115 additions & 0 deletions example/pnpm-lock.yaml

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

24 changes: 18 additions & 6 deletions example/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"target": "es2017",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
Expand All @@ -15,9 +19,17 @@
"jsx": "preserve",
"incremental": true,
"paths": {
"@/*": ["./*"]
"@/*": [
"./*"
]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]
}
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx"
],
"exclude": [
"node_modules"
]
}
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@
],
"scripts": {
"build": "tsc",
"clean": "rimraf ./lib",
"format": "prettier \"**/*\" --ignore-unknown",
"format:write": "pnpm format --write",
"lint": "eslint . --max-warnings 0 --report-unused-disable-directives",
"lint:packages": "pnpm-deduplicate --list",
"lint:spelling": "cspell \"**\" \".github/**/*\"",
"start": "nodemon"
"start": "nodemon",
"start:example": "npm run build && npm run dev --prefix ./example"
},
"lint-staged": {
"*": "prettier --ignore-unknown --write"
Expand All @@ -32,8 +34,7 @@
"@graphql-tools/graphql-file-loader": "^7.5.16",
"@graphql-tools/load": "^7.8.13",
"graphql": "^16.6.0",
"lodash": "4.17.21",
"radash": "^10.8.1"
"lodash": "4.17.21"
},
"devDependencies": {
"@types/eslint": "^8.21.1",
Expand All @@ -56,6 +57,7 @@
"nodemon": "^2.0.22",
"prettier": "^2.8.3",
"prettier-plugin-packagejson": "^2.4.2",
"rimraf": "^5.0.0",
"stringify-object": "^5.0.0",
"ts-node": "^10.9.1",
"typescript": "^4.9.0"
Expand Down
Loading

0 comments on commit e1a7b12

Please sign in to comment.