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

pjs-project-settings

v0.9.0

Published

jshint and jsbeautify settings.

Downloads

4

Readme

project-settings

pjs-project-settings is a global npm package that helps other pjs projects keep their build process up to date.

Installation

Install pjs-project-settings globally.

$ npm i pjs-project-settings -g

Then run pjs-project-settings from the directory you want to update.

It will override your Gruntfile.js and add a directory called grunt/tasks and grunt/settings.

You'll be prompted for every override, except for settings, which should be kept up to date.

If you have an existing Gruntfile and want to preserve some of your tasks, try using grunt-generate-configs with -js option. generate_configs -js from the directory of your project. Then copy the output to the grunt/tasks as you see fit.

Next run this command to update your devDependencies.

$ pjs-project-settings --devDeps

Grunt tasks

Basic tasks

  • clean Removes files and directories.
  • copy Copies files and directories.
  • jsbeautifier Beautifies js files
  • jshint Lints js for errors.
  • replace Replaces template vars
  • rig Combines js files (like concat but better).
  • uglify Minifies js files
  • watch Watches for changes and runs tasks when they change, usually the default task.

More specific

  • bump Bump the version in the package.json and the bower.json. Example: grunt bump --level minor.
  • githooks pre-commit: Make sure js files are beautified according to p-js conventions. Build a release, and add the dist folder.

Aliases

This changes often per project, but the most basic default grunt task list and release grunt task list are included in grunt/tasks/aliases.yml.

  • default: clean, jshint:devel, rig, replace, copy
  • release: clean, jshint:release, rig, replace, copy, uglify

Linting

In grunt/settings you'll find jshint.json and jshint-dev.json. jshint.json is used for release builds, and jshint-dev.json is used for dev builds while you're editing your code.

In dev mode, the differences are:

  • you can skip semicolons (asi = false).
  • you can have unused variables (unused = false).
  • you can have trailing whitespace (trailing = false).
  • you can use debug statements (debug = true).
  • you can use console and alert (devel = true).
  • no indent enforced (indent options removed).

For a quick overview of the current settings see here.

Beautifying

Below are the pjs settings for beautifying. See here for more about these options.

Workflow Tip: If you're using Sublime Text, install JSFormat and use these as your settings. And add "format_on_save": true.

{
    "indent_with_tabs": true,
    "preserve_newlines": true,
    "max_preserve_newlines": 10,
    "jslint_happy": false,
    "brace_style": "collapse",
    "keep_array_indentation": false,
    "keep_function_indentation": false,
    "space_before_conditional": true,
    "break_chained_methods": false,
    "eval_code": false,
    "unescape_strings": false,
    "wrap_line_length": 0
}