-
-
Notifications
You must be signed in to change notification settings - Fork 12
feat() Cassette generation #60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
5ea78b3
8d8ff02
21fbad9
40d8ff8
2045a03
b480463
9e21fcc
8a31943
0d5360c
79c784b
5afaab3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| import { TapeBoxCover } from './printMediaTypes'; | ||
| import { Authors } from './templateAuthors'; | ||
| 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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use Line 14 currently maps the bottom placeholder to 🩹 Proposed fix- .replace(referencColorTable.frontcolorBottom, variation.frontcolorTop)
+ .replace(referencColorTable.frontcolorBottom, variation.frontcolorBottom)📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||
| .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} | ||||||||||||||
| };`, | ||||||||||||||
| ); | ||||||||||||||
| 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, | ||
| }, | ||
| `; |
| 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, | ||
| }, | ||
|
|
||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This raw
.tsheader fails lint before generation runs.buildCassetteCover.mjsonly copies these imports as text, so ESLint still seesTapeBoxCoverandAuthorsas unused inscripts/cassette/baseCodeFile.ts. Use a non-TypeScript template file or generate the header string inside the script instead of keeping a linted.tsstub 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