Skip to content

Commit

Permalink
Merge branch 'feat/mIgnore' into feat/multi-pack
Browse files Browse the repository at this point in the history
  • Loading branch information
Zyie authored Jun 20, 2024
2 parents 3d23204 + dccffe9 commit 22301be
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/manifest/pixiManifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,14 @@ function collectAssets(
}

const bundleAssets = localBundle.assets;

const finalAssets = asset.getFinalTransformedChildren();

if (asset.transformChildren.length > 0 && !asset.inheritedMetaData[options.tags!.mIgnore!])
{
const nonIgnored = finalAssets.filter((finalAsset) => !finalAsset.inheritedMetaData[options.tags!.mIgnore!]);

if (nonIgnored.length === 0) return;

bundleAssets.push({
alias: getShortNames(stripTags(path.relative(entryPath, asset.path)), options),
src: nonIgnored
Expand Down
52 changes: 52 additions & 0 deletions test/manifest/Manifest.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -987,6 +987,58 @@ describe('Manifest', () =>
],
});
});

it('should ignore files with the mIgnore tag', async () =>
{
const testName = 'manifest-ignore';
const inputDir = getInputDir(pkg, testName);
const outputDir = getOutputDir(pkg, testName);

createFolder(pkg, {
name: testName,
files: [
{
name: '1.png',
content: assetPath('image/sp-1.png'),
},
{
name: '2{mIgnore}.png',
content: assetPath('image/sp-1.png'),
},
],
folders: [],
});

const assetpack = new AssetPack({
entry: inputDir,
cacheLocation: getCacheDir(pkg, testName),
output: outputDir,
cache: false,
pipes: [
pixiManifest({
includeMetaData: false,
}),
],
});

await assetpack.run();

const manifest = sortObjectProperties(await fs.readJSONSync(`${outputDir}/manifest.json`));

expect(manifest).toEqual({
bundles: [
{
name: 'default',
assets: [
{
alias: ['1.png'],
src: ['1.png'],
},
],
},
],
});
});
});

function sortObjectProperties(obj: any)
Expand Down

0 comments on commit 22301be

Please sign in to comment.