From 55df181dbf6ffd976d07b20c47908129d08867cc Mon Sep 17 00:00:00 2001 From: James <119134081+2jammers@users.noreply.github.com> Date: Sat, 24 Aug 2024 20:39:00 -0500 Subject: [PATCH] final 0.1.0 --- .lune/discord.luau | 21 +++--------- dev.project.json | 15 +++----- docs/changelog.md | 6 +++- docs/installation.md | 4 +-- rokit.toml | 4 +-- src/Library/Action.luau | 24 +++++++++++++ src/Library/Data.luau | 2 +- src/Library/Menu.luau | 64 +++++++++++++++++++++++++++++++++++ src/Library/Prompt.luau | 9 ----- src/Types.luau | 5 +++ src/Utility/Debug.luau | 0 src/init.luau | 11 +++--- tests/client/test.client.luau | 1 - tests/server/test.server.luau | 1 - tests/test.server.luau | 28 +++++++++++++++ 15 files changed, 144 insertions(+), 51 deletions(-) delete mode 100644 src/Library/Prompt.luau delete mode 100644 src/Utility/Debug.luau delete mode 100644 tests/client/test.client.luau delete mode 100644 tests/server/test.server.luau create mode 100644 tests/test.server.luau diff --git a/.lune/discord.luau b/.lune/discord.luau index 579edd3..f846af4 100644 --- a/.lune/discord.luau +++ b/.lune/discord.luau @@ -1,21 +1,8 @@ local net = require("@lune/net") local process = require("@lune/process") -local roleIds = { - Aegis = "1219124088249782322", - LuminFramework = "1205321049957339228", - LuminNet = "1270253679626162197", - Snacky = "1205321076905869332", - LuminPluginSuite = "1262079690785558640", -} - -local maintainerRoleIds = { - Aegis = "1265887260046397563", - LuminFramework = "1265887191922511953", - LuminNet = "1270141341665333359", - Snacky = "1265887289976950814", - LuminPluginSuite = "1265887316858114098", -} +local projectRole = "1277040514205614141" +local projectMainterRole = "1277040552012943411" local webhook_url = process.args[1] local type = process.args[2] @@ -31,7 +18,7 @@ if type == "announcement" then method = "POST", headers = { ["Content-Type"] = "application/json" }, body = net.jsonEncode({ - content = if noPing then nil else `<@&{roleIds[projectName]}>`, + content = if noPing == true then nil else `<@&{projectRole}>`, embeds = { { title = `Release {tag} · lumin-dev/{projectName}`, @@ -56,7 +43,7 @@ elseif type == "event" then method = "POST", headers = { ["Content-Type"] = "application/json" }, body = net.jsonEncode({ - content = `<@&{maintainerRoleIds[projectName]}>`, + content = `<@&{projectMainterRole}>`, embeds = { { title = title, diff --git a/dev.project.json b/dev.project.json index 3eca2cb..d5e50c3 100644 --- a/dev.project.json +++ b/dev.project.json @@ -1,22 +1,17 @@ { - "legacyScripts": false, + "legacyScripts": true, "name": "PluginFramework", "tree": { "$className": "DataModel", "ReplicatedStorage": { - "Packages": { + "Plugin": { "$path": "Packages", "plugin_framework": { "$path": "src" + }, + "Test": { + "$path": "tests/test.server.luau" } - }, - "Tests": { - "Client": { - "$path": "tests/client" - }, - "Server": { - "$path": "tests/server" - } } } } diff --git a/docs/changelog.md b/docs/changelog.md index 5cdc113..9d3fc2e 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -7,4 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] -[unreleased]: https://github.com/lumin-dev/PROJECT/compare/v0.1.0...HEAD \ No newline at end of file +### Added + +- Initial release! 🥳 + +[unreleased]: https://github.com/lumin-dev/LuminPluginFramework/compare/v0.1.0...HEAD \ No newline at end of file diff --git a/docs/installation.md b/docs/installation.md index 743bbad..fbc113d 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -2,12 +2,12 @@ ### Roblox -1. Go to the [latest releases page](https://github.com/lumin-dev/PROJECT/releases/latest) +1. Go to the [latest releases page](https://github.com/lumin-dev/LuminPluginFramework/releases/latest) 2. Download `Standalone.rbxm` 3. Select `Insert from file`, and find `Standalone.rbxm` in your designated downloads folder ### Wally 1. Open a project in your favorite text editor -2. Add `lumin/PROJECT@^VERSION` to your `wally.toml` file +2. Add `lumin/plugin-framework@^0.1.0` to your `wally.toml` file 3. Run `wally install` the project should be inside of your `/Packages` directory. \ No newline at end of file diff --git a/rokit.toml b/rokit.toml index 3b4b647..e128131 100644 --- a/rokit.toml +++ b/rokit.toml @@ -5,7 +5,7 @@ [tools] wally = "UpliftGames/wally@0.3.2" -argon = "argon-rbx/argon@2.0.14" +argon = "argon-rbx/argon@2.0.17" wally-package-types = "johnnymorganz/wally-package-types@1.3.2" stylua = "johnnymorganz/stylua@0.20.0" -lune = "lune-org/lune@0.8.7" +lune = "lune-org/lune@0.8.8" diff --git a/src/Library/Action.luau b/src/Library/Action.luau index e69de29..a826373 100644 --- a/src/Library/Action.luau +++ b/src/Library/Action.luau @@ -0,0 +1,24 @@ +-- Variables + +local HttpService = game:GetService("HttpService") +local plugin: Plugin = script:FindFirstAncestorWhichIsA("Plugin") + +-- Functions + +local function new( + name: string, + description: string, + icon: string, + callback: () -> (), + allowBinding: boolean? +): PluginAction + local Action = plugin:CreatePluginAction(HttpService:GenerateGUID(false), name, description, icon, allowBinding) + Action.Triggered:Connect(callback) + return Action +end + +-- Module + +return { + new = new, +} \ No newline at end of file diff --git a/src/Library/Data.luau b/src/Library/Data.luau index 6510a9d..ccdd897 100644 --- a/src/Library/Data.luau +++ b/src/Library/Data.luau @@ -1,6 +1,6 @@ -- Variables -local plugin: Plugin = script:FindFirstAncestor("Plugin") +local plugin: Plugin = script:FindFirstAncestorWhichIsA("Plugin") local Cache = {} -- Functions diff --git a/src/Library/Menu.luau b/src/Library/Menu.luau index e69de29..4f115b3 100644 --- a/src/Library/Menu.luau +++ b/src/Library/Menu.luau @@ -0,0 +1,64 @@ +-- Variables + +local HttpService = game:GetService("HttpService") +local plugin: Plugin = script:FindFirstAncestorWhichIsA("Plugin") + +local Types = require(script.Parent.Parent.Types) + +local Index = {} +Index.__index = Index + +-- Functions + +local function PluginMenu(name: string, children: Types.MenuChildren, icon: string) + local Menu = plugin:CreatePluginMenu(HttpService:GenerateGUID(false), name, icon) + for index, metadata in children do + if type(metadata) == "table" then + if type((metadata :: any)[1]) == "table" then + Menu:AddMenu( + PluginMenu( + (metadata :: any)[1][2], + metadata :: any, + (metadata :: any)[1][3] + ) + ) + continue + end + if (metadata :: any)[1] == "_Menu" then + continue + end + Menu:AddNewAction((metadata :: any)[1], (metadata :: any)[2], (metadata :: any)[3]) + else + Menu:AddAction((metadata :: any)[1]) + end + end + return Menu +end + +local function new(name: string, children: Types.MenuChildren, icon: string?) + local self = setmetatable({ + Menu = PluginMenu(name, children, icon or ""), + }, Index) + return self +end + +function Index.Append(self: any, children: Types.MenuChildren) + self.Menu:AddMenu() +end + +function Index.Clear(self: any) + self.Menu:Clear() +end + +function Index.Show(self: any, callback: (id: PluginAction) -> ()) + local Identifier = self.Menu:ShowAsync() + if Identifier then + callback(Identifier) + end +end + +-- Module + +return { + new = new, +} diff --git a/src/Library/Prompt.luau b/src/Library/Prompt.luau deleted file mode 100644 index dd7a18a..0000000 --- a/src/Library/Prompt.luau +++ /dev/null @@ -1,9 +0,0 @@ --- Variables - -local plugin: Plugin = script:FindFirstAncestor("Plugin") - --- Functions - --- Modules - -return {} \ No newline at end of file diff --git a/src/Types.luau b/src/Types.luau index e69de29..f094f47 100644 --- a/src/Types.luau +++ b/src/Types.luau @@ -0,0 +1,5 @@ +export type MenuChildren = { + { string } | MenuChildren | PluginAction +} + +return {} diff --git a/src/Utility/Debug.luau b/src/Utility/Debug.luau deleted file mode 100644 index e69de29..0000000 diff --git a/src/init.luau b/src/init.luau index d6ade99..b4033b0 100644 --- a/src/init.luau +++ b/src/init.luau @@ -1,19 +1,15 @@ -- Variables -local ReplicatedStorage = game:GetService("ReplicatedStorage") -local Packages = ReplicatedStorage.Packages +local Packages = script.Parent local Lumin = require(Packages.framework) -local plugin: Plugin = script:FindFirstAncestor("Plugin") +local plugin: Plugin = script:FindFirstAncestorWhichIsA("Plugin") local Library = script.Library local Data = require(Library.Data) local Action = require(Library.Action) local Menu = require(Library.Menu) -local Prompt = require(Library.Prompt) - --- Functions -- Module @@ -29,5 +25,6 @@ return { Data = Data, Action = Action, Menu = Menu, - Prompt = Prompt, + + Plugin = plugin, } diff --git a/tests/client/test.client.luau b/tests/client/test.client.luau deleted file mode 100644 index 442659b..0000000 --- a/tests/client/test.client.luau +++ /dev/null @@ -1 +0,0 @@ -print("Hello world!") \ No newline at end of file diff --git a/tests/server/test.server.luau b/tests/server/test.server.luau deleted file mode 100644 index 442659b..0000000 --- a/tests/server/test.server.luau +++ /dev/null @@ -1 +0,0 @@ -print("Hello world!") \ No newline at end of file diff --git a/tests/test.server.luau b/tests/test.server.luau new file mode 100644 index 0000000..a23e3fa --- /dev/null +++ b/tests/test.server.luau @@ -0,0 +1,28 @@ +local Framework = require(script.Parent.plugin_framework) +local Bool = Instance.new("BoolValue") + +local Menu = Framework.Menu.new("TestingMenu", { + { "ActionA", "A", "rbxasset://textures/loading/robloxTiltRed.png" }, + { "ActionB", "B", "rbxasset://textures/loading/robloxTilt.png" }, + { + { "_Menu", "C", "rbxasset://textures/explosion.png" }, + { "ActionD", "D", "rbxasset://textures/whiteCircle.png" }, + { "ActionE", "E", "rbxasset://textures/icon_ROBUX.png" }, + }, +}) + +Bool.Changed:Connect(function() + if Bool.Value then + Bool.Value = false + Menu:Show(function(selected) + print(selected.Text, selected.ActionId) + end) + end +end) + +Bool.Name = "Toggle Menu" +Bool.Parent = game + +Framework.Action.new("Shortcut", "A test shortcut", "rbxasset://textures/whiteCircle.png", function() + print("You did it!") +end) \ No newline at end of file