// build olurken bazı klasorlerin ayri script olarak kaydedilmesi
export const TEMPLATE_CHUNK_GROUPS: Record<string, (RegExp | string)[]> = {
  store: [/\/src\/stores\//],
  //lott: [/\/src\/module\/cekilisler\//],
  //user: [/\/src\/module\/kullanicilar\//],
  //cust: [/\/src\/module\/uyeler\//],
  //acc: [/\/src\/module\/muhasebe\//],
  //site: [/\/src\/module\/site-yonetimi\//],
  //aut: [/\/src\/module\/auth\//]
}

// id -> group_name
export function SetTemplateGroup(id: string): string | undefined {
  const cleanId = id.split('?')[0]
  for (const [group, pats] of Object.entries(TEMPLATE_CHUNK_GROUPS)) {
    if (
      pats.some((p) => (typeof p === 'string' ? cleanId.includes(p) : p.test(cleanId)))
    ) {
      return group
    }
  }
  return undefined
}
