Repository: tatethurston/nextjs-routes (ts)

Issue:
Generated types are prefixed with "pages/"
My `pages` folder is in the project root. The generated types file looks like this:
```ts
export type Route =
    | { pathname: "pages/_app"; query?: Query | undefined }
    | { pathname: "pages/_document"; query?: Query | undefined }
    | { pathname: "pages/_error"; query?: Query | undefined }
```

hence, I get type errors as the correct paths don't have the `pages/` prefix.

Pull request description:
fix page directory prefix
fixes #76

Patch:
diff --git a/README.md b/README.md
index e3319fb..8a36abe 100644
--- a/README.md
+++ b/README.md
@@ -206,7 +206,7 @@ You can pass the following options to `withRoutes` in your `next.config.js`:
 
 ```js
 const withRoutes = require("nextjs-routes/config")({
-  outDir: "types"
+  outDir: "types",
 });
 ```
 
diff --git a/src/core.ts b/src/core.ts
index 24af37f..7588f1d 100644
--- a/src/core.ts
+++ b/src/core.ts
@@ -232,7 +232,7 @@ export function writeNextjsRoutes(options: NextJSRoutesOptions): void {
     const ext = file.slice(file.lastIndexOf(".") + 1);
     return pageExtensions.has(ext);
   });
-  const routes = nextRoutes(files, outputFilepath);
+  const routes = nextRoutes(files, opts.pagesDirectory);
   const generated = generate(routes);
 
   writeFileSync(outputFilepath, generated);


Test patch:
diff --git a/e2e/package-lock.json b/e2e/package-lock.json
index 721362b..dc45e76 100644
--- a/e2e/package-lock.json
+++ b/e2e/package-lock.json
@@ -20,7 +20,7 @@
     },
     "../dist": {
       "name": "nextjs-routes",
-      "version": "0.1.0",
+      "version": "0.1.1",
       "dev": true,
       "license": "MIT",
       "dependencies": {