Skip to content

Commit

Permalink
update for v8 manifest compatibility (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
Zyie authored Nov 17, 2023
1 parent 1329c52 commit c61d4d4
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 95 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ jobs:
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Install GitHub CLI
run: |
brew update
brew install gh
- name: Generate Release
run: gh release create ${{github.ref_name}} --generate-notes
env:
Expand Down
8 changes: 4 additions & 4 deletions packages/manifest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ This will generate two bundles called `preload` and `game` in the manifest file.
- `createShortcuts` - Whether to create shortcuts for each bundle. Defaults to `false`. If enabled the manifest will try to create the shortest path for an asset. e.g.
```json
{
"name": ["game/char.png", "game.png"],
"srcs": ["game/char.png"]
"alias": ["game/char.png", "game.png"],
"src": ["game/char.png"]
}
```
- `trimExtensions` - Whether to trim the extensions from the asset names. Defaults to `false`. If enabled the manifest will try to create the shortest path for an asset. e.g.
```json
{
"name": ["game/char.png", "game/char"],
"srcs": ["game/char.png"]
"alias": ["game/char.png", "game/char"],
"src": ["game/char.png"]
}
```
- `defaultParser` - The default parser to use on a transformed asset
Expand Down
14 changes: 7 additions & 7 deletions packages/manifest/src/pixi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ export interface PixiManifest

export interface PixiManifestEntry
{
name: string | string[];
srcs: string | string[];
alias: string | string[];
src: string | string[];
data?: {
tags: Tags;
[x: string]: any;
Expand Down Expand Up @@ -63,7 +63,7 @@ function finish(
{
const nameMap = new Map<PixiManifestEntry, string[]>();

bundles.forEach((bundle) => bundle.assets.forEach((asset) => nameMap.set(asset, asset.name as string[])));
bundles.forEach((bundle) => bundle.assets.forEach((asset) => nameMap.set(asset, asset.alias as string[])));

const arrays = Array.from(nameMap.values());
const sets = arrays.map((arr) => new Set(arr));
Expand All @@ -75,7 +75,7 @@ function finish(
{
const names = nameMap.get(asset) as string[];

asset.name = uniqueArrays.find((arr) => arr.every((x) => names.includes(x))) as string[];
asset.alias = uniqueArrays.find((arr) => arr.every((x) => names.includes(x))) as string[];
});
});
}
Expand Down Expand Up @@ -141,7 +141,7 @@ function collect(
};
}

entry.name = getShortNames(entry.name, options);
entry.alias = getShortNames(entry.alias, options);
});
bundle.assets.push(...result);
}
Expand All @@ -164,8 +164,8 @@ export function defaultPixiParser(tree: ChildTree, processor: Processor, _option
const name = processor.trimOutputPath(file.name ?? file.paths[0]);

const res: PixiManifestEntry = {
name,
srcs: file.paths.map((path) => processor.trimOutputPath(path)),
alias: name,
src: file.paths.map((path) => processor.trimOutputPath(path)),
};

// eslint-disable-next-line @typescript-eslint/no-unused-expressions
Expand Down
Loading

0 comments on commit c61d4d4

Please sign in to comment.