Skip to content

Commit

Permalink
feat: public directory ignore .gitkeep file (#6394)
Browse files Browse the repository at this point in the history
  • Loading branch information
caohuilin authored Oct 16, 2024
1 parent 1cf5544 commit 91cf577
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 253 deletions.
7 changes: 7 additions & 0 deletions .changeset/witty-zebras-develop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@modern-js/app-tools': patch
---

feat: config/public directory ignore .gitkeep file

feat: config/public 目录忽略 .gitkeep 文件
34 changes: 19 additions & 15 deletions packages/solutions/app-tools/src/plugins/analyze/getServerRoutes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,24 +210,28 @@ const collectStaticRoutes = (
} = config;
const publicFolder = path.resolve(appDirectory, configDir || '', 'public');

const ignoreFiles = ['.gitkeep'];

return fs.existsSync(publicFolder)
? walkDirectory(publicFolder).map(filePath => {
const urlPath = `${urlJoin(
toPosix(filePath).slice(toPosix(publicFolder).length),
)}`;
? walkDirectory(publicFolder)
.filter(filePath => !ignoreFiles.includes(path.basename(filePath)))
.map(filePath => {
const urlPath = `${urlJoin(
toPosix(filePath).slice(toPosix(publicFolder).length),
)}`;

return {
urlPath: publicRoutes[removeLeadingSlash(urlPath)] || urlPath,
isSPA: true,
isSSR: false,
entryPath: toPosix(
path.relative(
path.resolve(appDirectory, configDir || ''),
filePath,
return {
urlPath: publicRoutes[removeLeadingSlash(urlPath)] || urlPath,
isSPA: true,
isSSR: false,
entryPath: toPosix(
path.relative(
path.resolve(appDirectory, configDir || ''),
filePath,
),
),
),
};
})
};
})
: [];
};

Expand Down
Loading

0 comments on commit 91cf577

Please sign in to comment.