Get the current plugin version (PanelFlyout) from the manifest?

Welcome all my friends .
I’m having a little problem with my plugin
My code is :

//pluginVersion..
const pluginVersion = require("uxp").versions.plugin;
console.log("Plugin Version - v"+pluginVersion);

I want to make it appear
it should appear in the drop-down list of the my plugin.

With regards …
Mohamed Fathi… :pray:

Try this instead:

const { versions } = require("uxp");
console.log("Plugin Version - v" + versions.plugin);
console.log("UXP Version - v" + versions.uxp);

Your code should work though…

Hi @Mohamad
It is not quite clear to me where the version information should be shown.
Do you mean inside the Plugins menu?
image

hi Timothy.
The code works fine, but the problem lies in the menu for the plugin.
The result of the console:


However, when I open the plugin drop-down menu, the plugin version does not appear as it is in manifest.json.
This result:
PanelFlyout

With regards…
Mohamed Fathi… :pray:

Hi @Mohamad
The only way I know is to add a “dummy” command to the manifest.json file:

  "entrypoints": [
    {
      "type": "command",
      "id" : "versionInfo",
      "label": "Version v1.2.3"
    },

This would show the version as a “static” info and must be edited manually each time you change the verison number.

image

I don’t see a way to change the EntryPoint information dynamically via Javascript.

1 Like

Try this if you want to show the version in the plugin’s menu.

const { entrypoints } = require("uxp");
const { versions } = require("uxp");
const pluginVersion = versions.plugin;

entrypoints.setup({
  panels: {
   pluginId: { // plugin id from manifest file
      show(body) {
  
      },
     
         menuItems: [
        {
          id: "pluginVersion",
          label: `Plugin Version ${pluginVersion}`,
          checked: false,
          enabled: false,
        }, ]
    },
   
  }
});
2 Likes

I will try and see the results and share it :smiling_face:

hi Wanokuni.
I am very grateful for your help :wine_glass: