Skip to content

Commit

Permalink
publish 1.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Idrinth committed Mar 28, 2024
1 parent 057c610 commit 59d739a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@idrinth/react-file-based-routes",
"version": "1.2.1",
"version": "1.2.2",
"repository": "https://github.com/idrinth/react-file-based-routes",
"description": "A simple file based routing library, that does not force itself on you.",
"license": "MIT",
Expand Down
12 changes: 8 additions & 4 deletions src/generate-folders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,16 @@ export default (cwd: string, configuration: Configuration) => {
const content = readFileSync(cwd + '/' + configuration.fileFinder.distJSRoot + '/' + file, 'utf8',);
const res = matcher.exec(content);
if (res && res[1]) {
if (typeof configuration.routes.overridePathMappings[res[1]] === 'string') {
if (configuration.routes.overridePathMappings[res[1]] !== '*') {
writeIndexHtml(cwd, file, configuration.routes.overridePathMappings[res[1]], template, configuration, cssFiles, jsFiles);
const pageName = res[1].replace(/\/$/u, '');
console.log(pageName);
if (typeof configuration.routes.overridePathMappings[pageName] === 'string') {
if (configuration.routes.overridePathMappings[pageName] !== '*') {
writeIndexHtml(cwd, file, configuration.routes.overridePathMappings[pageName], template, configuration, cssFiles, jsFiles);
} else {
writeIndexHtml(cwd, file, '', template, configuration, cssFiles, jsFiles);
}
} else {
writeIndexHtml(cwd, file, `/${ res[1] }/`, template, configuration, cssFiles, jsFiles);
writeIndexHtml(cwd, file, `/${ pageName }/`, template, configuration, cssFiles, jsFiles);
}
}
}
Expand Down

0 comments on commit 59d739a

Please sign in to comment.