adaptlearning / adapt-cli

Command line and library interface for the Adapt Framework
https://community.adaptlearning.org/
24 stars 21 forks source link

Advice on referencing local plugins & their paths #191

Closed taylortom closed 11 months ago

taylortom commented 11 months ago

Context: I'm adding the update API, and need to be able to copy locally installed plugins to and from a temp location during the update


Issue 1

UPDATE: I'm able to reference local plugins using Project.getInstallTargets, let me know if this is not the way

I'm having trouble retrieving a list of locally installed plugins (i.e. those not managed by bower). It looks like I should be able to do this using a combination of Project and Plugin, i.e. something like:

const project = new Project({ cwd })
const localPlugins = (await project.getInstalledPlugins()).filter(p => p.isLocalSource)

However, I'm currently not getting any useful values back from isLocalSource, isLocalSourceZip & sourcePath, so I'm left having to figure this all out manually.


Issue 2

My adapt.json looks a bit strange, with an unexpected(?) mixture of paths & versions. See excerpt below:

{
  // all bower managed plugins look like this (as expected)
  "adapt-contrib-vanilla": "*",
  // some local plugins have a version
  "adapt-search": "3.0.0", 
  // other local plugins have a path (the original upload path which doesn't exist)
  "adapt-youtube": "FRAMEWORK_IMPORT_PATH/src/components/adapt-youtube",
  "adapt-videoBackground": "PLUGIN_UPLOAD_PATH"
}

I would expect the value for local plugins to be their current dir (in the current situation the paths reference a temp upload dir which no longer exists) - this may be a misunderstanding on my part (I perhaps need to move the uploaded files to somewhere more permanent prior to handing off the rest of the installation to the CLI?)

taylortom commented 11 months ago

Has been discussed