npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

xopoly

v0.14.0

Published

A game of greed

Downloads

33

Readme

xopoly

This project provides an engine for playing a version of xopoly. Running it in isolation will work, however will only provide you with a development board, see ./boards/develop.

To create a working application, with your own boards you will need the following. Boards can exist either within the container application itself or within their own modules.

  • A container module/application.
  • Boards module or modules, holding the board layouts and configurations.

A default application making use of a default board is provided with the modules xopoly-app and xopoly-board-default.

Installation

You can install the engine in isolation, and use the develop board, however if you wish to install a working game with default board, you should install the xopoly-app module.

  $ npm install -g xopoly

Creating an application

An application is a module that depends on the xopoly engine and optionally any board modules you wish to allow. The module xopoly-app provides an example of such an application.

To create your own application, we create the following files. Update the dependencies with the latest versions.

package.json

{
  "name": "xopoly-app-myapp",
  "version": "0.0.1",
  "description": "My xopoly app",
  "main": "lib/app.js",
  "bin": {
    "xopoly-app": "bin/app.js"
  },
  "dependencies": {
      "xopoly": "0.1.x",
      "xopoly-board-default": "0.1.x",
      "xopoly-board-myboard": "0.1.x"
  }
}

./bin/app.js

#! /usr/bin/env node

require('../lib/app').start();

./lib/app.js

var path = require('path');
var xopoly = require('xopoly');
var defaultBoards = require('xopoly-board-default');
var myBoards = require('xopoly-board-myboard');

module.exports = {
    start: function() {

        // Load application boards
        xopoly.addBoards(path.resolve(__dirname + '/../boards'));

        // Load default boards
        xopoly.addBoards(defaultBoards.getPath());

        // Load custom boards
        xopoly.addBoards(myBoards.getPath());

        // Begin
        xopoly.start();
    }
};

Creating boards

Boards can either exist within an application itself, or within their own module, and are configured by providing a boards directory path which can contain one or more boards each within a subdirectory. The xopoly-board-default module provides an example of a board.

To create your own board as a module, we create the following files.

package.json

{
  "name": "xopoly-board-myboard",
  "version": "0.0.1",
  "description": "My xopoly board",
  "main": "lib/index.js",
  "files": [
    "boards",
    "lib"
  ]
}

./lib/index.js

var path = require('path');

module.exports = {
    getPath: function() {
        return path.resolve(__dirname + '/../boards');
    }
};

The boards directory

The boards directory should contain one subdirectory for each board. To get started with a new board, you can create a copy of the default board from xopoly-board-default module.

Each board subdirectory should at minimum, contain the following.

  • ./web - This directory is mapped to the location /boards/<board> so image and css assets can be referenced.
  • ./web/css/board.css - The board css file, to override any default css from the engine.
  • ./board.json - Contains the configurtion needed for the board.

You should ensure all asset references within board.json or any css files reference the correct location for the board name, you should avoid cross referencing assets between boards.

Development

The application is split in to two projects, the nodejs backend server, and reactjs frontend.

To run the backend server. The react build is available within the public directory, accessed at http://localhost:3000

$ ./bin/xopoly.js

To run a development server for react, (unknown requests are proxied to port 3000, the nodejs back end server). The development server is available at http://localhost:3001.

$ cd ./web-src
$ npm start

To build for production. This will place the compiled source in to the ./public directory, which is the docroot for the backend server.

$ cd ./web-src
$ npm run-script build

License: MIT

Author: Ash Brown