-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add support for the pesde package manager
- Loading branch information
Showing
265 changed files
with
3,902 additions
and
2,789 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,5 @@ | ||
.env.luau | ||
.env.luau | ||
pesde.lock | ||
lune_packages | ||
luau_packages | ||
bundled.luau |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--> run a script, scripts can be found under ./lune/scripts, they're generally just luau files that are quickly put together | ||
--> in order to achieve something quickly - such as automating files | ||
|
||
-- NOTE: we're using the `Lune` runtime in the CI/CD environment, so we're not going to be using the `@std-polyfills` | ||
-- package that the discord-luau package uses. | ||
|
||
local process = require("@lune/process") | ||
local fs = require("@lune/fs") | ||
|
||
local task = require("./task") | ||
|
||
local processArguments = table.clone(process.args) | ||
local scriptName = table.remove(processArguments, 1) | ||
local scriptPath = `.lune/scripts/{scriptName}.luau` | ||
|
||
assert(fs.isFile(scriptPath), `Script '{scriptName}' not found! Unable to execute script!`) | ||
|
||
local taskObject = task.new("lune"):addArgument("run"):addArgument(scriptPath) | ||
|
||
for _, argument in processArguments do | ||
taskObject:addArgument(argument) | ||
end | ||
|
||
taskObject:execute() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
local fs = require("@lune/fs") | ||
local process = require("@lune/process") | ||
|
||
local packageDir = process.args[1] | ||
|
||
local function patchFile(dir, fileName) | ||
local fileData = fs.readFile(`{dir}/{fileName}`) | ||
|
||
for requirePath: string in fileData.gmatch(fileData, 'local %S+ = require%("(%S+)"%)') do | ||
if string.sub(requirePath, 1, 1) == "@" then | ||
print(`{dir}/{fileName}`) | ||
end | ||
end | ||
end | ||
|
||
local function readFolder(dir) | ||
for _, object in fs.readDir(dir) do | ||
if fs.isDir(`{dir}/{object}`) then | ||
readFolder(`{dir}/{object}`) | ||
else | ||
patchFile(dir, object) | ||
end | ||
end | ||
end | ||
|
||
readFolder(packageDir) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
local fs = require("@lune/fs") | ||
local process = require("@lune/process") | ||
|
||
local luaTableSource = "{\n" | ||
local packageDir = process.args[1] | ||
|
||
local function readFile(dir, fileName) | ||
local fileName = string.sub(fileName, 1, -6) | ||
local source = `{dir}/{fileName}` | ||
|
||
luaTableSource = `local {fileName} = require("{string.gsub(source, packageDir .. "/", "")}")\n` .. luaTableSource | ||
luaTableSource ..= `{fileName} = {fileName},\n` | ||
end | ||
|
||
local function openFolder(dir) | ||
local dirSplit = string.split(dir, "/") | ||
local dirName = dirSplit[#dirSplit] | ||
|
||
luaTableSource ..= `{dirName} = \{\n` | ||
end | ||
|
||
local function closeFolder() | ||
luaTableSource ..= `},\n` | ||
end | ||
|
||
local function readFolder(dir) | ||
for _, object in fs.readDir(dir) do | ||
if fs.isDir(`{dir}/{object}`) then | ||
openFolder(`{dir}/{object}`) | ||
readFolder(`{dir}/{object}`) | ||
closeFolder() | ||
else | ||
readFile(dir, object) | ||
end | ||
end | ||
end | ||
|
||
readFolder(packageDir) | ||
|
||
luaTableSource ..= "}\n" | ||
|
||
print(luaTableSource) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,12 @@ | ||
{ | ||
"editor.formatOnSave": true, | ||
"luau-lsp.require.mode": "relativeToFile", | ||
"luau-lsp.inlayHints.variableTypes": true, | ||
"luau-lsp.inlayHints.functionReturnTypes": true, | ||
"luau-lsp.inlayHints.parameterNames": "all", | ||
"luau-lsp.inlayHints.parameterTypes": true, | ||
"luau-lsp.inlayHints.typeHintMaxLength": 50, | ||
"luau-lsp.require.mode": "relativeToFile", | ||
"luau-lsp.require.directoryAliases": { | ||
"@lune/": "~/.lune/.typedefs/0.8.8/", | ||
"@builders": "./packages/builders/src", | ||
"@cdn": "./packages/cdn/src", | ||
"@classes": "./packages/classes/src", | ||
"@core": "./packages/core/src", | ||
"@extensions": "./packages/extensions/src", | ||
"@std-polyfills": "./packages/std-polyfills/src", | ||
"@api-types": "./packages/api-types/src", | ||
"@rest": "./packages/rest/src", | ||
"@utils": "./packages/utils/src", | ||
"@vendor": "./packages/vendor/src", | ||
"@voice": "./packages/voice/src", | ||
"@websocket": "./packages/websocket/src", | ||
"@frktest": "./extern/frktest/src" | ||
"@lune/": "~/.lune/.typedefs/0.8.8/" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ lune = "lune-org/[email protected]" | |
# moonwave-extractor = "evaera/[email protected]" | ||
selene = "Kampfkarren/[email protected]" | ||
stylua = "JohnnyMorganz/[email protected]" | ||
darklua = "seaofvoices/[email protected]" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--> Task to execute Darklua for bundling the various packages apart of Discord-Luau | ||
|
||
local task = require("../../../.lune/task") | ||
|
||
task.new("darklua") | ||
:addArgument("process") | ||
:addArgument("src/init.luau") | ||
:addArgument("bundled.luau") | ||
:addArgument(`-cdarklua.json`) | ||
:execute() | ||
|
||
task.new("stylua"):addArgument("bundled.luau"):execute() | ||
task.new("lune"):addArgument("run"):addArgument("fixTypes"):execute() | ||
task.new("stylua"):addArgument("bundled.luau"):execute() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
--> Task responsible for bundling the API-Types package, as well as fixing types for said package because at the moment | ||
--> types are not bundled via Darklua. | ||
|
||
local fs = require("@lune/fs") | ||
|
||
local stream = require("../luau_packages/stream") | ||
|
||
local fileContent = fs.readFile("bundled.luau") | ||
local fileTypes = {} | ||
|
||
local hasFoundType = true | ||
|
||
while hasFoundType do | ||
local cursor = string.find(fileContent, `export type`) | ||
|
||
if not cursor then | ||
hasFoundType = false | ||
|
||
continue | ||
end | ||
|
||
local stream = stream.new(fileContent, cursor + 11) | ||
local name, generics, definition = "", "", "" | ||
|
||
stream:trim() | ||
|
||
name = stream:advanceUntil(function(char: string) | ||
local isNotChar = string.match(char, "%a") == nil | ||
local isNotNumber = tonumber(char) == nil | ||
|
||
return isNotChar and isNotNumber | ||
end) :: string | ||
|
||
stream:trim() | ||
|
||
if string.sub(name, #name, #name) == "<" then | ||
name = string.sub(name, 1, #name - 1) | ||
|
||
generics = `<` .. stream:advanceUntil(function(char: string) | ||
return char == ">" | ||
end) :: string | ||
end | ||
|
||
stream:trim() | ||
stream:advance() -- skip '=' | ||
stream:trim() | ||
|
||
local bracketScope = 0 | ||
|
||
while true do | ||
definition ..= stream:advanceUntil(function(char) | ||
if char == "<" or char == "{" then | ||
bracketScope += 1 | ||
end | ||
|
||
if char == ">" or char == "}" then | ||
bracketScope -= 1 | ||
end | ||
|
||
return char == "\n" | ||
end) :: string | ||
|
||
if bracketScope > 0 then | ||
continue | ||
end | ||
|
||
stream:trim() | ||
|
||
if stream:peek() == "|" or stream:peek() == '"' then | ||
continue | ||
end | ||
|
||
break | ||
end | ||
|
||
fileContent = string.sub(fileContent, 1, cursor - 1) .. string.sub(fileContent, stream.cursorPosition, #fileContent) | ||
|
||
for _, phrase in { "objects.", "apiTypes." } do | ||
definition = string.gsub(definition, phrase, "") | ||
end | ||
|
||
table.insert(fileTypes, { | ||
name = name, | ||
generics = generics, | ||
definition = definition, | ||
}) | ||
end | ||
|
||
local splitContent = string.split(fileContent, "\n") | ||
local lastLineCount = 0 | ||
|
||
for index = #splitContent, 0, -1 do | ||
lastLineCount += 1 | ||
|
||
if string.find(splitContent[index], "return {") then | ||
break | ||
end | ||
end | ||
|
||
for _, type in fileTypes do | ||
table.insert( | ||
splitContent, | ||
#splitContent - lastLineCount + 1, | ||
`export type {type.name}{type.generics or ""} = {type.definition}` | ||
) | ||
end | ||
|
||
-- warn(table.concat(splitContent, "\n")) | ||
|
||
fs.writeFile("bundled.luau", table.concat(splitContent, "\n")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"generator": "retain_lines", | ||
"bundle": { | ||
"require_mode": { | ||
"name": "path", | ||
"module_folder_name": "init", | ||
"sources": {} | ||
}, | ||
"modules_identifier": "__DARKLUA_BUNDLE_MODULES", | ||
"excludes": [ | ||
"@lune/**" | ||
] | ||
} | ||
} |
Oops, something went wrong.