fix(npmextra): merge old npmextra keys into new keys during migration, preserving existing new values
This commit is contained in:
@@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@git.zone/cli',
|
||||
version: '2.13.0',
|
||||
version: '2.13.1',
|
||||
description: 'A comprehensive CLI tool for enhancing and managing local development workflows with gitzone utilities, focusing on project setup, version control, code formatting, and template management.'
|
||||
}
|
||||
|
||||
@@ -16,8 +16,17 @@ const migrateNamespaceKeys = (npmextraJson: any): boolean => {
|
||||
{ oldKey: 'szci', newKey: '@ship.zone/szci' },
|
||||
];
|
||||
for (const { oldKey, newKey } of migrations) {
|
||||
if (npmextraJson[oldKey] && !npmextraJson[newKey]) {
|
||||
npmextraJson[newKey] = npmextraJson[oldKey];
|
||||
if (npmextraJson[oldKey]) {
|
||||
if (!npmextraJson[newKey]) {
|
||||
// New key doesn't exist - simple rename
|
||||
npmextraJson[newKey] = npmextraJson[oldKey];
|
||||
} else {
|
||||
// New key exists - merge old into new (old values don't overwrite new)
|
||||
npmextraJson[newKey] = {
|
||||
...npmextraJson[oldKey],
|
||||
...npmextraJson[newKey],
|
||||
};
|
||||
}
|
||||
delete npmextraJson[oldKey];
|
||||
migrated = true;
|
||||
console.log(`Migrated npmextra.json: ${oldKey} -> ${newKey}`);
|
||||
|
||||
@@ -16,8 +16,17 @@ const migrateNamespaceKeys = (npmextraJson: any): boolean => {
|
||||
{ oldKey: 'szci', newKey: '@ship.zone/szci' },
|
||||
];
|
||||
for (const { oldKey, newKey } of migrations) {
|
||||
if (npmextraJson[oldKey] && !npmextraJson[newKey]) {
|
||||
npmextraJson[newKey] = npmextraJson[oldKey];
|
||||
if (npmextraJson[oldKey]) {
|
||||
if (!npmextraJson[newKey]) {
|
||||
// New key doesn't exist - simple rename
|
||||
npmextraJson[newKey] = npmextraJson[oldKey];
|
||||
} else {
|
||||
// New key exists - merge old into new (old values don't overwrite new)
|
||||
npmextraJson[newKey] = {
|
||||
...npmextraJson[oldKey],
|
||||
...npmextraJson[newKey],
|
||||
};
|
||||
}
|
||||
delete npmextraJson[oldKey];
|
||||
migrated = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user