Jump to content

Phaser CLI: Create Phaser projects with no build configuration


Recommended Posts

Hey folks,

New version of Phaser CLI is here: https://github.com/phaser-cli/phaser-cli. Phaser CLI is based on the latest versions of Create React App and vue-cli, and is designed to provide a zero-config setup for your Phaser projects.

Getting started:

npm install -g @phaser-cli/cli
# or
yarn global add @phaser-cli/cli

phaser create my-project

cd my-project

npm start # serves your project at localhost:8080
npm run build # builds for production

Currently implemented:

  • Basic template with Babel support
  • Linting with Standard
  • Webpack 4
  • Webpack Dev Server
  • Ability to eject from Phaser CLI

Coming soon™️:

  • Support for additional templates (e.g TypeScript, CoffeeScript)
  • Support for multiplayer games via socket.io
  • More linting options (e.g ESLint, ESLint + Standard, ESLint + AirBnB)
  • Add some tests into the templates
  • Integrate Travis/AppVeyor for automated testing/deployment of Phaser CLI

And likely a few other things yet to be decided.

Phaser CLI is still a work in progress (read: bugs!) so please yell if you're having any issues.

Any contributions to the code and other suggestions are very much appreciated ?

Link to comment
Share on other sites

  • 3 weeks later...

A few decent fixes have been added recently, particularly fixing an error that broke the cli when using npm instead of yarn.

Webpack configs have also been updated to be more performant and some of the scripts have been tidied up.

In the next couple of weeks I plan to add the ability to customise the creation of a project, starting off with linting choices (ESLint, ESLint + Standard, ESLint + Airbnb, ESLint + Prettier) and then adding in TypeScript support.

Link to comment
Share on other sites

5 minutes ago, nkholski said:

Just tested it. Worked great to install (except it had a conflict against other service using port 8080). Is it possible to keep assets out of the src folder and avoid using import?

Thanks for the feedback, really appreciate it!

Currently it doesn't support "assets" in the root directory without import (with import it's fine), but will definitely look at adding in support for it. However the "static" folder can be used as a workaround for the time being, as it's just copied straight to the build directory.

You should be able to specify a custom port when running the dev server: e.g. "PORT=3000 npm start" - I just need to get around to writing some decent documentation ?

Link to comment
Share on other sites

13 minutes ago, nkholski said:

I've tried to put my assets folder in static but I get a 404 when trying to load an image: "/assets/image.png".

You would have to reference it as "/static/assets/image.png" at the moment but ideally it would be what you have above.

The main reason I favoured imports over static assets was for cache busting via webpack.

Link to comment
Share on other sites


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...