100 lines
2.2 KiB
JavaScript
100 lines
2.2 KiB
JavaScript
const { argv } = require("process");
|
|
const path = require( "path" );
|
|
const fs = require( "node:fs/promises" );
|
|
const { exists } = require( "./library.js" );
|
|
|
|
if ( argv.length !== 3 )
|
|
{
|
|
let platforms = [ "windows" ];
|
|
|
|
console.error( "Platform missing in the command. Add one of these to the command line:", platforms.join( ", " ) );
|
|
|
|
return;
|
|
}
|
|
|
|
let targetDirectory = "outputs";
|
|
let godotName = "godot-4.3-dev-rokojori";
|
|
let platform = argv[ 2 ];
|
|
let godotPlatformName = godotName + "-" + argv[ 2 ];
|
|
|
|
let platformTargetDirectory = path.join( targetDirectory, godotPlatformName );
|
|
|
|
async function main()
|
|
{
|
|
console.log( "Creating output" );
|
|
|
|
await deleteOldDirectory();
|
|
await createDirectory();
|
|
|
|
|
|
console.log( "Output done" );
|
|
}
|
|
|
|
|
|
async function deleteOldDirectory()
|
|
{
|
|
|
|
let directoryExists = await exists( platformTargetDirectory );
|
|
|
|
console.log( "checking if old directory exists", directoryExists );
|
|
|
|
if ( directoryExists )
|
|
{
|
|
console.log( `deleting previous directory: "${platformTargetDirectory}"` );
|
|
await fs.rm( platformTargetDirectory, { recursive: true } );
|
|
}
|
|
|
|
return Promise.resolve();
|
|
}
|
|
|
|
async function createDirectory()
|
|
{
|
|
console.log( `creating directory: "${platformTargetDirectory}"` );
|
|
await fs.mkdir( platformTargetDirectory, { recursive: true } );
|
|
|
|
|
|
|
|
let godotFrom = "godot/bin";
|
|
let godotTo = path.join( platformTargetDirectory, "godot" );
|
|
|
|
console.log( `copying godot: "${godotFrom}" >> "${godotTo}"` );
|
|
|
|
await fs.cp( godotFrom, godotTo, { recursive : true } );
|
|
|
|
|
|
|
|
let npFrom = "godot-rj-nuget-package";
|
|
let npTo = path.join( platformTargetDirectory, npFrom );
|
|
|
|
console.log( `copying nupkg: "${npFrom}" >> "${npTo}"` );
|
|
|
|
await fs.cp( npFrom, npTo, { recursive : true } );
|
|
|
|
|
|
let installerFiles =
|
|
{
|
|
"windows" :
|
|
[
|
|
"install-godot-windows.bat",
|
|
"install-godot-windows-readme.txt"
|
|
]
|
|
};
|
|
|
|
let installers = installerFiles[ platform ];
|
|
|
|
for ( let installer of installers )
|
|
{
|
|
let installFrom = "install-scripts/" + installer;
|
|
|
|
let installTo = path.join( platformTargetDirectory, installer );
|
|
|
|
console.log( `copying installer: "${installFrom}" >> "${installTo}"` );
|
|
|
|
await fs.cp( installFrom, installTo, { recursive : true } );
|
|
}
|
|
|
|
}
|
|
|
|
|
|
main();
|