0.9.0 • Published 10 years ago

pjs-project-settings v0.9.0

Weekly downloads
4
License
ISC
Repository
github
Last release
10 years ago

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
}
0.9.0

10 years ago

0.8.0

10 years ago

0.7.0

10 years ago

0.5.0

10 years ago

0.6.0

10 years ago

0.4.3

10 years ago

0.4.2

10 years ago

0.4.1

10 years ago

0.4.0

10 years ago

0.3.0

10 years ago