From 7d9d1bc96a454acab2cb3d88e104117560358f2c Mon Sep 17 00:00:00 2001 From: Front <27463495+Frontesque@users.noreply.github.com> Date: Mon, 4 Apr 2022 17:49:24 -0400 Subject: [PATCH] refactor: :sparkles: Add TPPL TPPL is how vuetube now manages third party plugins (Third Party Plugin Loader) --- NUXT/nuxt.config.js | 1 + NUXT/pages/mods/plugins.vue | 3 +-- NUXT/plugins/{ => tempPlugins}/demoPlugin.js | 1 + NUXT/plugins/thirdPartyPluginLoader.js | 26 ++++++++++++++++++++ 4 files changed, 29 insertions(+), 2 deletions(-) rename NUXT/plugins/{ => tempPlugins}/demoPlugin.js (93%) create mode 100644 NUXT/plugins/thirdPartyPluginLoader.js diff --git a/NUXT/nuxt.config.js b/NUXT/nuxt.config.js index 1c333e1..7a5a7e9 100644 --- a/NUXT/nuxt.config.js +++ b/NUXT/nuxt.config.js @@ -15,6 +15,7 @@ export default { { src: "~/plugins/youtube", mode: "client" }, { src: "~/plugins/vuetube", mode: "client" }, { src: "~/plugins/ryd", mode: "client" }, + { src: "~/plugins/thirdPartyPluginLoader", mode: "client" }, ], generate: { dir: "../dist", diff --git a/NUXT/pages/mods/plugins.vue b/NUXT/pages/mods/plugins.vue index 09b6f03..f4ed81f 100644 --- a/NUXT/pages/mods/plugins.vue +++ b/NUXT/pages/mods/plugins.vue @@ -52,8 +52,7 @@ export default { }; }, async mounted() { - const temp = require("~/plugins/demoPlugin.js"); - this.plugins = [temp]; + this.plugins = await this.$tppl.list; }, }; diff --git a/NUXT/plugins/demoPlugin.js b/NUXT/plugins/tempPlugins/demoPlugin.js similarity index 93% rename from NUXT/plugins/demoPlugin.js rename to NUXT/plugins/tempPlugins/demoPlugin.js index 07c92b8..22a1db0 100644 --- a/NUXT/plugins/demoPlugin.js +++ b/NUXT/plugins/tempPlugins/demoPlugin.js @@ -1,6 +1,7 @@ module.exports = { manifest: { name: "Test plugin", + vuetube: "*", version: "1.0", author: "Frontesque", description: "A plugin to test how vuetube handles plugins // Add 'Hello, World!' to the home page.", diff --git a/NUXT/plugins/thirdPartyPluginLoader.js b/NUXT/plugins/thirdPartyPluginLoader.js new file mode 100644 index 0000000..8d94b50 --- /dev/null +++ b/NUXT/plugins/thirdPartyPluginLoader.js @@ -0,0 +1,26 @@ +//--- Modules/Imports ---// + +const module = { + + + //--- Get Plugins ---// + list: new Promise((resolve, reject) => { + let plugins = new Array(); + + // Temp Plugin List + plugins.push(require("~/plugins/tempPlugins/demoPlugin")) + // End Temp Plugin List + + resolve(plugins); + + }) + //--- End Get Plugins ---// + + + +}; + +//--- Start ---// +export default ({ app }, inject) => { + inject("tppl", module); +};