Skip to content

Commit

Permalink
feat: revision 0.0.6 (#79)
Browse files Browse the repository at this point in the history
  • Loading branch information
RodrigoDornelles authored Sep 25, 2024
1 parent d2b0ef4 commit ec61d61
Show file tree
Hide file tree
Showing 53 changed files with 1,630 additions and 527 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
*.css linguist-generated
*.sh linguist-generated
*.bat linguist-generated
.luaurc linguist-language=Json
35 changes: 35 additions & 0 deletions .github/workflows/CD.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: cd

on:
workflow_dispatch:
push:
tags:
- "*.*.*"

permissions:
id-token: write

jobs:
npm-gly-cli:
runs-on: ubuntu-latest
steps:
-
uses: actions/checkout@master
-
uses: leafo/gh-actions-lua@v10
with:
luaVersion: "5.4"
-
uses: actions/setup-node@v2
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
-
run: |
lua tools/build_npm_cli.lua
-
working-directory: ./dist
run: |
npm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
53 changes: 49 additions & 4 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,19 @@ on:

jobs:
test:
runs-on: ubuntu-latest
if: github.event_name == 'push' || github.event.pull_request.draft == false
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
lua_version: ['5.1', '5.3', '5.4']
steps:
-
uses: actions/checkout@master
-
uses: leafo/gh-actions-lua@v10
with:
luaVersion: "5.4.7"
luaVersion: ${{ matrix.lua_version }}
-
uses: leafo/gh-actions-luarocks@v4
-
Expand All @@ -29,8 +33,49 @@ jobs:
luarocks install luaunit
-
run: |
./cli.sh test-self --coverage
./cli.sh cli-test --coverage
-
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository
if: (matrix.lua_version == '5.4') && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository)
run: |
bash <(curl -s https://codecov.io/bash) -t ${{ secrets.CODECOV_TOKEN }}
version:
if: github.event_name == 'push'
name: test version
runs-on: ubuntu-latest
steps:
-
uses: actions/checkout@master
-
uses: leafo/gh-actions-lua@v10
with:
luaVersion: '5.4'
-
run: |
lua tools/versionchecker.lua
lint:
if: github.event_name == 'push' || github.event.pull_request.draft == false
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
core: ['native']
steps:
-
uses: actions/checkout@master
-
uses: leafo/gh-actions-lua@v10
with:
luaVersion: '5.4'
-
run: |
wget https://github.com/luau-lang/luau/releases/download/0.644/luau-ubuntu.zip
unzip luau-ubuntu.zip
-
run: |
./cli.sh build --bundler --core ${{ matrix.core }}
./cli.sh fs-replace dist/main.lua dist/main.lua --format "function native_callback" --replace "local function _native_callback"
-
run: |
./luau-analyze dist/main.lua
25 changes: 25 additions & 0 deletions .luaurc
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"languageMode": "nonstrict",
"lint": { "*": true},
"lintErrors": true,
"globals": [
"Buffer",
"jsRequire",
"load",
"loadfile",
"love",
"native_dict_http",
"native_dict_json",
"native_dict_poly",
"native_dict_xml",
"native_draw_clear",
"native_draw_color",
"native_draw_flush",
"native_draw_font",
"native_draw_line",
"native_draw_rect",
"native_draw_start",
"native_draw_text",
"io"
]
}
4 changes: 3 additions & 1 deletion Doxyfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Custom Configs
DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = "Engine"
PROJECT_NUMBER = 0.0.4
PROJECT_NUMBER = 0.0.6
PROJECT_BRIEF = "Game engine in lua"
PROJECT_LOGO =
OUTPUT_DIRECTORY = .
Expand Down Expand Up @@ -34,6 +34,8 @@ ALIASES += startjson=@startuml{json}
ALIASES += endjson=@enduml
ALIASES += startebnf=@startuml{ebnf}
ALIASES += endebnf=@enduml
ALIASES += startsalt=@startuml{salt}
ALIASES += endsalt=@enduml
# Theme: https://jothepro.github.io/doxygen-awesome-css/
GENERATE_TREEVIEW = YES
DISABLE_INDEX = NO
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ lua cli.lua build @asteroids --core love --run
lua cli.lua build @asteroids --core html5
```

#### CLI Plataform Support
#### CLI Platform Support

| command | lua 5.4 | lua 5.3 | lua 5.1 | luajit | installation |
| :-----: | :-----: | :-----: | :-----: | :----: | :----------- |
| cli.sh | :ok: | :ok: | :ok: | :ok: | `git clone https://github.com/gamelly/gly-engine`
| cli.lua | :ok: | :ok: | :x: | :ok: | `wget get.gamely.com.br/cli.lua`
| gly-cli | :ok: | | | | `npm install -g @gamely/gly-cli`

