- Notifications
You must be signed in to change notification settings - Fork168
Compiling PCjs Source Code
If you're using a modern web browser, the PCjs source code can be loaded and run by your browser as-is. However, for compatibility with older browsers, the JavaScript is also "compiled" to an older form (specifically, ES5, aka ECMAScript 2009).
Unlike a typical project, where you have tobuild orconfigure ormake something, PCjs is "ready to run".That's because both the compiled and uncompiled versions of the PCjs emulation modules are checked into the project, making deployment to a web server easier.
However, in order to build and test PCjs modifications locally, you'll want to use Google'sClosure Compiler, and the easiest way to do that is withGulp and the Gulp tasks defined bygulpfile.js.
Assuming you alreadyNode and NPM installed, run:
npm installto get all the development dependencies, including Gulp 4.x.
NOTE: The Closure Compiler also requires Java. If you don't already have Java installed (checkjava --version),OpenJDK is a good option.
You'll probably also want to install the command-line interface to Gulp. You can install that locally as well, but it's recommended you install it globally with-g; OS X users may also need to preface this command withsudo:
npm install gulp-cli -gNow you can rungulp anywhere within the pcjs.org repository to build updated emulator releases. If no command-line arguments are specified,gulp invokes thegulpfile.js "default" task, which runs the Closure Compiler to rebuild any of the target files (eg, pcx86.js in thereleases directory) that are out-of date.
Since I use Visual Studio Code, I've also included my VSCodetasks.json, so if you allow VSCode to automatically start thegulp watch task, then the Closure Compiler will be automatically launched whenever any of the JavaScript files belonging to a particular machine have been changed.