Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"make-logos": "node scripts/logos-data.mjs && prettier --write ./src/assets/logos/*.ts",
"preview": "vite preview",
"test": "vitest run"
"test": "vitest run",
"generate-cassette": "node scripts/cassette/buildCassetteCover.mjs"
},
"dependencies": {
"@emotion/react": "11.14.0",
Expand Down
2 changes: 2 additions & 0 deletions scripts/cassette/baseCodeFile.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import { TapeBoxCover } from './printMediaTypes';
import { Authors } from './templateAuthors';
Comment on lines +1 to +2
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

This raw .ts header fails lint before generation runs.

buildCassetteCover.mjs only copies these imports as text, so ESLint still sees TapeBoxCover and Authors as unused in scripts/cassette/baseCodeFile.ts. Use a non-TypeScript template file or generate the header string inside the script instead of keeping a linted .ts stub here.

🧰 Tools
🪛 ESLint

[error] 1-1: 'TapeBoxCover' is defined but never used.

(@typescript-eslint/no-unused-vars)


[error] 2-2: 'Authors' is defined but never used.

(@typescript-eslint/no-unused-vars)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/cassette/baseCodeFile.ts` around lines 1 - 2, The lint failure is
caused by unused TypeScript imports TapeBoxCover and Authors in the stub
baseCodeFile.ts; remove the TS header stub and instead produce the header
content from the generator (buildCassetteCover.mjs) or change the stub to a
non-TS template (e.g., .tpl/.txt) so ESLint won't parse unused symbols. Update
buildCassetteCover.mjs to emit the header string (including TapeBoxCover and
Authors references where needed) when writing the generated file, or replace
baseCodeFile.ts with a plain template file that the script copies without
TypeScript parsing.

47 changes: 47 additions & 0 deletions scripts/cassette/buildCassetteCover.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import {
cassetteColorVariations,
referencColorTable,
cassetteBaseTemplate,
} from './cassetteColorVariations.mjs';
import { readFileSync, writeFileSync } from 'fs';

const templateSvg = readFileSync(
'./scripts/cassette/cassetteMasterFile.svg',
'utf-8',
);
let importFile = readFileSync('./scripts/cassette/baseCodeFile.ts', 'utf-8');
let templateObject = '';

for (const variation of cassetteColorVariations) {
const newTemplate = templateSvg
.replace(referencColorTable.backColor, variation.backColor)
.replace(referencColorTable.colorSpineTop, variation.colorSpineTop)
.replace(referencColorTable.colorSpineBottom, variation.colorSpineBottom)
.replace(referencColorTable.frontcolorTop, variation.frontcolorTop)
.replace(referencColorTable.frontcolorBottom, variation.frontcolorTop)
.replace(referencColorTable.loadingLogoBack, variation.loadingLogoBack)
Comment on lines +20 to +22
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Use variation.frontcolorBottom for the bottom-front replacement.

Line 14 currently maps the bottom placeholder to variation.frontcolorTop, so frontcolorBottom is ignored.

🩹 Proposed fix
-    .replace(referencColorTable.frontcolorBottom, variation.frontcolorTop)
+    .replace(referencColorTable.frontcolorBottom, variation.frontcolorBottom)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
.replace(referencColorTable.frontcolorTop, variation.frontcolorTop)
.replace(referencColorTable.frontcolorBottom, variation.frontcolorTop)
.replace(referencColorTable.loadingLogoBack, variation.loadingLogoBack)
.replace(referencColorTable.frontcolorTop, variation.frontcolorTop)
.replace(referencColorTable.frontcolorBottom, variation.frontcolorBottom)
.replace(referencColorTable.loadingLogoBack, variation.loadingLogoBack)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/cassette/buildCassetteCover.mjs` around lines 13 - 15, Replace the
incorrect mapping that uses variation.frontcolorTop for the bottom front
placeholder: in the chained .replace calls in buildCassetteCover.mjs, change the
second .replace which currently uses referencColorTable.frontcolorBottom to pass
variation.frontcolorBottom (not variation.frontcolorTop) so
referencColorTable.frontcolorBottom is correctly replaced with
variation.frontcolorBottom.

.replace(referencColorTable.loadingLogoSpine, variation.loadingLogoSpine)
.replace(referencColorTable.loadingLogoFront, variation.loadingLogoFront);
writeFileSync(
`./src/assets/cassetteGenerated/${variation.label}.svg`,
newTemplate,
);
importFile = `${importFile}
import ${variation.label} from './assets/cassetteGenerated/${variation.label}.svg';`;

templateObject = `${templateObject}${
variation.label
}:${cassetteBaseTemplate.replace(
'url: cassetTape,',
`url: ${variation.label},`,
)}`;

console.log(`Generated ${variation.label}`);
}

