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

prettier-plugin-gml

v0.1.3

Published

Adds GML language support to Prettier

Downloads

20

Readme

Prettier GML Plugin

Overview

This plugin enhances Prettier, a tool for automatically formatting your code in an opinionated way. This adds Game Maker Language (.gml file) support in the context of Game Maker Studio 2.

Example

Before

var enemy = argument0; var damage = argument1

with(enemy)
{

	  self.hp-=damage
	if(self.hp<=0){instance_destroy(self)}
}

After

var enemy = argument0;
var damage = argument1;

with (enemy) {
  self.hp -= damage;
  if (self.hp <= 0) {
    instance_destroy(self);
  }
}

Beautiful! 🌼

Installation

Install the prequisites, then follow either the global or local install below.

Prerequisites

Node and npm must be installed. They can be installed together from here: https://nodejs.org/

You can then verify that Node and npm have been installed correctly by entering the following commands into any terminal such as Powershell:

node -v
npm -v

If you see a version number for each of them, success! Otherwise, try uninstalling your current version of Node and reinstall it.

Global Install

This will install Prettier and the Prettier GML plugin globally on your machine, meaning it can be used for all of your projects.

npm install -g --save-exact prettier prettier-plugin-gml

Local Install

This will install Prettier and the Prettier GML plugin ONLY for a single Game Maker project. Open up a terminal in the directory of your Game Maker project and run the following commands:

npm init
npm install --save-dev --save-exact prettier prettier-plugin-gml

Usage

⚠️IMPORTANT NOTICE⚠️

This extension is still experimental, please be sure to commit your code into version control or have a backup before using this! There may be uncaught bugs that have the potential to delete code. If using VS Code, this is fixable with an "undo" command after saving.

VS Code

Prettier integrates directly into VS Code! Once you have done the above setup, just install the "Prettier" and "GML Support" VS Code extensions. You may need to enable "editor.formatOnSave" in your VS Code preferences, and now when you save a GML file it should automatically format itself!

WARNING: If you followed the global install, this will cause Prettier to start formatting all files you open with VS Code that are supported with Prettier (such as HTML, JS, and CSS files).

Command Line

To use without VS Code, simply follow the installation above and open up a terminal in the directory of your Game Maker project. Then just run

prettier --write .

For more advanced configurations, the Prettier docs have fantastic explanations of the command line options: https://prettier.io/docs/en/cli.html

Troubleshooting

  • One of the most common fixes may be to simply reinstall Node and npm from https://nodejs.org/
  • If your Node and/or npm versions are very old (<12 or <6.14 respectively), uninstall and reinstall them with more up to date versions
  • If you cannot find an answer to your issue after carefully reading through the installation and usage instructions, file an issue right here!