minify + fix lzwfs ui bug
This commit is contained in:
6
minify/.package
Normal file
6
minify/.package
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
title = 'Lua minification',
|
||||
repository = 'kepler155c/opus-apps/{{OPUS_BRANCH}}/minify',
|
||||
description = [[ Minifies Lua files ]],
|
||||
license = 'MIT',
|
||||
}
|
||||
2949
minify/minify.lua
Normal file
2949
minify/minify.lua
Normal file
File diff suppressed because it is too large
Load Diff
25
minify/minifyDir.lua
Normal file
25
minify/minifyDir.lua
Normal file
@@ -0,0 +1,25 @@
|
||||
local fs = _G.fs
|
||||
local shell = _ENV.shell
|
||||
|
||||
local function recurse(path)
|
||||
if fs.isDir(path) then
|
||||
for _, v in pairs(fs.listEx(path)) do
|
||||
if not v.isReadOnly then
|
||||
recurse(fs.combine(path, v.name))
|
||||
end
|
||||
end
|
||||
elseif path:match('%.lua$') and not fs.isReadOnly(path) then
|
||||
local sz = fs.getSize(path)
|
||||
shell.run('packages/minify/minify.lua minify ' .. path)
|
||||
print(string.format('%s : %.2f%%', path, (sz - fs.getSize(path)) / sz * 100))
|
||||
end
|
||||
end
|
||||
|
||||
local path = ({ ... })[1] or error('Syntax: minifyDir PATH')
|
||||
|
||||
path = fs.combine(path, '')
|
||||
if not fs.isDir(path) then
|
||||
error('Invalid path')
|
||||
end
|
||||
|
||||
recurse(path)
|
||||
Reference in New Issue
Block a user