1
0
Fork 0
mirror of https://github.com/Eggbertx/gochan.git synced 2025-08-02 19:16:23 -07:00

Clean up build.py some more, bump version to 3.10

This commit is contained in:
Eggbertx 2024-03-05 21:37:45 -08:00
parent 852dc8dc09
commit cc5f1ec07f
7 changed files with 30 additions and 45 deletions

View file

@ -38,7 +38,7 @@ release_files = (
"README.md", "README.md",
) )
GOCHAN_VERSION = "3.9.0" GOCHAN_VERSION = "3.10.0"
DATABASE_VERSION = "3" # stored in DBNAME.DBPREFIXdatabase_version DATABASE_VERSION = "3" # stored in DBNAME.DBPREFIXdatabase_version
PATH_NOTHING = -1 PATH_NOTHING = -1
@ -262,19 +262,20 @@ def clean():
def dependencies(): def dependencies():
print("Installing dependencies for gochan") print("Installing dependencies for gochan")
run_cmd("go get", realtime=True, print_command=True) run_cmd(("go", "get"), realtime=True, print_command=True)
def docker(option="guestdb", attached=False): def docker(option="guestdb", attached=False):
cmd = "docker-compose -f {} up --build" db_option = ""
if option == "guestdb": if option == "guestdb":
cmd = cmd.format("docker/docker-compose-mariadb.yaml") db_option = "docker/docker-compose-mariadb.yaml"
elif option == "hostdb": elif option == "hostdb":
cmd = cmd.format("docker/docker-compose.yml.default") db_option = "docker/docker-compose.yml.default"
elif option == "macos": elif option == "macos":
cmd = cmd.format("docker/docker-compose-syncForMac.yaml") db_option = "docker/docker-compose-syncForMac.yaml"
cmd = ["docker-compose", "-f", db_option, "up", "--build"]
if attached is False: if attached is False:
cmd += " --detach" cmd += ["--detach"]
status = run_cmd(cmd, print_output=True, realtime=True, print_command=True)[1] status = run_cmd(cmd, print_output=True, realtime=True, print_command=True)[1]
if status != 0: if status != 0:
print("Failed starting a docker container, exited with status code", status) print("Failed starting a docker container, exited with status code", status)
@ -391,12 +392,7 @@ def js(watch=False):
mkdir("html/js/") mkdir("html/js/")
delete("html/js/gochan.js") delete("html/js/gochan.js")
delete("html/js/gochan.js.map") delete("html/js/gochan.js.map")
npm_cmd = "npm --prefix frontend/ run" npm_cmd = ["npm", "--prefix", "frontend/", "run", "watch-ts" if watch else "build-ts"]
if watch:
npm_cmd += " watch-ts"
else:
npm_cmd += " build-ts"
status = run_cmd(npm_cmd, True, True, True)[1] status = run_cmd(npm_cmd, True, True, True)[1]
if status != 0: if status != 0:
print("JS transpiling failed with status", status) print("JS transpiling failed with status", status)
@ -405,9 +401,9 @@ def js(watch=False):
def eslint(fix=False): def eslint(fix=False):
print("Running eslint") print("Running eslint")
npm_cmd = "npm --prefix frontend/ run eslint" npm_cmd = ["npm", "--prefix", "frontend/", "run", "eslint"]
if fix: if fix:
npm_cmd += " --fix" npm_cmd += ["--fix"]
status = run_cmd(npm_cmd, True, True, True)[1] status = run_cmd(npm_cmd, True, True, True)[1]
if status != 0: if status != 0:
@ -441,12 +437,7 @@ def release(goos):
def sass(watch=False): def sass(watch=False):
npm_cmd = "npm --prefix frontend/ run" npm_cmd = ["npm", "--prefix", "frontend/", "run", "watch-sass" if watch else "build-sass"]
if watch:
npm_cmd += " watch-sass"
else:
npm_cmd += " build-sass"
status = run_cmd(npm_cmd, True, True, True)[1] status = run_cmd(npm_cmd, True, True, True)[1]
if status != 0: if status != 0:
print("Failed running sass with status", status) print("Failed running sass with status", status)
@ -455,12 +446,12 @@ def sass(watch=False):
def test(verbose = False, coverage = False): def test(verbose = False, coverage = False):
pkgs = os.listdir("pkg") pkgs = os.listdir("pkg")
for pkg in pkgs: for pkg in pkgs:
cmd = "go test " cmd = ["go", "test"]
if verbose: if verbose:
cmd += "-v " cmd += ["-v"]
if coverage: if coverage:
cmd += "-cover " cmd += ["-cover"]
cmd += path.join("./pkg", pkg) cmd += [path.join("./pkg", pkg)]
run_cmd(cmd, realtime=True, print_command=True) run_cmd(cmd, realtime=True, print_command=True)
@ -528,23 +519,20 @@ if __name__ == "__main__":
help="install files in ./html/ to this directory to be requested by a browser") help="install files in ./html/ to this directory to be requested by a browser")
parser.add_argument("--symlinks", parser.add_argument("--symlinks",
action="store_true", action="store_true",
help="create symbolic links instead of copying the files (may require admin/root privileges)" help="create symbolic links instead of copying the files (may require admin/root privileges)")
)
args = parser.parse_args() args = parser.parse_args()
install(args.prefix, args.documentroot, args.symlinks, args.js, args.css, args.templates) install(args.prefix, args.documentroot, args.symlinks, args.js, args.css, args.templates)
elif action == "js": elif action == "js":
parser.add_argument("--watch", "-w", parser.add_argument("--watch", "-w",
action="store_true", action="store_true",
help="automatically rebuild when you change a file (keeps running)" help="automatically rebuild when you change a file (keeps running)")
)
parser.add_argument( parser.add_argument(
"--eslint", "--eslint",
action="store_true", action="store_true",
help="Run eslint on the JavaScript code to check for possible problems") help="Run eslint on the JavaScript code to check for possible problems")
parser.add_argument("--eslint-fix", parser.add_argument("--eslint-fix",
action="store_true", action="store_true",
help="Run eslint on the JS code to try to fix detected problems" help="Run eslint on the JS code to try to fix detected problems")
)
args = parser.parse_args() args = parser.parse_args()
if args.eslint or args.eslint_fix: if args.eslint or args.eslint_fix:
eslint(args.eslint_fix) eslint(args.eslint_fix)
@ -579,16 +567,13 @@ if __name__ == "__main__":
except Exception: except Exception:
traceback.print_exc() traceback.print_exc()
close_tests() close_tests()
elif action == "test": elif action == "test":
parser.add_argument("--verbose","-v", parser.add_argument("--verbose","-v",
action="store_true", action="store_true",
help="Print log messages in the tests" help="Print log messages in the tests")
)
parser.add_argument("--coverage", parser.add_argument("--coverage",
action="store_true", action="store_true",
help="Print unit test coverage" help="Print unit test coverage")
)
args = parser.parse_args() args = parser.parse_args()
test(args.verbose, args.coverage) test(args.verbose, args.coverage)

