Skip to content

Commit

Permalink
change everything for product/subproduct to game/product
Browse files Browse the repository at this point in the history
  • Loading branch information
seiyria committed May 8, 2024
1 parent 77c962e commit 77891ed
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 36 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,19 @@ This repository obtains and reformats cards for the Leder Spotlight application.

### Products

1. Create a new file matching the product name in `content/meta-data`
1. Create a new folder in `content/card-data` (the name should match the `productName` in the `meta-data` file)
1. Create a new folder in `content/card-images` (the name should match the `productName` in the `meta-data` file)
1. Create a new folder in `content/card-symbols` (the name should match the `productName` in the `meta-data` file)
1. Add a new 512x512 PNG in `content/card-symbols/products` (the name should match the `productName` in the `meta-data` file)
1. Create a new file matching the game name in `content/meta-data`
1. Create a new folder in `content/card-data` (the name should match the `gameName` in the `meta-data` file)
1. Create a new folder in `content/card-images` (the name should match the `gameName` in the `meta-data` file)
1. Create a new folder in `content/card-symbols` (the name should match the `gameName` in the `meta-data` file)
1. Add a new 512x512 PNG in `content/card-symbols/products` (the name should match the `gameName` in the `meta-data` file)

Follow the guide for adding a new locale

### Locale

1. Create a new folder in `content/card-data/{product}` for the locale (probably `en-US`)
1. Add a `{subproduct}.yml` file here (or, as many separate files as desired - they all get concatenated together) and fill it with card data.
1. Create a new folder in `content/card-images/{product}` for the locale (probably `en-US`)
1. Create a new folder in `content/card-data/{game}` for the locale (probably `en-US`)
1. Add a `{game}.yml` file here (or, as many separate files as desired - they all get concatenated together) and fill it with card data.
1. Create a new folder in `content/card-images/{game}` for the locale (probably `en-US`)
1. Fill this folder with the images for the cards for the game.

### Adding New Filters
Expand Down
4 changes: 3 additions & 1 deletion content/card-data/arcs/en-US/arcsbasegame.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
- id: ARCS/BC01
text: >-
If you **Provoke Outrage**, keep this card.
You may spend any resources as Material. You ignore Outrage when spending Material for its Prelude action.
image: BC01
name: Loyal Engineers
Expand All @@ -85,6 +86,7 @@
- id: ARCS/BC02
text: >-
**Manufacture (Build):** Gain 1 Material.
**Prelude:** You may discard this to gain Material up to your number of empty resource slots. If the Material supply empties, steal the Material instead.
image: BC02
name: Mining Interest
Expand Down Expand Up @@ -608,4 +610,4 @@
name: Demagogue
tags:
- Base
- Leader
- Leader
32 changes: 16 additions & 16 deletions content/i18n/en-US.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ Pages:
CardNameLabel: Card Name
CardNamePlaceholder: Search any card name

ProductLabel: Product
ProductPlaceholder: Select product
ProductLabel: Game
ProductPlaceholder: Select game

SubproductsLabel: Subproducts
SubproductsPlaceholder: Select subproducts
SubproductsLabel: Products
SubproductsPlaceholder: Select products

TagsLabel: Tags
TagsPlaceholder: Select tags
Expand Down Expand Up @@ -139,26 +139,26 @@ Pages:
Product:
Name: Product
Text: >
You can find cards that are associated with a certain product/game by using the `product:` operator.
You can find cards that are associated with a certain game by using the `game:` operator.
Examples:
- Example: '`product:oath`'
Text: Cards that belong to the Oath product.
- Example: '`game:oath`'
Text: Cards that belong to the Oath game.

- Example: '`-product:root`'
Text: Cards that don't belong to the Root product.
- Example: '`-game:root`'
Text: Cards that don't belong to the Root game.

Subproduct:
Name: Subproduct
Name: Product
Text: >
You can find cards that are associated with a certain subproduct/expansion by using the `subproduct:` operator.
You can find cards that are associated with a certain product by using the `product:` operator.
Examples:
- Example: '`subproduct:clockwork-1`'
Text: Cards that belong to the Clockwork 1 subproduct.
- Example: '`product:clockwork-1`'
Text: Cards that belong to the Clockwork 1 product.

- Example: '`-subproduct:exiles-partisans`'
Text: Cards that don't belong to the Exiles & Partisans subproduct.
- Example: '`-product:exiles-partisans`'
Text: Cards that don't belong to the Exiles & Partisans product.

Tag:
Name: Tag
Expand Down Expand Up @@ -190,7 +190,7 @@ Pages:
Sorted: Sorted by
SortedName: Name
SortedID: ID
SortedProduct: Product
SortedProduct: Game

Asc: Asc ↑
Desc: Desc ↓
Expand Down
10 changes: 5 additions & 5 deletions scripts/build-card-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ fs.ensureDirSync('./dist');
const formatCard = (card) => {
if (
!fs.existsSync(
`./content/card-images/${card.product}/${card.locale}/${card.image}.png`,
`./content/card-images/${card.game}/${card.locale}/${card.image}.png`,
)
) {
card.locale = 'en-US';
}

const baseImageName = card.image;
card.image = `https://ledercards.netlify.app/cards/${card.product}/${
card.image = `https://ledercards.netlify.app/cards/${card.game}/${
card.locale
}/${encodeURIComponent(baseImageName)}.webp`;

Expand All @@ -30,12 +30,12 @@ const readAllCards = async () => {
.map((f) => {
const cards = yaml.load(fs.readFileSync(f));

const [, , product, locale] = f.split(path.sep);
const subproduct = path.basename(f, '.yml');
const [, , game, locale] = f.split(path.sep);
const product = path.basename(f, '.yml');

cards.forEach((c) => {
c.game = game;
c.product = product;
c.subproduct = subproduct;
c.locale = locale;
});

Expand Down
6 changes: 3 additions & 3 deletions scripts/build-card-images.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ const copyAllCardImages = async () => {
const productLocales = new Set();

allCardImages.forEach((f) => {
const [, , product, locale, filename] = f.split(path.sep);
filenameMapping[f] = `${product}/${locale}/${filename}`;
const [, , game, locale, filename] = f.split(path.sep);
filenameMapping[f] = `${game}/${locale}/${filename}`;

productLocales.add(`${product}/${locale}`);
productLocales.add(`${game}/${locale}`);
});

productLocales.forEach((prodLocale) => {
Expand Down
6 changes: 3 additions & 3 deletions scripts/validate-cards.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ allCards.forEach((card, index) => {
process.exit(1);
}

if (!card.product) {
console.error(`Card ${card.id} does not have a product.`);
if (!card.game) {
console.error(`Card ${card.id} does not have a game.`);
process.exit(1);
}

Expand All @@ -40,8 +40,8 @@ allCards.forEach((card, index) => {
'text',
'image',
'imageClass',
'game',
'product',
'subproduct',
'locale',
'tags',
'meta',
Expand Down

0 comments on commit 77891ed

Please sign in to comment.