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 { join } from 'path'
|
||||
import siteManufacturerMapping from '@/lib/site-manufacturer-mapping.json'
|
||||
|
||||
/**
|
||||
* Site configuration interface
|
||||
|
|
@ -31,27 +30,29 @@ function loadSiteMapping(): {
|
|||
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 {
|
||||
const mappingPath = join(process.cwd(), 'lib', 'site-manufacturer-mapping.json')
|
||||
const content = readFileSync(mappingPath, 'utf-8')
|
||||
const mapping = JSON.parse(content)
|
||||
siteMappingCache = mapping
|
||||
return mapping
|
||||
siteMappingCache = siteManufacturerMapping as {
|
||||
sites: Record<string, SiteConfig>
|
||||
manufacturerAliases: Record<string, string[]>
|
||||
}
|
||||
return siteMappingCache
|
||||
} catch (error) {
|
||||
console.error('Error loading site manufacturer mapping:', error)
|
||||
// Return default configuration for rockymountainvending.com
|
||||
return {
|
||||
sites: {
|
||||
'rockymountainvending.com': {
|
||||
tier: 1,
|
||||
description: 'Default site configuration',
|
||||
manufacturers: ['Crane', 'Royal Vendors', 'GPL', 'AP', 'Dixie-Narco', 'USI', 'Vendo'],
|
||||
includePaymentComponents: true,
|
||||
minManualCount: 3,
|
||||
},
|
||||
},
|
||||
manufacturerAliases: {},
|
||||
}
|
||||
siteMappingCache = fallback
|
||||
return siteMappingCache
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue