-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7f21581
commit 246a126
Showing
4 changed files
with
87 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
markdown-openfl-textfield Change Log | ||
|
||
1.0.0 (2020-10-21) | ||
|
||
- Initial release |
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,73 @@ | ||
|
||
import haxe.Json; | ||
import haxe.crypto.Crc32; | ||
import haxe.io.Bytes; | ||
import haxe.io.Path; | ||
import haxe.zip.Entry; | ||
import haxe.zip.Writer; | ||
import sys.FileSystem; | ||
import sys.io.File; | ||
|
||
class PackageHaxelib { | ||
public static function main():Void { | ||
var entries = new List<Entry>(); | ||
addFile(FileSystem.absolutePath("../haxelib.json"), entries); | ||
addFile(FileSystem.absolutePath("../README.md"), entries); | ||
addFile(FileSystem.absolutePath("../CHANGELOG.md"), entries); | ||
addFile(FileSystem.absolutePath("../LICENSE"), entries); | ||
addDirectory(FileSystem.absolutePath("../src"), true, entries); | ||
|
||
var jsonContent = File.getContent("../haxelib.json"); | ||
var json = Json.parse(jsonContent); | ||
var packageName = Std.string(json.name); | ||
var packageVersion = Std.string(json.version); | ||
var releaseNote = Std.string(json.releasenote); | ||
var packageFileName = '${packageName}-${packageVersion}-haxelib.zip'; | ||
var outputFolderPath = FileSystem.absolutePath("../bin/"); | ||
FileSystem.createDirectory(outputFolderPath); | ||
var zipFilePath = Path.join([outputFolderPath, packageFileName]); | ||
Sys.println('haxelib: ${packageName}'); | ||
Sys.println('version: ${packageVersion}'); | ||
Sys.println('releasenote: ${releaseNote}'); | ||
Sys.println('file: ${zipFilePath}'); | ||
|
||
var zipFileOutput = File.write(zipFilePath, true); | ||
var zip = new Writer(zipFileOutput); | ||
zip.write(entries); | ||
} | ||
|
||
private static function addFile(filePath:String, result:List<Entry>):Void { | ||
addFileInternal(filePath, Path.directory(filePath), result); | ||
} | ||
|
||
private static function addDirectory(directoryPath:String, recursive:Bool, result:List<Entry>):Void { | ||
addDirectoryInternal(directoryPath, Path.directory(directoryPath), recursive, result); | ||
} | ||
|
||
private static function addFileInternal(filePath:String, relativeToDirPath:String, result:List<Entry>):Void { | ||
var fileName = StringTools.replace(filePath, relativeToDirPath + "/", ""); | ||
var bytes = Bytes.ofData(File.getBytes(filePath).getData()); | ||
result.add({ | ||
fileName: fileName, | ||
fileSize: bytes.length, | ||
fileTime: Date.now(), | ||
compressed: false, | ||
dataSize: 0, | ||
data: bytes, | ||
crc32: Crc32.make(bytes) | ||
}); | ||
} | ||
|
||
private static function addDirectoryInternal(directoryPath:String, relativeTo:String, recursive:Bool, result:List<Entry>):Void { | ||
for (fileName in FileSystem.readDirectory(directoryPath)) { | ||
var filePath = Path.join([directoryPath, fileName]); | ||
if (FileSystem.isDirectory(filePath)) { | ||
if (recursive) { | ||
addDirectoryInternal(filePath, relativeTo, true, result); | ||
} | ||
} else { | ||
addFileInternal(filePath, relativeTo, result); | ||
} | ||
} | ||
} | ||
} |
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,7 @@ | ||
# markdown-openfl-textfield haxelib | ||
|
||
To package a _.zip_ file for Haxelib, run the following command: | ||
|
||
```sh | ||
haxe ./haxelib.hxml | ||
``` |
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,2 @@ | ||
-main PackageHaxelib | ||
--interp |