writeFileSync(
`./src/cassetteTemplates.ts`,
`${importFile} export const cassetteTemplates = {
${templateObject}
};`,
);
168 changes: 168 additions & 0 deletions scripts/cassette/cassetteColorVariations.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
export const cassetteColorVariations = [
{
label: 'SufamiTurbo',
backColor: '#a8a8a8',
colorSpineTop: '#6dbf5b',
colorSpineBottom: '#a8a8a8',
frontcolorTop: '#6dbf5b',
frontcolorBottom: '#6dbf5b',
loadingLogoBack: '#000000',
loadingLogoSpine: '#FFFFFF',
loadingLogoFront: '#FFFFFF',
nfcLogoBack: '#000000',
nfcLogoSpine: '#FFFFFF',
nfcLogoFront: '#FFFFFF',
},
{
label: 'ps2',
backColor: '#000000',
colorSpineTop: '#000000',
colorSpineBottom: '#FFFFFF',
frontcolorTop: '#000000',
frontcolorBottom: '#000000',
loadingLogoBack: '#FFFFFF',
loadingLogoSpine: '#FFFFFF',
loadingLogoFront: '#FFFFFF',
nfcLogoBack: '#0000FF',
nfcLogoSpine: '#0000FF',
nfcLogoFront: '#0000FF',
},
{
label: 'steam',
backColor: '#000000',
colorSpineTop: '#102241',
colorSpineBottom: '#000000',
frontcolorTop: '#102241',
frontcolorBottom: '#102241',
loadingLogoBack: '#FFFFFF',
loadingLogoSpine: '#FFFFFF',
loadingLogoFront: '#FFFFFF',
nfcLogoBack: '#FFFFFF',
nfcLogoSpine: '#FFFFFF',
nfcLogoFront: '#FFFFFF',
},
{
label: 'msdos',
backColor: '#A9A9A9',
colorSpineTop: '#A9A9A9',
colorSpineBottom: '#A9A9A9',
frontcolorTop: '#A9A9A9',
frontcolorBottom: '#A9A9A9',
loadingLogoBack: '#000000',
loadingLogoSpine: '#000000',
loadingLogoFront: '#000000',
nfcLogoBack: '#000000',
nfcLogoSpine: '#000000',
nfcLogoFront: '#000000',
},
{
label: 'msx2',
backColor: '#A9A9A9',
colorSpineTop: '#1717D2',
colorSpineBottom: '#1717D2',
frontcolorTop: '#1717D2',
frontcolorBottom: '#1717D2',
loadingLogoBack: '#FFFFFF',
loadingLogoSpine: '#FFFFFF',
loadingLogoFront: '#FFFFFF',
nfcLogoBack: '#FFFFFF',
nfcLogoSpine: '#FFFFFF',
nfcLogoFront: '#FFFFFF',
},
{
label: 'xbox',
backColor: '#000000',
colorSpineTop: '#000000',
colorSpineBottom: '#000000',
frontcolorTop: '#000000',
frontcolorBottom: '#000000',
loadingLogoBack: '#60D03E',
loadingLogoSpine: '#60D03E',
loadingLogoFront: '#60D03E',
nfcLogoBack: '#60D03E',
nfcLogoSpine: '#60D03E',
nfcLogoFront: '#60D03E',
},
{
label: 'necpcengine',
backColor: '#F2F2EB',
colorSpineTop: '#F2F2EB',
colorSpineBottom: '#F2F2EB',
frontcolorTop: '#F2F2EB',
frontcolorBottom: '#F2F2EB',
loadingLogoBack: '#D83B37',
loadingLogoSpine: '#D83B37',
loadingLogoFront: '#D83B37',
nfcLogoBack: '#426F59',
nfcLogoSpine: '#426F59',
nfcLogoFront: '#426F59',
},
{
label: 'turbografx16',
backColor: '#FAF0DB',
colorSpineTop: '#000000',
colorSpineBottom: '#000000',
frontcolorTop: '#000000',
frontcolorBottom: '#000000',
loadingLogoBack: '#000000',
loadingLogoSpine: '#FFFFFF',
loadingLogoFront: '#FFFFFF',
nfcLogoBack: '#F2AC3C',
nfcLogoSpine: '#F2AC3C',
nfcLogoFront: '#F2AC3C',
},
{
label: 'famicom',
backColor: '#FEFCF1',
colorSpineTop: '#AE3130',
colorSpineBottom: '#B3975C',
frontcolorTop: '#AE3130',
frontcolorBottom: '#AE3130',
loadingLogoBack: '#000000',
loadingLogoSpine: '#FFFFFF',
loadingLogoFront: '#FFFFFF',
nfcLogoBack: '#000000',
nfcLogoSpine: '#FFFFFF',
nfcLogoFront: '#FFFFFF',
},
{
label: 'famicomdisk',
backColor: '#FEFCF1',
colorSpineTop: '#FFFFFF',
colorSpineBottom: '#FFFFFF',
frontcolorTop: '#FFFFFF',
frontcolorBottom: '#FFFFFF',
loadingLogoBack: '#000000',
loadingLogoSpine: '#000000',
loadingLogoFront: '#000000',
nfcLogoBack: '#000000',
nfcLogoSpine: '#EBBF45',
nfcLogoFront: '#EBBF45',
},
];

