ts-file-router 1.0.4 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/file-router.js +2 -2
- package/package.json +1 -1
package/dist/file-router.js
CHANGED
|
@@ -28,7 +28,7 @@ const serializeRoutes = (obj, ident = 2) => {
|
|
|
28
28
|
str += ' '.repeat(ident - 2) + '}';
|
|
29
29
|
return str;
|
|
30
30
|
};
|
|
31
|
-
const start = ({ baseFolder, outputFile, routeFileName = 'page.
|
|
31
|
+
const start = ({ baseFolder, outputFile, routeFileName = 'page.tsx', }) => {
|
|
32
32
|
// Get the pages dir to resolve routes
|
|
33
33
|
const basePath = path_1.default.resolve(process.cwd(), baseFolder);
|
|
34
34
|
// Output file for routes
|
|
@@ -48,7 +48,7 @@ const start = ({ baseFolder, outputFile, routeFileName = 'page.ts', }) => {
|
|
|
48
48
|
const importPath = './' + path_1.default.relative(basePath, fullPath).replaceAll(/\\/g, '/');
|
|
49
49
|
const relativePath = './' + path_1.default.relative(basePath, dir).replaceAll(/\\/g, '/');
|
|
50
50
|
// Remove extension from file to naming the route
|
|
51
|
-
const key = file.
|
|
51
|
+
const key = path_1.default.basename(file, path_1.default.extname(file));
|
|
52
52
|
if (dirInfo.isDirectory()) {
|
|
53
53
|
// Dev friendly when enter in this conditional file is a directory(folder)
|
|
54
54
|
const directory = file;
|