1
0
Fork 0
freesewing/sites/shared/config/designs.mjs

29 lines
915 B
JavaScript
Raw Normal View History

/*
* Do not use the 'config' webpack alias here because
* this is used in the prebuild step which is pure NodeJS
*/
import allDesigns from '../../../config/software/designs.json' assert { type: 'json' }
2023-05-01 18:27:06 +02:00
/*
* Filter out utility patterns by checking whether they have any tags
* assigned to them
*/
const nonUtilityDesigns = {}
for (const [name, conf] of Object.entries(allDesigns)) {
2023-09-25 17:49:39 +02:00
if (typeof conf.design === 'string') conf.design = [conf.design]
if (typeof conf.code === 'string') conf.code = [conf.code]
2023-05-01 18:27:06 +02:00
if (conf.tags) nonUtilityDesigns[name] = conf
}
export const designs = nonUtilityDesigns
const allTags = new Set()
2023-09-24 19:07:16 +02:00
const allTechniques = new Set()
2023-05-01 18:27:06 +02:00
for (const conf of Object.values(designs)) {
for (const tag of conf.tags) allTags.add(tag)
2023-09-24 19:07:16 +02:00
for (const technique of conf.techniques) allTechniques.add(technique)
2023-05-01 18:27:06 +02:00
}
export const tags = [...allTags]
2023-09-24 19:07:16 +02:00
export const techniques = [...allTechniques]