Skip to content

Commit

Permalink
fix: use package-scoped variant name for resolution (#107)
Browse files Browse the repository at this point in the history
* Store resolution as package scoped variants

* Update resolution variants
  • Loading branch information
sebamarynissen authored Jan 25, 2025
1 parent 702dcf3 commit 647b242
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 54 deletions.
9 changes: 7 additions & 2 deletions actions/fetch/generate-variants.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ function generateVariant(config, metadata, opts) {
// mode variant.
let dependencies = [];
let exclusions = {};
let { assets } = metadata;
let { package: pkg, assets } = metadata;
let { nightmode, driveside, CAM, resolution } = config;
if (nightmode) {

Expand Down Expand Up @@ -245,7 +245,12 @@ function generateVariant(config, metadata, opts) {

// At last we'll compile everything together.
return {
variant: config,
variant: {
...nightmode && { nightmode },
...CAM && { CAM },
...driveside && { driveside },
...resolution && { [`${pkg.group}:${pkg.name}:resolution`]: resolution },
},
...dependencies.length > 0 && { dependencies },
assets: assets.map(asset => {
let exclude = exclusions[asset.assetId] ?? [];
Expand Down
42 changes: 27 additions & 15 deletions actions/fetch/test/expand-variants-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,20 @@ describe('#expandVariants()', function() {
[kFileTags]: ['hd'],
},
];
let variants = await expandVariants({ assets });
let pkg = {
group: 'group',
name: 'name',
};
let variants = await expandVariants({ assets, package: pkg });
expect(variants).to.eql([
{
variant: { resolution: 'sd' },
variant: { 'group:name:resolution': 'sd' },
assets: [
{ assetId: 'normal' },
],
},
{
variant: { resolution: 'hd' },
variant: { 'group:name:resolution': 'hd' },
assets: [
{
assetId: 'normal',
Expand Down Expand Up @@ -116,17 +120,21 @@ describe('#expandVariants()', function() {
[kFileTags]: ['hd'],
},
];
let variants = await expandVariants({ assets });
let pkg = {
group: 'group',
name: 'name',
};
let variants = await expandVariants({ assets, package: pkg });
expect(variants).to.eql([
{
variant: { resolution: 'sd' },
variant: { 'group:name:resolution': 'sd' },
assets: [
{ assetId: 'lots' },
{ assetId: 'sd' },
],
},
{
variant: { resolution: 'hd' },
variant: { 'group:name:resolution': 'hd' },
assets: [
{ assetId: 'lots' },
{ assetId: 'hd' },
Expand Down Expand Up @@ -160,61 +168,65 @@ describe('#expandVariants()', function() {
[kFileTags]: ['darknite', 'hd'],
},
];
let variants = await expandVariants({ assets });
let pkg = {
group: 'group',
name: 'name',
};
let variants = await expandVariants({ assets, package: pkg });
expect(variants).to.eql([
{
variant: { nightmode: 'standard', CAM: 'no', resolution: 'sd' },
variant: { nightmode: 'standard', CAM: 'no', 'group:name:resolution': 'sd' },
assets: [
{ assetId: 'maxisnite' },
],
},
{
variant: { nightmode: 'standard', CAM: 'no', resolution: 'hd' },
variant: { nightmode: 'standard', CAM: 'no', 'group:name:resolution': 'hd' },
assets: [
{ assetId: 'maxisnite', exclude: ['.SC4Model$'] },
{ assetId: 'maxisnite-hd' },
],
},
{
variant: { nightmode: 'standard', CAM: 'yes', resolution: 'sd' },
variant: { nightmode: 'standard', CAM: 'yes', 'group:name:resolution': 'sd' },
assets: [
{ assetId: 'maxisnite' },
{ assetId: 'cam' },
],
},
{
variant: { nightmode: 'standard', CAM: 'yes', resolution: 'hd' },
variant: { nightmode: 'standard', CAM: 'yes', 'group:name:resolution': 'hd' },
assets: [
{ assetId: 'maxisnite', exclude: ['.SC4Model$'] },
{ assetId: 'cam' },
{ assetId: 'maxisnite-hd' },
],
},
{
variant: { nightmode: 'dark', CAM: 'no', resolution: 'sd' },
variant: { nightmode: 'dark', CAM: 'no', 'group:name:resolution': 'sd' },
dependencies: ['simfox:day-and-nite-mod'],
assets: [
{ assetId: 'darknite' },
],
},
{
variant: { nightmode: 'dark', CAM: 'no', resolution: 'hd' },
variant: { nightmode: 'dark', CAM: 'no', 'group:name:resolution': 'hd' },
dependencies: ['simfox:day-and-nite-mod'],
assets: [
{ assetId: 'darknite', exclude: ['.SC4Model$'] },
{ assetId: 'darknite-hd' },
],
},
{
variant: { nightmode: 'dark', CAM: 'yes', resolution: 'sd' },
variant: { nightmode: 'dark', CAM: 'yes', 'group:name:resolution': 'sd' },
dependencies: ['simfox:day-and-nite-mod'],
assets: [
{ assetId: 'darknite' },
{ assetId: 'cam' },
],
},
{
variant: { nightmode: 'dark', CAM: 'yes', resolution: 'hd' },
variant: { nightmode: 'dark', CAM: 'yes', 'group:name:resolution': 'hd' },
dependencies: ['simfox:day-and-nite-mod'],
assets: [
{ assetId: 'darknite', exclude: ['.SC4Model$'] },
Expand Down
20 changes: 10 additions & 10 deletions src/yaml/jasoncw/30410-big-red-lighthouse.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
group: jasoncw
name: big-red-lighthouse
version: "1.0"
version: "1.0-1"
subfolder: 360-landmark
info:
summary: Big Red Lighthouse
Expand Down Expand Up @@ -39,51 +39,51 @@ info:
dependencies:
- mipro:essentials
variants:
- variant: { nightmode: standard, resolution: sd }
- variant: { nightmode: standard, jasoncw:big-red-lighthouse:resolution: sd }
assets:
- assetId: jasoncw-big-red-lighthouse-maxisnite
- assetId: jasoncw-big-red-lighthouse-props
- variant: { nightmode: standard, resolution: hd }
- variant: { nightmode: standard, jasoncw:big-red-lighthouse:resolution: hd }
assets:
- assetId: jasoncw-big-red-lighthouse-hd-maxisnite
- assetId: jasoncw-big-red-lighthouse-props
- variant: { nightmode: dark, resolution: sd }
- variant: { nightmode: dark, jasoncw:big-red-lighthouse:resolution: sd }
dependencies: [ "simfox:day-and-nite-mod" ]
assets:
- assetId: jasoncw-big-red-lighthouse-darknite
- assetId: jasoncw-big-red-lighthouse-props
- variant: { nightmode: dark, resolution: hd }
- variant: { nightmode: dark, jasoncw:big-red-lighthouse:resolution: hd }
dependencies: [ "simfox:day-and-nite-mod" ]
assets:
- assetId: jasoncw-big-red-lighthouse-hd-darknite
- assetId: jasoncw-big-red-lighthouse-props

---
assetId: jasoncw-big-red-lighthouse-maxisnite
version: "1.0"
version: "1.0-1"
lastModified: "2015-04-06T03:23:40Z"
url: https://community.simtropolis.com/files/file/30410-big-red-lighthouse/?do=download&r=153138

---
assetId: jasoncw-big-red-lighthouse-darknite
version: "1.0"
version: "1.0-1"
lastModified: "2015-04-06T03:23:40Z"
url: https://community.simtropolis.com/files/file/30410-big-red-lighthouse/?do=download&r=153139

---
assetId: jasoncw-big-red-lighthouse-hd-maxisnite
version: "1.0"
version: "1.0-1"
lastModified: "2015-04-06T03:23:40Z"
url: https://community.simtropolis.com/files/file/30410-big-red-lighthouse/?do=download&r=153140

---
assetId: jasoncw-big-red-lighthouse-hd-darknite
version: "1.0"
version: "1.0-1"
lastModified: "2015-04-06T03:23:40Z"
url: https://community.simtropolis.com/files/file/30410-big-red-lighthouse/?do=download&r=153141

---
assetId: jasoncw-big-red-lighthouse-props
version: "1.0"
version: "1.0-1"
lastModified: "2015-04-06T03:23:40Z"
url: https://community.simtropolis.com/files/file/30410-big-red-lighthouse/?do=download&r=153142
54 changes: 27 additions & 27 deletions src/yaml/jasoncw/32737-guardian-building.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
group: jasoncw
name: guardian-building
version: "1.0"
version: "1.0-1"
subfolder: 300-commercial
info:
summary: Guardian Building
Expand All @@ -17,12 +17,12 @@ info:
- 5x2 and 2x5 growable CO$$$ lots.
- 5x2 ploppable CO$$$ lot.
- CAM version included.
- CAM version included.
- High definition (HD) version included.
- MaxisNite and DarkNite night versions included.
- DarkNite requires the [Day and Nite Modd](https://community.simtropolis.com/files/file/23089-simfox-day-and-nite-modd/).
- DarkNite requires the [Day and Nite Modd](https://community.simtropolis.com/files/file/23089-simfox-day-and-nite-modd/).
- Requires [mipro essentials January 2019](https://community.simtropolis.com/files/file/29130-mipro-essentials/) or newer.
![STEX-01.jpg.93150fc9edcd5c4f681006385b5d](https://www.simtropolis.com/objects/screens/monthly_2019_02/STEX-01.jpg.93150fc9edcd5c4f681006385b5d0e8a.jpg)
Expand All @@ -34,7 +34,7 @@ info:
3. If you use the CAM, download the CAMeLots. Replace the original growable lots with the CAMeLots. Ploppables are already compatible with CAM.
4. If you'd like to use the HD version, download the corresponding HD model, and replace the original .SC4Model file with it. If you change your mind, you can switch between HD and SD by swapping out the .SC4Model files. HD BATs have very large file sizes.
[mipro Forum Thread](https://community.simtropolis.com/forums/topic/60777-mipro/)
[mipro Forum Thread](https://community.simtropolis.com/forums/topic/60777-mipro/)
[mipro STEX Uploads](https://community.simtropolis.com/tags/mipro/)
author: Jasoncw
website: https://community.simtropolis.com/files/file/32737-guardian-building/
Expand All @@ -46,87 +46,87 @@ info:
dependencies:
- mipro:essentials
variants:
- variant: { nightmode: standard, CAM: "no", resolution: sd }
- variant: { nightmode: standard, CAM: "no", jasoncw:guardian-building:resolution: sd }
assets:
- assetId: jasoncw-guardian-building-maxisnite
- variant: { nightmode: standard, CAM: "no", resolution: hd }
- variant: { nightmode: standard, CAM: "no", jasoncw:guardian-building:resolution: hd }
assets:
- assetId: jasoncw-guardian-building-maxisnite
exclude:
- .SC4Model$
- assetId: jasoncw-guardian-building-hd-maxisnite
- variant: { nightmode: standard, CAM: "yes", resolution: sd }
- variant: { nightmode: standard, CAM: "yes", jasoncw:guardian-building:resolution: sd }
assets:
- assetId: jasoncw-guardian-building-maxisnite
exclude:
- /Jasoncw - Guardian Building - Grow \(CO\$\$\$8_2x5\)\.SC4Lot
- /Jasoncw - Guardian Building - Grow \(CO\$\$\$8_5x2\)\.SC4Lot
- /Jasoncw - Guardian Building \(MN\)\/Jasoncw - Guardian Building - Grow \(CO\$\$\$8_2x5\)\.SC4Lot$
- /Jasoncw - Guardian Building \(MN\)\/Jasoncw - Guardian Building - Grow \(CO\$\$\$8_5x2\)\.SC4Lot$
- assetId: jasoncw-guardian-building-cam
- variant: { nightmode: standard, CAM: "yes", resolution: hd }
- variant: { nightmode: standard, CAM: "yes", jasoncw:guardian-building:resolution: hd }
assets:
- assetId: jasoncw-guardian-building-maxisnite
exclude:
- /Jasoncw - Guardian Building - Grow \(CO\$\$\$8_2x5\)\.SC4Lot
- /Jasoncw - Guardian Building - Grow \(CO\$\$\$8_5x2\)\.SC4Lot
- /Jasoncw - Guardian Building \(MN\)\/Jasoncw - Guardian Building - Grow \(CO\$\$\$8_2x5\)\.SC4Lot$
- /Jasoncw - Guardian Building \(MN\)\/Jasoncw - Guardian Building - Grow \(CO\$\$\$8_5x2\)\.SC4Lot$
- .SC4Model$
- assetId: jasoncw-guardian-building-cam
- assetId: jasoncw-guardian-building-hd-maxisnite
- variant: { nightmode: dark, CAM: "no", resolution: sd }
- variant: { nightmode: dark, CAM: "no", jasoncw:guardian-building:resolution: sd }
dependencies: [ "simfox:day-and-nite-mod" ]
assets:
- assetId: jasoncw-guardian-building-darknite
- variant: { nightmode: dark, CAM: "no", resolution: hd }
- variant: { nightmode: dark, CAM: "no", jasoncw:guardian-building:resolution: hd }
dependencies: [ "simfox:day-and-nite-mod" ]
assets:
- assetId: jasoncw-guardian-building-darknite
exclude:
- .SC4Model$
- assetId: jasoncw-guardian-building-hd-darknite
- variant: { nightmode: dark, CAM: "yes", resolution: sd }
- variant: { nightmode: dark, CAM: "yes", jasoncw:guardian-building:resolution: sd }
dependencies: [ "simfox:day-and-nite-mod" ]
assets:
- assetId: jasoncw-guardian-building-darknite
exclude:
- /Jasoncw - Guardian Building - Grow \(CO\$\$\$8_2x5\)\.SC4Lot
- /Jasoncw - Guardian Building - Grow \(CO\$\$\$8_5x2\)\.SC4Lot
- /Jasoncw - Guardian Building \(DN\)\/Jasoncw - Guardian Building - Grow \(CO\$\$\$8_2x5\)\.SC4Lot$
- /Jasoncw - Guardian Building \(DN\)\/Jasoncw - Guardian Building - Grow \(CO\$\$\$8_5x2\)\.SC4Lot$
- assetId: jasoncw-guardian-building-cam
- variant: { nightmode: dark, CAM: "yes", resolution: hd }
- variant: { nightmode: dark, CAM: "yes", jasoncw:guardian-building:resolution: hd }
dependencies: [ "simfox:day-and-nite-mod" ]
assets:
- assetId: jasoncw-guardian-building-darknite
exclude:
- /Jasoncw - Guardian Building - Grow \(CO\$\$\$8_2x5\)\.SC4Lot
- /Jasoncw - Guardian Building - Grow \(CO\$\$\$8_5x2\)\.SC4Lot
- /Jasoncw - Guardian Building \(DN\)\/Jasoncw - Guardian Building - Grow \(CO\$\$\$8_2x5\)\.SC4Lot$
- /Jasoncw - Guardian Building \(DN\)\/Jasoncw - Guardian Building - Grow \(CO\$\$\$8_5x2\)\.SC4Lot$
- .SC4Model$
- assetId: jasoncw-guardian-building-cam
- assetId: jasoncw-guardian-building-hd-darknite

---
assetId: jasoncw-guardian-building-maxisnite
version: "1.0"
version: "1.0-1"
lastModified: "2019-02-01T05:23:19Z"
url: https://community.simtropolis.com/files/file/32737-guardian-building/?do=download&r=174538

---
assetId: jasoncw-guardian-building-darknite
version: "1.0"
version: "1.0-1"
lastModified: "2019-02-01T05:23:19Z"
url: https://community.simtropolis.com/files/file/32737-guardian-building/?do=download&r=174539

---
assetId: jasoncw-guardian-building-cam
version: "1.0"
version: "1.0-1"
lastModified: "2019-02-01T05:23:19Z"
url: https://community.simtropolis.com/files/file/32737-guardian-building/?do=download&r=174540

---
assetId: jasoncw-guardian-building-hd-maxisnite
version: "1.0"
version: "1.0-1"
lastModified: "2019-02-01T05:23:19Z"
url: https://community.simtropolis.com/files/file/32737-guardian-building/?do=download&r=174541

---
assetId: jasoncw-guardian-building-hd-darknite
version: "1.0"
version: "1.0-1"
lastModified: "2019-02-01T05:23:19Z"
url: https://community.simtropolis.com/files/file/32737-guardian-building/?do=download&r=174542

0 comments on commit 647b242

Please sign in to comment.