Skip to content

Getting Started

Adam Bosco edited this page Dec 8, 2016 · 7 revisions

Before you can run hackshell, you'll need to take care of four simple steps. Once hackshell becomes more stable, I'll offer pre-built bundles which will eliminate a couple steps.

1 Install Node.js v6.9 and NPM 2 Obtain the hackshell source code 3 Install hackshell's development dependencies 4 Build the hackshell bundles

1. Node & NPM

If you're unfamiliar with these products, Node.js provides a standalone JavaScript environment (leveraging the V8 JavaScript engine used in the Google Chrome web-browser), enabling systems to execute JavaScript code. In the last several years, Node has become something of a sensation and today powers many popular servers, websites, and development tools, among other things. NPM is a package manager (similar to apt-get in Ubuntu) for JavaScript. Typically packaged with Node, NPM enables developers to easily access a massive collection of JavaScript applications and modules, and create and distribute projects which depend on them without distributing all of the dependencies or requiring users to perform complicated configuration procedures.

I highly recommend installing Node and NPM by using a "Node version manager" - doing so allows you to run JavaScript software intended to be used with any version of of Node, and allows you to write your own code for the version of your choice. If you're using Windows, take a look at nvm-windows or nodist (my personal preference). For linux and Mac systems using the bash shell, nvm tends to be the go-to option.

After installing a Node version manager, install Node 6.9:

  • Using nodist, open up a CMD or Powershell console and run nodist + 6.9
  • Using NVM, open up a bash console and run nvm install 6.9

2. Obtaining hackshell

In the future, hackshell will be listed in NPM, enabling you to simply execute something like

npm install hackshell

But for now, you'll either need to download the hackshell archive by clicking the green "Clone or download" button on the GitHub page and then extract it somewhere, or use git to clone it:

git clone https://github.com/KuroTsuto/hackshell.git

3. Development Dependencies

Open a console and navigate to wherever you put hackshell's project files, then execute

npm install --dev

This will grab all of the resources that are used to build hackshell and drop them into a node_modules directory in the project root.

4. Building Bundles

With a console in the hackshell root, execute

npm run build

It will spit out some information about the build process (in all likelihood pointing out that some of my code doesn't look quite right per the standards that I've set), and then create a number of new files in a dist directory. And you're done - hackshell is ready to go!

About the Build Process

For those interested, two of the files in dist are hackshell.js and hackshell.mjs - these are the actual "bundles" which contain all of hackmud's functionality in different formats. These bundles are necessary since hackshell is written using relatively new JavaScript features which aren't available in older versions of JavaScript, not to mention some which web-browsers have no idea how to interpret. Since hackshell is intended to run on a fairly large selection of Node versions and different web browsers, the hackshell source files are "transpiled" to earlier versions of JavaScript with "polyfills" which emulate new features, and then concatenated together into one big file that's easy to reference.

Specifically,

  • hackshell.js is made to run on what is more or less the lowest common denominator when it comes to JavaScript features. It's packaged as a Universal Module

The remaining files are "sourcemaps" that improve the debugging experience by describing how code in the bundles related to the source files in lib

Clone this wiki locally