fix(deps): Update dependencies
This commit is contained in:
@@ -3,6 +3,29 @@ import * as paths from '../paths.js';
|
||||
import * as gulpFunction from '@push.rocks/gulp-function';
|
||||
import { Project } from '../classes.project.js';
|
||||
|
||||
/**
|
||||
* Migrates npmextra.json from old namespace keys to new package-scoped keys
|
||||
*/
|
||||
const migrateNamespaceKeys = (npmextraJson: any): boolean => {
|
||||
let migrated = false;
|
||||
const migrations = [
|
||||
{ oldKey: 'gitzone', newKey: '@git.zone/cli' },
|
||||
{ oldKey: 'tsdoc', newKey: '@git.zone/tsdoc' },
|
||||
{ oldKey: 'npmdocker', newKey: '@git.zone/tsdocker' },
|
||||
{ oldKey: 'npmci', newKey: '@ship.zone/szci' },
|
||||
{ oldKey: 'szci', newKey: '@ship.zone/szci' },
|
||||
];
|
||||
for (const { oldKey, newKey } of migrations) {
|
||||
if (npmextraJson[oldKey] && !npmextraJson[newKey]) {
|
||||
npmextraJson[newKey] = npmextraJson[oldKey];
|
||||
delete npmextraJson[oldKey];
|
||||
migrated = true;
|
||||
console.log(`Migrated npmextra.json: ${oldKey} -> ${newKey}`);
|
||||
}
|
||||
}
|
||||
return migrated;
|
||||
};
|
||||
|
||||
/**
|
||||
* runs the npmextra file checking
|
||||
*/
|
||||
@@ -13,8 +36,11 @@ export const run = async (projectArg: Project) => {
|
||||
const fileString = fileArg.contents.toString();
|
||||
const npmextraJson = JSON.parse(fileString);
|
||||
|
||||
if (!npmextraJson.gitzone) {
|
||||
npmextraJson.gitzone = {};
|
||||
// Migrate old namespace keys to new package-scoped keys
|
||||
migrateNamespaceKeys(npmextraJson);
|
||||
|
||||
if (!npmextraJson['@git.zone/cli']) {
|
||||
npmextraJson['@git.zone/cli'] = {};
|
||||
}
|
||||
|
||||
const expectedRepoInformation: string[] = [
|
||||
@@ -31,7 +57,7 @@ export const run = async (projectArg: Project) => {
|
||||
for (const expectedRepoInformationItem of expectedRepoInformation) {
|
||||
if (
|
||||
!plugins.smartobject.smartGet(
|
||||
npmextraJson.gitzone,
|
||||
npmextraJson['@git.zone/cli'],
|
||||
expectedRepoInformationItem,
|
||||
)
|
||||
) {
|
||||
@@ -53,7 +79,7 @@ export const run = async (projectArg: Project) => {
|
||||
);
|
||||
if (cliProvidedValue) {
|
||||
plugins.smartobject.smartAdd(
|
||||
npmextraJson.gitzone,
|
||||
npmextraJson['@git.zone/cli'],
|
||||
expectedRepoInformationItem,
|
||||
cliProvidedValue,
|
||||
);
|
||||
@@ -63,8 +89,8 @@ export const run = async (projectArg: Project) => {
|
||||
// delete obsolete
|
||||
// tbd
|
||||
|
||||
if (!npmextraJson.npmci) {
|
||||
npmextraJson.npmci = {};
|
||||
if (!npmextraJson['@ship.zone/szci']) {
|
||||
npmextraJson['@ship.zone/szci'] = {};
|
||||
}
|
||||
|
||||
fileArg.setContentsFromString(JSON.stringify(npmextraJson, null, 2));
|
||||
|
||||
Reference in New Issue
Block a user