candybox2.github.io icon indicating copy to clipboard operation
candybox2.github.io copied to clipboard

How do/did you even compile this?

Open Raijinili opened this issue 5 years ago • 8 comments

I've spent the last hour or two trying to compile it on Windows, so that I can play around with some features.

Here's what I learned:

  • Requires TypeScript installed globally and on the PATH.
  • Requires yuicompressor on the path. NPM global install with NPM's scripts on the PATH works.
  • Requires 7zip's bin folder on the PATH.
  • There's a bug (at least for Windows 10) in the syntax of the batch file.
  • Expects Python 2.
  • TypeScript 2 is too new: Enforces TS17009.
  • TypeScript 1.4. is too old: Does not return 0 if there are no arguments (which the script uses to detect Typescript).
  • The batch script doesn't stop if something goes wrong.
  • The code doesn't properly import all names used. For example, "main.ts" doesn't import MainLoadingType.

At the last step, I give up. I can't easily fix all of the import errors.

Raijinili avatar Aug 31 '19 05:08 Raijinili

I managed to compile it under TypeScript 1.4.1 by removing the check for TypeScript. Huh? What version was used in the first place?

Raijinili avatar Aug 31 '19 05:08 Raijinili

You need't to compile it.You can play it by opening index.html.

F-Unction avatar Sep 12 '19 06:09 F-Unction

I plan to make some changes, so I need to compile it.

Raijinili avatar Sep 12 '19 17:09 Raijinili

You don't need to compile this, it's JavaScript. You can alter the code from the console and make changes in the browser. However, if you want to change the elements that are called and host it on a local machine; unzip the "source files" and then just make changes to any of the files you want with a text editor. Then, save it all and then zip all the files again. I'm just a old n00b. If I used the wrong terms... nobody's probably read this comment anyway.

justgotdarker avatar Sep 19 '19 05:09 justgotdarker

This repo is in TypeScript, not JavaScript. TypeScript is compiled to JS. The repo has to be compiled from TS to JS for it to run in the browser. The files candybox2_uncompressed.js and candybox2.js are the results of that compilation.

I already compiled it, but I had to use an old version of TypeScript and change how the compile scripts checked for TypeScript. As far as I can tell, the repo as-is shouldn't have been able to compile, yet it has been compiled.

Raijinili avatar Sep 20 '19 04:09 Raijinili

Hi @Raijinili I was compiling it fine with docker and [email protected]. Try this:

docker run -ti alpine:3.10
apk add --no-cache python npm p7zip bash py-yuicompressor

npm install -g [email protected]
npm install -g yuicompressor

wget https://github.com/candybox2/candybox2.github.io/archive/master.tar.gz -O - | tar xzf -
cd candybox2.github.io-master
./compile.sh

Or ubuntu version:

docker run -ti ubuntu:18.04
apt-get update
apt-get -y install wget p7zip-full python yui-compressor nodejs npm

npm install -g [email protected]
npm install -g yuicompressor

wget https://github.com/candybox2/candybox2.github.io/archive/master.tar.gz -O - | tar xzf -
cd candybox2.github.io-master
./compile.sh

Cheers!

kvaps avatar Sep 20 '19 07:09 kvaps

gotta bless docker sometimes.

Kreijstal avatar May 10 '21 04:05 Kreijstal

I compiled it but it got errors when I ran it. It seemed it didn't require module before using it. Such as MainLoadingType

CyanChanges avatar Jan 19 '23 00:01 CyanChanges