View file

@ -1,6 +1,6 @@
{ {
"name": "gochan.js", "name": "gochan.js",
"version": "3.9.0", "version": "3.10.0",
"description": "", "description": "",
"main": "./ts/main.ts", "main": "./ts/main.ts",
"private": true, "private": true,

View file

@ -7,6 +7,6 @@
<h1>404: File not found</h1> <h1>404: File not found</h1>
<img src="/error/lol 404.gif" border="0" alt=""> <img src="/error/lol 404.gif" border="0" alt="">
<p>The requested file could not be found on this server.</p> <p>The requested file could not be found on this server.</p>
<hr/>Site powered by <a href="https://github.com/gochan-org/gochan" target="_blank">Gochan</a> v3.9.0 <hr/>Site powered by <a href="https://github.com/gochan-org/gochan" target="_blank">Gochan</a> v3.10.0
</body> </body>
</html> </html>

View file

@ -7,6 +7,6 @@
<h1>Error 500: Internal Server error</h1> <h1>Error 500: Internal Server error</h1>
<img src="/error/server500.gif" border="0" alt=""> <img src="/error/server500.gif" border="0" alt="">
<p>The server encountered an error while trying to serve the page, and we apologize for the inconvenience. The <a href="https://en.wikipedia.org/wiki/Idiot">system administrator</a> will try to fix things as soon they get around to it, whenever that is. Hopefully soon.</p> <p>The server encountered an error while trying to serve the page, and we apologize for the inconvenience. The <a href="https://en.wikipedia.org/wiki/Idiot">system administrator</a> will try to fix things as soon they get around to it, whenever that is. Hopefully soon.</p>
<hr/>Site powered by <a href="https://github.com/gochan-org/gochan" target="_blank">Gochan</a> v3.9.0 <hr/>Site powered by <a href="https://github.com/gochan-org/gochan" target="_blank">Gochan</a> v3.10.0
</body> </body>
</html> </html>

View file

@ -7,6 +7,6 @@
<h1>Error 502: Bad gateway</h1> <h1>Error 502: Bad gateway</h1>
<img src="/error/server500.gif" border="0" alt=""> <img src="/error/server500.gif" border="0" alt="">
<p>The server encountered an error while trying to serve the page, and we apologize for the inconvenience. The <a href="https://en.wikipedia.org/wiki/Idiot">system administrator</a> will try to fix things as soon they get around to it, whenever that is. Hopefully soon.</p> <p>The server encountered an error while trying to serve the page, and we apologize for the inconvenience. The <a href="https://en.wikipedia.org/wiki/Idiot">system administrator</a> will try to fix things as soon they get around to it, whenever that is. Hopefully soon.</p>
<hr/>Site powered by <a href="https://github.com/gochan-org/gochan" target="_blank">Gochan</a> v3.9.0 <hr/>Site powered by <a href="https://github.com/gochan-org/gochan" target="_blank">Gochan</a> v3.10.0
</body> </body>
</html> </html>