Code Monkey home page Code Monkey logo

new-times-garden's Introduction

Setting up repo

Repo contains workspaces in /apps/

Installing environment

Set .env file from .env.example template

npm install

Development mode

Repo has few commands for each module: sass and client, api for backend

npm run client
npm run sass
npm run api

Build mode

Build mode runs build api (backend), then creates client, on server it will be moved into api folder 'static' and serves 'index.html'

npm run build:client
npm run build:api

Repository settings

For auto-deploy on server, add to github.com repository settings secrets

  • SSH_PRIVATE_KEY: private key from server ssh keygen, *Private key
  • SSH_HOST: server ip / domain
  • SSH_USER: serever login user (dev, root...)

Phaser esbuild TypeScript Template

This is a Phaser 3 project template that uses esbuild for bundling. It supports hot-reloading for quick development workflow, includes TypeScript support and scripts to generate production-ready builds.

This Template is also available as a JavaScript version.

Versions

This template has been updated for:

screenshot

Requirements

Node.js is required to install dependencies and run scripts via npm.

Available Commands

Command Description
npm install Install project dependencies
npm run dev Launch a development web server
npm run build Create a production build in the dist folder

Writing Code

After cloning the repo, run npm install from your project directory. Then, you can start the local development server by running npm run dev.

The local development server runs on http://localhost:8080 by default. Please see the esbuild documentation if you wish to change this, or add SSL support.

Once the server is running you can edit any of the files in the src folder. esbuild will automatically recompile your code and then reload the browser.

Template Project Structure

We have provided a default project structure to get you started. This is as follows:

  • public/index.html - A basic HTML page to contain the game.
  • src - Contains the game source code.
  • src/main.ts - The main entry point. This contains the game configuration and starts the game.
  • src/scenes/ - The Phaser Scenes are in this folder.
  • src/global.d.ts - Global TypeScript declarations, provide types information.
  • public/style.css - Some simple CSS rules to help with page layout.
  • public/assets - Contains the static assets used by the game.

Deploying to Production

After you run the npm run build command, your code will be built into a single bundle and saved to the dist folder, along with any other assets your project imported, or stored in the public assets folder.

In order to deploy your game, you will need to upload all of the contents of the dist folder to a public facing web server.

Customizing the Template

esbuild

If you want to customize your build, such as adding plugin (i.e. for loading CSS or fonts), you can modify the esbuild/build.prod.mjs and esbuild/dev.server.mjs files for cross-project changes, or you can modify and/or create new configuration files and target them in specific npm tasks inside of package.json. Please see the esbuild documentation for more information.

new-times-garden's People

Contributors

vitalii-zavhorodnii avatar

Watchers

 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.