Skip to content

Commit

Permalink
final 0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
2jammers committed Aug 25, 2024
1 parent 0e0637b commit 55df181
Show file tree
Hide file tree
Showing 15 changed files with 144 additions and 51 deletions.
21 changes: 4 additions & 17 deletions .lune/discord.luau
Original file line number Diff line number Diff line change
@@ -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]
Expand All @@ -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}`,
Expand All @@ -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,
Expand Down
15 changes: 5 additions & 10 deletions dev.project.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
}
}
Expand Down
6 changes: 5 additions & 1 deletion docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
### Added

- Initial release! 🥳

[unreleased]: https://github.com/lumin-dev/LuminPluginFramework/compare/v0.1.0...HEAD
4 changes: 2 additions & 2 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
4 changes: 2 additions & 2 deletions rokit.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

[tools]
wally = "UpliftGames/[email protected]"
argon = "argon-rbx/[email protected].14"
argon = "argon-rbx/[email protected].17"
wally-package-types = "johnnymorganz/[email protected]"
stylua = "johnnymorganz/[email protected]"
lune = "lune-org/[email protected].7"
lune = "lune-org/[email protected].8"
24 changes: 24 additions & 0 deletions src/Library/Action.luau
Original file line number Diff line number Diff line change
@@ -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,
}
2 changes: 1 addition & 1 deletion src/Library/Data.luau
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
-- Variables

local plugin: Plugin = script:FindFirstAncestor("Plugin")
local plugin: Plugin = script:FindFirstAncestorWhichIsA("Plugin")
local Cache = {}

-- Functions
Expand Down
64 changes: 64 additions & 0 deletions src/Library/Menu.luau
Original file line number Diff line number Diff line change
@@ -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,
}
9 changes: 0 additions & 9 deletions src/Library/Prompt.luau

This file was deleted.

5 changes: 5 additions & 0 deletions src/Types.luau
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export type MenuChildren = {
{ string } | MenuChildren | PluginAction
}

return {}
Empty file removed src/Utility/Debug.luau
Empty file.
11 changes: 4 additions & 7 deletions src/init.luau
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -29,5 +25,6 @@ return {
Data = Data,
Action = Action,
Menu = Menu,
Prompt = Prompt,

Plugin = plugin,
}
1 change: 0 additions & 1 deletion tests/client/test.client.luau

This file was deleted.

1 change: 0 additions & 1 deletion tests/server/test.server.luau

This file was deleted.

28 changes: 28 additions & 0 deletions tests/test.server.luau
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit 55df181

Please sign in to comment.