diff --git a/.gitignore b/.gitignore index 4d00a931..6288797b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +.haxelib/ +node_modules/ /*.cdb /new.img /src/test/test.js @@ -6,8 +8,9 @@ /bin/Release.n /www/file /bin/style.min.css -/www/sample /bin/castle.js +/bin/index.js +/bin/*.js.map /bin/nwjs /bin/*.lnk -/dist \ No newline at end of file +/dist diff --git a/README.md b/README.md index deb5545e..4d3aa6e9 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,27 @@ Since it's a hidden gem and still super useful I decided to fork it here & updat ![image](https://github.com/dazKind/castle/assets/5015415/fb52ec84-f020-4a64-bd00-5d6e78d5ecfb) +## Compile from sources: + +### 1. Install Prerequisites +- Install [Haxe](https://haxe.org) using approriate installer from https://haxe.org/download/ +- Install [NodeJS](https://nodejs.org) and [pnpm](https://pnpm.io/). Normal npm should work too, but is untested. + +### 2. Build castle.js +- Clone this repository and enter it with your terminal +- Install haxelibs using the command `haxelib install build.hxml` +- Install js libraries using the command `pnpm install` +- At the root of the repository folder run +``` +haxe build.hxml +``` +This will create `castle.js` and `index.js` files in the `bin` folder + +#### 3. Package or Run +The Electron app itself lives in the `bin` folder. We can run it with this command: +``` +npx electron bin +``` --- diff --git a/bin/Release.hx b/bin/Release.hx deleted file mode 100644 index b31e3db1..00000000 --- a/bin/Release.hx +++ /dev/null @@ -1,85 +0,0 @@ -class Release { - - public static function main() { - var files = [ - "package.json", - "icon.png", - "index.html", - "castle.js", - "style.css", - "dock", - "libs", - ]; - - var zfiles = []; - - function add(f:String) { - if( sys.FileSystem.isDirectory(f) ) { - for( file in sys.FileSystem.readDirectory(f) ) - add(f+"/"+file); - return; - } - var data = sys.io.File.getBytes(f); - zfiles.push({ - fileTime : Date.now(), - fileSize : data.length, - fileName : f, - dataSize : data.length, - data : data, - compressed : false, - crc32 : null, - extraFields : null, - }); - } - for( f in files ) - add(f); - var o = new haxe.io.BytesOutput(); - new haxe.zip.Writer(o).write(Lambda.list(zfiles)); - var bytes = o.getBytes(); - sys.io.File.saveBytes("package.nw", bytes); - - /* - var platforms = [ - "win", - "osx", // When unzipping with OSX, the rights will be correctly set on the .app - "linux", // TODO : linux uses TGZ for rights, we lack format.tgz.Writer atm - ]; - for( pf in platforms ) { - var zip = 'node-webkit-$pf.zip'; - if( !sys.FileSystem.exists(zip) ) { - Sys.println('$zip not found'); - continue; - } - var z = new haxe.zip.Reader(sys.io.File.read(zip)).read(); - for( e in z ) { - switch( e.fileName ) { - case "nw": - e.fileName = "cdb"; - case "nw.exe": - e.fileName = "cdb.exe"; - case "nwsnapshot", "nwsnapshot.exe": - z.remove(e); - default: - if( e.fileName.substr(0, 15) == "node-webkit.app" ) - e.fileName = "castleDB.app" + e.fileName.substr(15); - } - } - z.add({ - fileTime : Date.now(), - fileSize : bytes.length, - fileName : "package.nw", - dataSize : bytes.length, - data : bytes, - compressed : false, - crc32 : null, - extraFields : null, - }); - var out = 'castledb-$pf.zip'; - var o = sys.io.File.write(out); - new haxe.zip.Writer(o).write(z); - o.close(); - Sys.println('$out written'); - }*/ - } - -} \ No newline at end of file diff --git a/bin/cdb.cmd b/bin/cdb.cmd deleted file mode 100644 index 726d988a..00000000 --- a/bin/cdb.cmd +++ /dev/null @@ -1,16 +0,0 @@ -@echo off - -if exist "%~dp0nwjs\nw.exe" ( - if exist "%~dp0castle.js" ( - start /D %~dp0 nwjs\nw.exe --nwapp package.json %* - ) else ( - echo. - echo Missing "castle.js". - pause - ) -) else ( - echo. - echo This requires "nw.exe" in ./nwjs/ folder. - echo Get it on: https://nwjs.io/ - pause -) \ No newline at end of file diff --git a/bin/index.html b/bin/index.html index 91ad531e..e267efa5 100644 --- a/bin/index.html +++ b/bin/index.html @@ -1,8 +1,8 @@ - - + + @@ -16,9 +16,6 @@
- - -