Skip to content

Commit

Permalink
Fix module filename resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
rihardsgravis committed Jan 19, 2021
1 parent 4334ad9 commit 25fdf10
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## [v1.0.2](https://github.com/spectrome/patchcab/compare/1.0.1...1.0.2)

> 19 January 2021
- Fix module filename resolution

## [v1.0.1](https://github.com/spectrome/patchcab/compare/1.0.0...1.0.1)

> 19 January 2021
Expand Down
10 changes: 7 additions & 3 deletions core/src/bin/bin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,11 @@ const bin = async (): Promise<void> => {
}

dependencyConfig.patchcab.forEach((item) => {
if (typeof item === 'object' && item.file && existsSync(resolve(dependencyDir, `./modules/${item.file}.js`))) {
if (
typeof item === 'object' &&
item.name &&
existsSync(resolve(dependencyDir, `./modules/${safeName(item.name)}.js`))
) {
const setName = dependencyConfig.name.replace(/\//g, '-');

const author =
Expand All @@ -123,11 +127,11 @@ const bin = async (): Promise<void> => {
}

copyFileSync(
resolve(dependencyDir, `./modules/${item.name}.js`),
resolve(dependencyDir, `./modules/${safeName(item.name)}.js`),
resolve(targetDir, `${safeName(item.name)}.js`)
);
copyFileSync(
resolve(dependencyDir, `./modules/${item.file}.png`),
resolve(dependencyDir, `./modules/${safeName(item.name)}.png`),
resolve(targetDir, `${safeName(item.name)}.png`)
);
}
Expand Down

1 comment on commit 25fdf10

@vercel
Copy link

@vercel vercel bot commented on 25fdf10 Jan 19, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.