fix(pm): parse name

This commit is contained in:
chenos 2024-04-29 13:00:10 +08:00
parent 3b7342456f
commit c5b803a750
2 changed files with 4 additions and 3 deletions

View File

@ -2,7 +2,7 @@ import { Migration } from '../migration';
export default class extends Migration {
on = 'afterSync'; // 'beforeLoad' or 'afterLoad'
appVersion = '<1.0.0-alpha.1';
appVersion = '<1.0.0-alpha.3';
async up() {
const items = await this.pm.repository.find();

View File

@ -530,6 +530,7 @@ export class PluginManager {
const toBeUpdated = [];
for (const name of pluginNames) {
const { name: pluginName } = await PluginManager.parseName(name);
console.log('pluginName', pluginName);
const plugin = this.get(pluginName);
if (!plugin) {
throw new Error(`${pluginName} plugin does not exist`);
@ -822,7 +823,7 @@ export class PluginManager {
const { packageName, tempFile, tempPackageContentDir } = await downloadAndUnzipToTempDir(file, authToken);
const name = options.name || packageName;
const { name } = await PluginManager.parseName(packageName);
if (this.has(name)) {
await removeTmpDir(tempFile, tempPackageContentDir);
@ -857,7 +858,7 @@ export class PluginManager {
authToken,
);
const name = options.name || packageName;
const { name } = await PluginManager.parseName(packageName);
if (this.has(name)) {
await removeTmpDir(tempFile, tempPackageContentDir);