Migrate to Twine 2 format
The goal of this MR is to migrate output to Twine 2 format, that handles JS files in a different way. Instead of putting them in <div> tags, single div per file, in the twine 2 mode tweego joins all the .js files and put the result in a global <script> tag.
Please let me know your opinions on the changes to the sugarcube files.
Tweego outputs in twine2 mode when story format file is named format.js, so please find below is a brief guide on producing the patched version of the SuragCube's format.js file:
Preparations:
- Install node.js (https://nodejs.org/en/download/)
- Install Mercurial (https://www.mercurial-scm.org/)
- Clone Sugarube repo:
hg clone https://bitbucket.org/tmedwards/sugarcube -
cdinto the directory of the suragcube clone (i.e.cd sugarcubeif you ranhgfrom a terminal). - Set active branch to "v2-release":
hg checkout v2-release - Run
npm installin the repo dir. On Windows it will probably benode npm install. Requited dependences change during the project lifetime and vary from branch to branch; you may need to runnpm installagain after some time, or after branch/tag change. Try to run it in case of strange build errors.
The next is done in the directory where SC repo was cloned. Loop over required SugarCube versions:
-
hg update --cleanto clean any local changes -
hg checkout v2.28.2(any tag or head here, of course) hg patch --no-commit ~/games/fc-pregmod/devNotes/sugarcube\ stuff/sugarcube-fc-changes.patch-
node build.js -b 2to build release version cp dist/twine2/sugarcube-2/format.js <whenever you want>-
node build.js -b 2 -u -dto build debug version cp dist/twine2/sugarcube-2/format.js <whenever you want to place the debug header>
At version 2.24.0 the patch did not apply completely, because in 2.25.0 they added some comments. I applied the rejected part manually and made a new patch file to use it with versions 2.24 and older: hg diff src/ > <file to place patch in>.