export const referencColorTable = {
backColor: '#FFFF00',
colorSpineTop: '#00FF00',
colorSpineBottom: '#FF00FF',
frontcolorTop: '#00FFFF',
frontcolorBottom: '#FF0000',
loadingLogoBack: '#1000FF',
loadingLogoSpine: '#2000FF',
loadingLogoFront: '#3000FF',
};

export const cassetteBaseTemplate = ` {
layout: 'horizontal',
label: 'Casset box cover',
canFill: true,
url: cassetTape,
version: 2,
canEdit: true,
author: Authors.animeotaku, // to be changed with Phoneix data
media: TapeBoxCover,
compatibleMedia: [TapeBoxCover],
key: 'cassetteBoxV2',
// preview: template_CassetteTapeCase_CassetBoxCover_16,
},
`;
117 changes: 117 additions & 0 deletions scripts/cassette/cassetteMasterFile.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
117 changes: 117 additions & 0 deletions src/assets/cassetteGenerated/SufamiTurbo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
117 changes: 117 additions & 0 deletions src/assets/cassetteGenerated/famicom.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
117 changes: 117 additions & 0 deletions src/assets/cassetteGenerated/famicomdisk.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
117 changes: 117 additions & 0 deletions src/assets/cassetteGenerated/msdos.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
117 changes: 117 additions & 0 deletions src/assets/cassetteGenerated/msx2.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
117 changes: 117 additions & 0 deletions src/assets/cassetteGenerated/necpcengine.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
117 changes: 117 additions & 0 deletions src/assets/cassetteGenerated/ps2.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
117 changes: 117 additions & 0 deletions src/assets/cassetteGenerated/steam.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
117 changes: 117 additions & 0 deletions src/assets/cassetteGenerated/turbografx16.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
117 changes: 117 additions & 0 deletions src/assets/cassetteGenerated/xbox.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions src/cardsTemplates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ import blackFramePreview from './assets/templatesPreviews/template_Standard NFC
// import upgradeStickerStdFull from './assets/UpgradeStandard_Single_Full.svg';
// import upgradeStickerStdFrame from './assets/UpgradeStandard_Single_Frame.svg';
import { Authors } from './templateAuthors';
import { cassetteTemplates } from './cassetteTemplates';
import type { templateTypeV2 } from './resourcesTypedef';
// import { logoResource } from './logos';

