fix: bundle Rocky site manual mapping
This commit is contained in:
parent
56e9e13b56
commit
ff461a0272
1 changed files with 21 additions and 20 deletions
|
|
@ -1,5 +1,4 @@
|
||||||
import { readFileSync } from 'fs'
|
import siteManufacturerMapping from '@/lib/site-manufacturer-mapping.json'
|
||||||
import { join } from 'path'
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Site configuration interface
|
* Site configuration interface
|
||||||
|
|
@ -31,27 +30,29 @@ function loadSiteMapping(): {
|
||||||
return siteMappingCache
|
return siteMappingCache
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const fallback = {
|
||||||
|
sites: {
|
||||||
|
'rockymountainvending.com': {
|
||||||
|
tier: 1,
|
||||||
|
description: 'Default site configuration',
|
||||||
|
manufacturers: ['Crane', 'Royal Vendors', 'GPL', 'AP', 'Dixie-Narco', 'USI', 'Vendo'],
|
||||||
|
includePaymentComponents: true,
|
||||||
|
minManualCount: 3,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
manufacturerAliases: {},
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const mappingPath = join(process.cwd(), 'lib', 'site-manufacturer-mapping.json')
|
siteMappingCache = siteManufacturerMapping as {
|
||||||
const content = readFileSync(mappingPath, 'utf-8')
|
sites: Record<string, SiteConfig>
|
||||||
const mapping = JSON.parse(content)
|
manufacturerAliases: Record<string, string[]>
|
||||||
siteMappingCache = mapping
|
}
|
||||||
return mapping
|
return siteMappingCache
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error loading site manufacturer mapping:', error)
|
console.error('Error loading site manufacturer mapping:', error)
|
||||||
// Return default configuration for rockymountainvending.com
|
siteMappingCache = fallback
|
||||||
return {
|
return siteMappingCache
|
||||||
sites: {
|
|
||||||
'rockymountainvending.com': {
|
|
||||||
tier: 1,
|
|
||||||
description: 'Default site configuration',
|
|
||||||
manufacturers: ['Crane', 'Royal Vendors', 'GPL', 'AP', 'Dixie-Narco', 'USI', 'Vendo'],
|
|
||||||
includePaymentComponents: true,
|
|
||||||
minManualCount: 3,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
manufacturerAliases: {},
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue