Remove completed legacy-migration cluster from topdata (#45)
The legacy normalize migration is done (confirmed). This deletes the dead migration path: NormalizeProject + 26 *_migrate.go files, the importLegacyItempropsRegistry cluster, loadLegacyTLK, and their tests (~7.9k lines, -33 files worth). mergeLegacyTLK moved into tlk_native.go since the live TLK compiler still uses it for base_dialog.json. make check passes. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Reviewed-on: #45 Reviewed-by: gitea-bot <gitea-bot@noreply.git.westgate.pw> Co-authored-by: vickydotbat <vickydotbat@tutamail.com> Co-committed-by: vickydotbat <vickydotbat@tutamail.com>
This commit was merged in pull request #45.
This commit is contained in:
@@ -6642,81 +6642,6 @@ func marshalOrderedLockfile(keys []string, lockData map[string]int, formatting j
|
||||
return buffer.Bytes(), nil
|
||||
}
|
||||
|
||||
func loadLegacyTLK(root string) (*legacyTLKData, error) {
|
||||
info, err := os.Stat(root)
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
return nil, nil
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
if !info.IsDir() {
|
||||
return nil, fmt.Errorf("legacy tlk root must be a directory: %s", root)
|
||||
}
|
||||
|
||||
result := &legacyTLKData{
|
||||
Language: "en",
|
||||
Entries: map[string]tlkEntryData{},
|
||||
Lock: map[string]int{},
|
||||
}
|
||||
|
||||
lockPath := filepath.Join(root, "lock.json")
|
||||
lockData, err := loadLockfile(lockPath)
|
||||
if err != nil && !os.IsNotExist(err) {
|
||||
return nil, err
|
||||
}
|
||||
for key, id := range lockData {
|
||||
result.Lock[key] = id
|
||||
}
|
||||
|
||||
basePath := filepath.Join(root, "base.json")
|
||||
if _, err := os.Stat(basePath); err == nil {
|
||||
base, err := loadJSONObject(basePath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if language, ok := base["language"].(string); ok && language != "" {
|
||||
result.Language = language
|
||||
}
|
||||
if entries, ok := base["entries"].(map[string]any); ok {
|
||||
normalized, err := normalizeLegacyTLKEntries(entries)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for key, entry := range normalized {
|
||||
result.Entries[key] = entry
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
modulesDir := filepath.Join(root, "modules")
|
||||
modulePaths, err := collectModulePaths(modulesDir)
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
return result, nil
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
for _, path := range modulePaths {
|
||||
obj, err := loadJSONObject(path)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
entries, ok := obj["entries"].(map[string]any)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
normalized, err := normalizeLegacyTLKEntries(entries)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("%s: %w", path, err)
|
||||
}
|
||||
for key, entry := range normalized {
|
||||
result.Entries[key] = entry
|
||||
}
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func normalizeLegacyTLKEntries(entries map[string]any) (map[string]tlkEntryData, error) {
|
||||
normalized := map[string]tlkEntryData{}
|
||||
for _, key := range sortedKeys(entries) {
|
||||
|
||||
Reference in New Issue
Block a user