Skip to content

Compiling PCjs Source Code

Jeff Parsons edited this page Jul 9, 2023 · 3 revisions

Unlike a typical project, where you have to build or configure or make 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's Closure Compiler, and the easiest way to do that is with Gulp and the Gulp tasks defined by gulpfile.js.

Assuming you already Node and NPM installed, run:

npm install

to get all the development dependencies, including Gulp 4.x.

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 with sudo:

npm install gulp-cli -g

Now you can run gulp anywhere within the pcjs.org repository to build updated emulator releases. If no command-line arguments are specified, gulp invokes the gulpfile.js "default" task, which runs the Closure Compiler to rebuild any of the target files (eg, pcx86.js in the releases directory) that are out-of date.

Since I use Visual Studio Code, I've also included my VSCode tasks.json, so if you allow VSCode to automatically start the gulp watch task, then the Closure Compiler will be automatically launched whenever any of the JavaScript files belonging to a particular machine have been changed.

Clone this wiki locally