Expand Down Expand Up @@ -312,6 +313,7 @@ export const templates: Record<string, templateTypeV2> = {
key: 'miniNfcAlice',
preview: template_MiniNFCCard_Steam3by5cm_17,
},
...cassetteTemplates,
retroRemakePcb1: {
canEdit: true,
version: 2,
Expand Down
144 changes: 144 additions & 0 deletions src/cassetteTemplates.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
import { TapeBoxCover } from './printMediaTypes';
import { Authors } from './templateAuthors';
import SufamiTurbo from './assets/cassetteGenerated/SufamiTurbo.svg';
import ps2 from './assets/cassetteGenerated/ps2.svg';
import steam from './assets/cassetteGenerated/steam.svg';
import msdos from './assets/cassetteGenerated/msdos.svg';
import msx2 from './assets/cassetteGenerated/msx2.svg';
import xbox from './assets/cassetteGenerated/xbox.svg';
import necpcengine from './assets/cassetteGenerated/necpcengine.svg';
import turbografx16 from './assets/cassetteGenerated/turbografx16.svg';
import famicom from './assets/cassetteGenerated/famicom.svg';
import famicomdisk from './assets/cassetteGenerated/famicomdisk.svg'; export const cassetteTemplates = {
SufamiTurbo: {
layout: 'horizontal',
label: 'Casset box cover',
canFill: true,
url: SufamiTurbo,
version: 2,
canEdit: true,
author: Authors.animeotaku, // to be changed with Phoneix data
media: TapeBoxCover,
compatibleMedia: [TapeBoxCover],
key: 'cassetteBoxV2',
// preview: template_CassetteTapeCase_CassetBoxCover_16,
},
ps2: {
layout: 'horizontal',
label: 'Casset box cover',
canFill: true,
url: ps2,
version: 2,
canEdit: true,
author: Authors.animeotaku, // to be changed with Phoneix data
media: TapeBoxCover,
compatibleMedia: [TapeBoxCover],
key: 'cassetteBoxV2',
// preview: template_CassetteTapeCase_CassetBoxCover_16,
},
steam: {
layout: 'horizontal',
label: 'Casset box cover',
canFill: true,
url: steam,
version: 2,
canEdit: true,
author: Authors.animeotaku, // to be changed with Phoneix data
media: TapeBoxCover,
compatibleMedia: [TapeBoxCover],
key: 'cassetteBoxV2',
// preview: template_CassetteTapeCase_CassetBoxCover_16,
},
msdos: {
layout: 'horizontal',
label: 'Casset box cover',
canFill: true,
url: msdos,
version: 2,
canEdit: true,
author: Authors.animeotaku, // to be changed with Phoneix data
media: TapeBoxCover,
compatibleMedia: [TapeBoxCover],
key: 'cassetteBoxV2',
// preview: template_CassetteTapeCase_CassetBoxCover_16,
},
msx2: {
layout: 'horizontal',
label: 'Casset box cover',
canFill: true,
url: msx2,
version: 2,
canEdit: true,
author: Authors.animeotaku, // to be changed with Phoneix data
media: TapeBoxCover,
compatibleMedia: [TapeBoxCover],
key: 'cassetteBoxV2',
// preview: template_CassetteTapeCase_CassetBoxCover_16,
},
xbox: {
layout: 'horizontal',
label: 'Casset box cover',
canFill: true,
url: xbox,
version: 2,
canEdit: true,
author: Authors.animeotaku, // to be changed with Phoneix data
media: TapeBoxCover,
compatibleMedia: [TapeBoxCover],
key: 'cassetteBoxV2',
// preview: template_CassetteTapeCase_CassetBoxCover_16,
},
necpcengine: {
layout: 'horizontal',
label: 'Casset box cover',
canFill: true,
url: necpcengine,
version: 2,
canEdit: true,
author: Authors.animeotaku, // to be changed with Phoneix data
media: TapeBoxCover,
compatibleMedia: [TapeBoxCover],
key: 'cassetteBoxV2',
// preview: template_CassetteTapeCase_CassetBoxCover_16,
},
turbografx16: {
layout: 'horizontal',
label: 'Casset box cover',
canFill: true,
url: turbografx16,
version: 2,
canEdit: true,
author: Authors.animeotaku, // to be changed with Phoneix data
media: TapeBoxCover,
compatibleMedia: [TapeBoxCover],
key: 'cassetteBoxV2',
// preview: template_CassetteTapeCase_CassetBoxCover_16,
},
famicom: {
layout: 'horizontal',
label: 'Casset box cover',
canFill: true,
url: famicom,
version: 2,
canEdit: true,
author: Authors.animeotaku, // to be changed with Phoneix data
media: TapeBoxCover,
compatibleMedia: [TapeBoxCover],
key: 'cassetteBoxV2',
// preview: template_CassetteTapeCase_CassetBoxCover_16,
},
famicomdisk: {
layout: 'horizontal',
label: 'Casset box cover',
canFill: true,
url: famicomdisk,
version: 2,
canEdit: true,
author: Authors.animeotaku, // to be changed with Phoneix data
media: TapeBoxCover,
compatibleMedia: [TapeBoxCover],
key: 'cassetteBoxV2',
// preview: template_CassetteTapeCase_CassetBoxCover_16,
},

};
Loading