Git Product home page Git Product logo

rotjs-typescript-basics's Introduction

rot.js TypeScript basics

A basic roguelike example built with rot.js and TypeScript. Playable at https://mizar999.github.io/rotjs-typescript-basics/

Resources

How to run

After cloning the repository:

  • Install necessary packages

    npm install
  • To build the application run:

    npm run build
  • To run multiple npm scripts cross platform in parallel run the following command:

    # if globally installed
    concurrently npm:watch npm:serve
    
    # if locally installed
    npx concurrently npm:watch npm:serve

Initial Project setup

If you're interested here is my initial project setup:

  • Init npm and install necessary packages

    npm init -y
    npm install --save-dev typescript@4.9.4 ts-loader@9.4.2 rot-js@2.2.0 webpack@5.75.0 webpack-cli@5.0.1 http-server@14.1.1 concurrently@7.6.0
  • Create Webpack configuration webpack.config.js:

    const path = require('path');
    
    module.exports = {
    entry: './src/app.ts',
    module: {
        rules:[{
            test: /\.tsx?$/,
            use: 'ts-loader',
            exclude: /node_modules/
        }]
    },
    resolve: {
        extensions: ['.ts', '.tsx', '.js']
    },
    output: {
        filename: 'app.js',
        path: path.resolve(__dirname, 'dist')
    },
    mode: 'development'
    };
  • Webpack will get the sources from src/app.ts and collect everything in dist/app.js file

  • Create TypeScript configuration tsconfig.json:

    {
        "compilerOptions": {
            "target": "es5"
        },
        "include": [
            "src/*"
        ]
    }
  • Update the scripts-section of the package.json file:

    "scripts": {
        "build": "webpack",
        "watch": "webpack --watch",
        "serve": "http-server --port=8085 -c-1"
    }

rotjs-typescript-basics's People

Contributors

dependabot[bot] avatar mizar999 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.