Skip to content

Commit

Permalink
fix scripts_directory and add debug .sh scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
waymondrang committed Jul 21, 2022
1 parent 5379c49 commit c63e2f2
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 4 deletions.
11 changes: 7 additions & 4 deletions build.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ log("\x1b[32m" + process.cwd() + "\x1b[0m");
const start_time = new Date();
const fs = require('fs-extra');
const { execSync } = require("child_process");
const path = require('path');
var config;

process.on("exit", function (code) {
Expand Down Expand Up @@ -75,7 +76,7 @@ const browser_platforms = ["firefox"];
const manifest_ignore = ["manifest_version"];

// variable isn't used anymore but keeping for future reference
const scripts_directory = "";
const scripts_directory = __dirname;

var targets = config.targets;

Expand Down Expand Up @@ -206,7 +207,7 @@ if (will_copy) {
log("copied files between " + config.source.platform + " and " + targets.map(e => e.platform).join(", ") + " directories");
if (will_git) {
log("pushing synced directories to github");
execSync(`${scripts_directory}git.sh \"${config.git_messages.directory_sync}\"`);
execSync(`${path.join(scripts_directory, "git.sh")} \"${config.git_messages.directory_sync}\"`, { shell: true, windowsHide: true });
}
log("copying finished");
}
Expand All @@ -231,7 +232,9 @@ if (will_package) {
var packages = targets;
packages.push(config.source);
for (var package of packages) {
execSync(`${scripts_directory}package.sh \"v${source_manifest.version}\" \"${config.project_name_short}\" \"${package.platform}\" \"${package.directory}\" \"${config.release_directory}\" \"${package.temp ? "--temp" : ""}`);
var command = `${path.join(scripts_directory, config.debug ? "package.d.sh" : "package.sh")} \"v${source_manifest.version}\" \"${config.project_name_short}\" \"${package.platform}\" \"${package.directory}\" \"${config.release_directory}\" \"${package.temp ? "--temp" : ""}`;
log_d("executing " + command);
execSync(command, { shell: true, windowsHide: true });
log(`packaged ${source_manifest.version} for ` + package.platform);
if (package.temp) {
log("removing temporary target directory " + package.directory);
Expand All @@ -241,6 +244,6 @@ if (will_package) {
}
if (will_git) {
log("pushing completed packages to github");
execSync(`${scripts_directory}git.sh \"${config.git_messages.packages}\"`);
execSync(`${path.join(scripts_directory, "git.sh")} \"${config.git_messages.packages}\"`, { shell: true, windowsHide: true });
}
}
22 changes: 22 additions & 0 deletions package.d.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

# extbuild
# https://github.com/waymondrang/extbuild

if [ $# -eq 0 ]; then
echo "missing arguments"
read -n 1
exit 1
fi

echo "creating ${3} release"

cd ${4}

zip -r "${2}_${1}_${3}.zip" ./*

cd -

mv "${4}/${2}_${1}_${3}.zip" ${5}

read -p "Press any key to continue... " -n1 -s

0 comments on commit c63e2f2

Please sign in to comment.