#### Engine Plataform Support
#### Engine Platform Support

| Tier 1 | HTML5, WebOS2020 or later | main platform for production |
| :----- | :------------------------ | :------------ |
Expand Down
4 changes: 3 additions & 1 deletion cli.sh

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

137 changes: 137 additions & 0 deletions mock/bootstrap.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
--! @todo this code is ugly!

local io = io or {open = function(a, b) end, popen = function (a) end}
local javascript_path = jsRequire and jsRequire('path')
local javascript_fs = jsRequire and jsRequire('fs')
local javascript_ps = jsRequire and jsRequire('child_process')
local real_io_open = io and io.open
local real_require = require

if package and package.searchers and require then
require = function(module_name)
local file_name = module_name..'.lua'
if package.preload[module_name] then
return package.preload[module_name]
end
if BOOTSTRAP[file_name] then
package.preload[module_name] = load(BOOTSTRAP[file_name])()
return package.preload[module_name]
end
return real_require(module_name)
end
end

local function file_reader(self, mode, size, func)
if not self.content or #self.content == 0 then
self.content = func()
end

if self.pointer >= #self.content then
return nil
elseif size == '*a' then
return self.content
elseif size == nil then
local content = self.content
local line_index = content:find('\n', self.pointer)
if line_index then
local line = content:sub(self.pointer, line_index)
self.pointer = self.pointer + #line
return line
else
local line = content:sub(self.pointer)
self.pointer = self.pointer + #line
return line
end
elseif type(size) == 'number' then
local content = self.content:sub(self.pointer, self.pointer + size)
self.pointer = self.pointer + #content
return content
else
error("not implemented: "..tostring(size))
end
end

local function bootstrap_has_file(filename, mode)
if not BOOTSTRAP then return false end
if BOOTSTRAP_DISABLE then return false end
if not BOOTSTRAP[filename] then return false end
if mode and not mode:find('r') then return false end
return true
end

local function bootstrap_io_open(filename, mode)
return {
pointer = 1,
read = function(self, size)
return file_reader(self, mode, size, function()
return BOOTSTRAP[filename]
end)
end,
write = function() end,
close = function() end
}
end

local function javascript_io_open(filename, mode)
if (not mode or mode:find('r')) and not javascript_fs.existsSync(filename) then
return nil
end

return {
pointer = 1,
content = '',
read = function(self, size)
return file_reader(self, mode, size, function()
return javascript_fs.readFileSync(filename, 'utf8')
end)
end,
write = function(self, content)
self.content = self.content..content
end,
close = function(self)
javascript_fs.mkdirSync(javascript_path.dirname(filename), {recursive = true})
if mode:find('b') then
local blob, index = {}, 1
while index <= #self.content do
blob[index] = string.byte(self.content, index)
index = index + 1
end
javascript_fs.writeFileSync(filename, Buffer.from(blob))
else
javascript_fs.writeFileSync(filename, self.content)
end
end
}
end

io.open = function(filename, mode)
local file = real_io_open(filename, mode)

if javascript_fs then
file = javascript_io_open(filename, mode)
end

if not file and bootstrap_has_file(filename, mode) then
file = bootstrap_io_open(filename, mode)
end

return file
end

if jsRequire then
os.execute = function(cmd)
return pcall(javascript_ps.execSync, cmd)
end
os.popen = function(cmd)
local ok, stdout = pcall(javascript_ps.execSync, cmd, {encoding='utf8'})
return {
read = function(self, size)
return file_reader(self, mode, size, function()
return stdout
end)
end,
write = function() end,
close = function() return ok, '' end
}
end
end
28 changes: 28 additions & 0 deletions npm-gly-cli.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "@gamely/gly-cli",
"version": "0.0.6",
"author": "RodrigoDornelles",
"license": "Apache-2.0",
"homepage": "https://gamely.com.br",
"repository": "https://github.com/gamelly/gly-engine",
"funding": "https://github.com/sponsors/RodrigoDornelles",
"bugs": "https://github.com/gamelly/gly-engine/issues",
"description": "A Lua-based command-line interface for managing GLY game engine projects.",
"keywords": [
"game engine",
"game",
"engine",
"lua",
"love",
"cli",
"tizen",
"webos",
"webassembly"
],
"bin": {
"gly-cli": "bin/gly-cli"
},
"dependencies": {
"demoon": "0.0.9"
}
}
Loading

0 comments on commit ec61d61

Please sign in to comment.