<commit_before># JavaScript Library Template

This is meant to serve as a foundation to build JavaScript libraries on top of.
Exactly how a JavaScript library is structured isn't standardized, so this
project aims to define an opinionated pattern for organizing, building, and
testing code.

Don't be afraid to change any code or conventions in this project, it's simply
an educational tool meant to give direction when writing JavaScript libraries.

I created this skeleton project out of what I learned with my projects
[Rekapi](https://github.com/jeremyckahn/rekapi) and
[Shifty](https://github.com/jeremyckahn/shifty).  The build script is a
modification of a script written by [<NAME>](https://github.com/millermedeiros).  The module pattern and AMD
compatibility code is inspired by the work of [<NAME>](https://github.com/sork).

## What this project gives you

  * A scalable, defensive pattern
  * Clearly defined directory structure
  * Module templates
  * Basic build process
  * Compiler directives for customizing binaries
  * Testing template
  * AMD compatibility

### A scalable, defensive pattern

There are a lot of small things you can do maximize compatibility and minimize
headaches.  This template takes care of a lot of this work for you.  Only one
global symbol is exposed (none are exposed if it is loaded as an AMD module),
a clear convention for managing private and public APIs is provided, and
JavaScript Strict Mode is enabled by default.

### Clearly defined directory structure

Each directory has a README that explains what its purpose is.

### Module templates

As your library grows, it helps to separate code into files.  This serves to
keep large amounts of code manageable, and it also makes collaboration easier
by mitigating merge conflicts.  A project must have one core module, and any
number of additional modules.  Modules should be organized by the task they
perform.  For instance, if you have a set of methods that do DOM manipulation,
those should be isolated into a single module.

### Basic build process

Compiled code loads and runs faster than uncompiled code.  This template gives
you `build.js`, a build script that you can easily extend and modify.  The
build process uses [UglifyJS](https://github.com/mishoo/UglifyJS), which
requires [Node](https://github.com/joyent/node) to be installed on your system.

Building this project on the CLI is really easy:

````
$: node build.js --ver <BUILD_VERSION>
````

Where `BUILD_VERSION` is the version number for the binary.  It is strongly
recommended that you use [SemVer](http://semver.org/) for your versioning.

### Compiler directives for customizing binaries
<commit_msg>Adds note about npm packages.<commit_after># JavaScript Library Template

This is meant to serve as a foundation to build JavaScript libraries on top of.
Exactly how a JavaScript library is structured isn't standardized, so this
project aims to define an opinionated pattern for organizing, building, and
testing code.

Don't be afraid to change any code or conventions in this project, it's simply
an educational tool meant to give direction when writing JavaScript libraries.

I created this skeleton project out of what I learned with my projects
[Rekapi](https://github.com/jeremyckahn/rekapi) and
[Shifty](https://github.com/jeremyckahn/shifty).  The build script is a
modification of a script written by [<NAME>](https://github.com/millermedeiros).  The module pattern and AMD
compatibility code is inspired by the work of [Franck
Lecollinet](https://github.com/sork).

## Setting it up

This project uses [NodeJS](http://nodejs.org/) for the build process, and you
need to install [UglifyJS](https://github.com/mishoo/UglifyJS) and
[Commander](https://github.com/visionmedia/commander.js).  Just do this at the
CLI:

````
$ cd lib-tmpl
$ npm install
````

## What this project gives you

  * A scalable, defensive pattern
  * Clearly defined directory structure
  * Module templates
  * Basic build process
  * Compiler directives for customizing binaries
  * Testing template
  * AMD compatibility

### A scalable, defensive pattern

There are a lot of small things you can do maximize compatibility and minimize
headaches.  This template takes care of a lot of this work for you.  Only one
global symbol is exposed (none are exposed if it is loaded as an AMD module),
a clear convention for managing private and public APIs is provided, and
JavaScript Strict Mode is enabled by default.

### Clearly defined directory structure

Each directory has a README that explains what its purpose is.

### Module templates

As your library grows, it helps to separate code into files.  This serves to
keep large amounts of code manageable, and it also makes collaboration easier
by mitigating merge conflicts.  A project must have one core module, and any
number of additional modules.  Modules should be organized by the task they
perform.  For instance, if you have a set of methods that do DOM manipulation,
those should be isolated into a single module.

### Basic build process

Compiled code loads and runs faster than uncompiled code.  This template gives
you `build.js`, a build script that you can easily extend and modify.  The
build process uses [UglifyJS](https://github.com/mishoo/UglifyJS), which
requires Node to be installed on your system.

Building this project on the CLI is really easy:

````
$: node build.js --ver <BUILD_VERSION>
````

Where `BUILD_VERSION` is the version number for the binary.  It is strongly
recommended that you use [SemVer](http://semver.org/) for your versioning.

### Compiler directives for customizing binaries

{'fraction_non_alphanumeric': 0.06296559063497695, 'fraction_numerical': 0.0, 'mean_word_length': 4.469447138700291, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 13, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7071224', 'n_tokens_mistral': 1466, 'n_tokens_neox': 1401, 'n_words': 780}