cleanup and warn if there are collisions in .style.js files
This commit is contained in:
parent
6811191147
commit
f4bf374509
@ -24,6 +24,9 @@ const components = {
|
|||||||
const componentsContext = require.context('src', true, /\.style.js(on)?$/)
|
const componentsContext = require.context('src', true, /\.style.js(on)?$/)
|
||||||
componentsContext.keys().forEach(key => {
|
componentsContext.keys().forEach(key => {
|
||||||
const component = componentsContext(key).default
|
const component = componentsContext(key).default
|
||||||
|
if (components[component.name] != null) {
|
||||||
|
console.warn(`Component in file ${key} is trying to override existing component ${component.name}! You have collisions/duplicates!`)
|
||||||
|
}
|
||||||
components[component.name] = component
|
components[component.name] = component
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -169,7 +172,6 @@ export const init = (extraRuleset, palette) => {
|
|||||||
|
|
||||||
return rule
|
return rule
|
||||||
})
|
})
|
||||||
console.log(rulesetUnsorted)
|
|
||||||
|
|
||||||
const ruleset = rulesetUnsorted
|
const ruleset = rulesetUnsorted
|
||||||
.map((data, index) => ({ data, index }))
|
.map((data, index) => ({ data, index }))
|
||||||
@ -188,8 +190,6 @@ export const init = (extraRuleset, palette) => {
|
|||||||
})
|
})
|
||||||
.map(({ data }) => data)
|
.map(({ data }) => data)
|
||||||
|
|
||||||
console.log(ruleset.filter(c => c.component === 'ButtonUnstyled'))
|
|
||||||
|
|
||||||
const virtualComponents = new Set(Object.values(components).filter(c => c.virtual).map(c => c.name))
|
const virtualComponents = new Set(Object.values(components).filter(c => c.virtual).map(c => c.name))
|
||||||
|
|
||||||
const findColor = (color, dynamicVars) => {
|
const findColor = (color, dynamicVars) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user