Skip to content
Snippets Groups Projects
Commit 925441ca authored by ezsh's avatar ezsh
Browse files

Collect JS files from the 'js' dir for the Tweego module

This allows us to escape the SugarCube eval() environment and write
normal JavaScript without assigning to the window object.
parent 1bc6139e
No related branches found
No related tags found
1 merge request!5896Collect JS files from the 'js' dir for the Tweego module
......@@ -33,8 +33,12 @@ bin/%.html: bin/tmp
git checkout -- src/gui/mainMenu/AlphaDisclaimer.tw
mv $< $@
bin/tmp: bin/ src/gui/mainMenu/AlphaDisclaimer.tw
$(TWEEGO) src/ --head devTools/head.html > $@
bin/fc.js: bin/
devTools/concatFiles.sh js/ '*.js' $@
bin/tmp: bin/fc.js src/gui/mainMenu/AlphaDisclaimer.tw
$(TWEEGO) --module=bin/fc.js --head devTools/head.html src/ > $@
rm -f bin/fc.js
src/gui/mainMenu/AlphaDisclaimer.tw:
sed -Ei "s/build .releaseID/\0 commit $(COMMIT)/" $@
......
......@@ -4,12 +4,14 @@
:: Set working directory
pushd %~dp0
if not exist "bin\resources" mkdir bin\resources
CALL devTools/concatFiles.bat js/ "*.js" bin/fc.js
:: Run the appropriate compiler for the user's CPU architecture.
if %PROCESSOR_ARCHITECTURE% == AMD64 (
CALL "%~dp0devTools\tweeGo\tweego_win64.exe" -o "%~dp0bin/FC_pregmod.html" --head devTools/head.html "%~dp0src"
CALL "%~dp0devTools\tweeGo\tweego_win64.exe" -o "%~dp0bin/FC_pregmod.html" --module=bin/fc.js --head devTools/head.html "%~dp0src"
) else (
CALL "%~dp0devTools\tweeGo\tweego_win86.exe" -o "%~dp0bin/FC_pregmod.html" --head devTools/head.html "%~dp0src"
CALL "%~dp0devTools\tweeGo\tweego_win86.exe" -o "%~dp0bin/FC_pregmod.html" --module=bin/fc.js --head devTools/head.html "%~dp0src"
)
DEL bin\fc.js
popd
ECHO Done
......@@ -76,7 +76,9 @@ function compile {
file="bin/FC_pregmod.html"
fi
$TWEEGO_EXE -o $file src/ --head devTools/head.html || build_failed="true"
devTools/concatFiles.sh js/ '*.js' bin/fc.js
$TWEEGO_EXE -o $file --module=bin/fc.js --head devTools/head.html src/ || build_failed="true"
rm -f bin/fc.js
if [ "$build_failed" = "true" ]
then
echoError "Build failed."
......
@echo off
:: See if we can find a git installation
setlocal enabledelayedexpansion
for %%k in (HKCU HKLM) do (
for %%w in (\ \Wow6432Node\) do (
for /f "skip=2 delims=: tokens=1*" %%a in ('reg query "%%k\SOFTWARE%%wMicrosoft\Windows\CurrentVersion\Uninstall\Git_is1" /v InstallLocation 2^> nul') do (
for /f "tokens=3" %%z in ("%%a") do (
set GIT=%%z:%%b
set GITFOUND=yes
goto FOUND
)
)
)
)
:FOUND
if %GITFOUND% == yes (
set "PATH=%GIT%bin;%PATH%"
bash devTools/concatFiles.sh "%1" "%2" "%3"
)
#!/bin/sh
# $1: source dir
# $2: name wildcard
# #3: destination file
rm -f "$3"
files=$(find "$1" -name "$2" -print)
files=$(echo "$files" | sort)
for f in $files; do
echo -e "\n/* ${f#$1} */\n" >> "$3"
cat "$f" >> "$3"
done
/* eslint-disable no-var */
/*
* SugarCube executes scripts via eval() inside a closure. Thus to make App global,
* we declare it as a property of the window object. I don't know why 'App = {}'
* does not work.
*/
// @ts-ignore
window.App = { };
// the same declaration for code parsers that don't like the line above
var App = window.App || {}; /* eslint-disable-line no-var*/
"use strict";
var App = { };
App.Art = {};
App.Data = {};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment