mirror of
https://github.com/Eggbertx/gochan.git
synced 2025-08-02 06:46:24 -07:00
Clean up build.py some more, bump version to 3.10
This commit is contained in:
parent
852dc8dc09
commit
cc5f1ec07f
7 changed files with 30 additions and 45 deletions
57
build.py
57
build.py
|
@ -38,7 +38,7 @@ release_files = (
|
|||
"README.md",
|
||||
)
|
||||
|
||||
GOCHAN_VERSION = "3.9.0"
|
||||
GOCHAN_VERSION = "3.10.0"
|
||||
DATABASE_VERSION = "3" # stored in DBNAME.DBPREFIXdatabase_version
|
||||
|
||||
PATH_NOTHING = -1
|
||||
|
@ -262,19 +262,20 @@ def clean():
|
|||
|
||||
def dependencies():
|
||||
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):
|
||||
cmd = "docker-compose -f {} up --build"
|
||||
db_option = ""
|
||||
if option == "guestdb":
|
||||
cmd = cmd.format("docker/docker-compose-mariadb.yaml")
|
||||
db_option = "docker/docker-compose-mariadb.yaml"
|
||||
elif option == "hostdb":
|
||||
cmd = cmd.format("docker/docker-compose.yml.default")
|
||||
db_option = "docker/docker-compose.yml.default"
|
||||
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:
|
||||
cmd += " --detach"
|
||||
cmd += ["--detach"]
|
||||
status = run_cmd(cmd, print_output=True, realtime=True, print_command=True)[1]
|
||||
if status != 0:
|
||||
print("Failed starting a docker container, exited with status code", status)
|
||||
|
@ -391,12 +392,7 @@ def js(watch=False):
|
|||
mkdir("html/js/")
|
||||
delete("html/js/gochan.js")
|
||||
delete("html/js/gochan.js.map")
|
||||
npm_cmd = "npm --prefix frontend/ run"
|
||||
if watch:
|
||||
npm_cmd += " watch-ts"
|
||||
else:
|
||||
npm_cmd += " build-ts"
|
||||
|
||||
npm_cmd = ["npm", "--prefix", "frontend/", "run", "watch-ts" if watch else "build-ts"]
|
||||
status = run_cmd(npm_cmd, True, True, True)[1]
|
||||
if status != 0:
|
||||
print("JS transpiling failed with status", status)
|
||||
|
@ -405,9 +401,9 @@ def js(watch=False):
|
|||
|
||||
def eslint(fix=False):
|
||||
print("Running eslint")
|
||||
npm_cmd = "npm --prefix frontend/ run eslint"
|
||||
npm_cmd = ["npm", "--prefix", "frontend/", "run", "eslint"]
|
||||
if fix:
|
||||
npm_cmd += " --fix"
|
||||
npm_cmd += ["--fix"]
|
||||
|
||||
status = run_cmd(npm_cmd, True, True, True)[1]
|
||||
if status != 0:
|
||||
|
@ -441,12 +437,7 @@ def release(goos):
|
|||
|
||||
|
||||
def sass(watch=False):
|
||||
npm_cmd = "npm --prefix frontend/ run"
|
||||
if watch:
|
||||
npm_cmd += " watch-sass"
|
||||
else:
|
||||
npm_cmd += " build-sass"
|
||||
|
||||
npm_cmd = ["npm", "--prefix", "frontend/", "run", "watch-sass" if watch else "build-sass"]
|
||||
status = run_cmd(npm_cmd, True, True, True)[1]
|
||||
if status != 0:
|
||||
print("Failed running sass with status", status)
|
||||
|
@ -455,12 +446,12 @@ def sass(watch=False):
|
|||
def test(verbose = False, coverage = False):
|
||||
pkgs = os.listdir("pkg")
|
||||
for pkg in pkgs:
|
||||
cmd = "go test "
|
||||
cmd = ["go", "test"]
|
||||
if verbose:
|
||||
cmd += "-v "
|
||||
cmd += ["-v"]
|
||||
if coverage:
|
||||
cmd += "-cover "
|
||||
cmd += path.join("./pkg", pkg)
|
||||
cmd += ["-cover"]
|
||||
cmd += [path.join("./pkg", pkg)]
|
||||
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")
|
||||
parser.add_argument("--symlinks",
|
||||
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()
|
||||
install(args.prefix, args.documentroot, args.symlinks, args.js, args.css, args.templates)
|
||||
elif action == "js":
|
||||
parser.add_argument("--watch", "-w",
|
||||
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(
|
||||
"--eslint",
|
||||
action="store_true",
|
||||
help="Run eslint on the JavaScript code to check for possible problems")
|
||||
parser.add_argument("--eslint-fix",
|
||||
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()
|
||||
if args.eslint or args.eslint_fix:
|
||||
eslint(args.eslint_fix)
|
||||
|
@ -579,16 +567,13 @@ if __name__ == "__main__":
|
|||
except Exception:
|
||||
traceback.print_exc()
|
||||
close_tests()
|
||||
|
||||
elif action == "test":
|
||||
parser.add_argument("--verbose","-v",
|
||||
action="store_true",
|
||||
help="Print log messages in the tests"
|
||||
)
|
||||
help="Print log messages in the tests")
|
||||
parser.add_argument("--coverage",
|
||||
action="store_true",
|
||||
help="Print unit test coverage"
|
||||
)
|
||||
help="Print unit test coverage")
|
||||
args = parser.parse_args()
|
||||
test(args.verbose, args.coverage)
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "gochan.js",
|
||||
"version": "3.9.0",
|
||||
"version": "3.10.0",
|
||||
"description": "",
|
||||
"main": "./ts/main.ts",
|
||||
"private": true,
|
||||
|
|
|
@ -7,6 +7,6 @@
|
|||
<h1>404: File not found</h1>
|
||||
<img src="/error/lol 404.gif" border="0" alt="">
|
||||
<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>
|
||||
</html>
|
|
@ -7,6 +7,6 @@
|
|||
<h1>Error 500: Internal Server error</h1>
|
||||
<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>
|
||||
<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>
|
||||
</html>
|
|
@ -7,6 +7,6 @@
|
|||
<h1>Error 502: Bad gateway</h1>
|
||||
<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>
|
||||
<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>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue