jashkenas / jashkenas/coffeescript

Docs: Document best practice for creating a small NPM module

Open
#4,693 5 comments 4 reactions 0 assignees View on GitHub
help wanted
Dominant language
CoffeeScript
Stars
16.6k
Forks
2k
PR merge metrics
No merged PRs in 30d

Description

When creating a small `npm` package for something like [`strscan`](https://github.com/sstephenson/strscan-js), what is the modern/CS2/best-practices way to structure the repo? I'm looking for something that has a small `Cakefile` and `src`, `lib`, and `tests` directories (if those are recommended).

For example, Sam Stephenson's CoffeeScript based `strscan` package from 2010 looks like this:

* https://github.com/sstephenson/strscan-js

Yet, we're 7 years later with many updates to Node, NPM, and now CoffeeScript. Would someone be able to provide a modern best-practices repo for building a simple package that could be included from other CoffeeScript or JS code simply using `require 'some-package'`?

If so, it might be nice to have a small reference to this in the official documentation.

Thanks!

Contributor guide

Open the contributing guide

Research direction

Review the linked strscan-js repository, especially its Cakefile and src, lib, and tests directories, then compare them with current CoffeeScript and Node package conventions. Define the repository layout and require example the official documentation should recommend, and document the resulting best practice clearly.

Written by the indexing model from the issue text.

Assessment

Tech stack
coffeescript, node.js
Domain
documentation
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.