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.
@@ -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.ts', }) => {
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.replace(/\.ts$/, '');
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ts-file-router",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "router based on project files using typescript",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",