Skip to content

Latest commit

 

History

History
100 lines (63 loc) · 3.42 KB

File metadata and controls

100 lines (63 loc) · 3.42 KB

Node Module Template

A GitHub template repo for node modules

neostandard javascript style Module type: ESM Types in JS Follow @voxpelli@mastodon.social Ask DeepWiki

About This Template

This template is designed for creating Node.js library modules - packages that provide reusable functionality to other projects.

When to use this template:

  • Building npm libraries and utilities
  • Creating shared code modules
  • Developing packages without CLI or server components

Related templates:

For detailed coding guidelines and GitHub Copilot instructions, see .github/copilot-instructions.md

Testing

This template uses two complementary test layers:

  • Runtime tests in test/*.spec.js using node:test and node:assert/strict
  • Type-level tests in typetests/*.tst.ts using tstyche

Useful commands:

  • npm test – full verification flow
  • npm run test:node – runtime tests with c8 coverage
  • npm run check-type-tests – type-level contract tests

Git Hooks

Husky is opt-in in this template.

  • npm run husky-enable – enable git hooks
  • npm run husky-disable – disable git hooks

Lockfile Policy

This module template does not commit a lockfile by default (package-lock=false in .npmrc).

Usage

import { something } from '@voxpelli/node-module-template';

// Use that something

API

something()

Takes a value (input), does something configured by the config (configParam) and returns the processed value asyncly(output)

Syntax

something(input, [options]) => Promise<true>

Arguments

  • inputstring – the input of the method
  • optionsSomethingOptions – optional options

SomethingOptions

  • maxAgenumber – the maximum age of latest release to include
  • minDownloadsLastMonth = 400number – the minimum amount of downloads needed to be returned
  • skipPkgboolean – when set skips resolving package.json

Returns

A Promise that resolves to true

Used by

  • example – used by this one to do X and Y

Similar modules

  • example – is similar in this way

See also