Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
h1ve2 committed Jan 24, 2025
1 parent 48d06f2 commit d38a08f
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions packages/assetpack/src/texture-packer/texturePackerCacheBuster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,21 @@ export function texturePackerCacheBuster(): AssetPipe<any, 'tps'>

const texture = json.meta.image;

const textureAssets = findAssets((assetObj) =>{
if(assetObj.filename !== texture)return false;

const textureAssets = findAssets((assetObj) =>
{
if (assetObj.filename !== texture) return false;

// check json & image file directory
let jsonDir = jsonAsset.directory.replaceAll(pipeSystem.outputPath, "");
jsonDir = jsonDir.replaceAll(/(^[\\\/])|([\\\/]$)/ig, "")

let dirName = assetObj.directory.replaceAll(/\.?assetpack[\/\\]texture-packer\//ig, "");
dirName = dirName.replaceAll(/{.*}/ig, "");
return jsonDir == dirName
let jsonDir = jsonAsset.directory.replaceAll(pipeSystem.outputPath, '');

jsonDir = jsonDir.replaceAll(/(^[\\\/])|([\\\/]$)/ig, '');

let dirName = assetObj.directory.replaceAll(/^.*(texture-packer|compress)[\/\\]?/ig, '');
// dirName = dirName.replaceAll(/^.*assetpack[\/\\]texture-packer[\/\\]/ig, '');

dirName = dirName.replaceAll(/{.*}/ig, '');

return jsonDir === dirName;
}, asset, true);

// last transformed child is the renamed texture
Expand Down

0 comments on commit d38a08f

Please sign in to comment.