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

brass

v0.0.2

Published

Build Node.js project to a native OS package

Downloads

7

Readme

brass

Build Status NPM Version

Build Node.js project to a native OS package.

Installation

Install as dependency:

npm install brass

Install as CLI tool:

npm install -g brass

How to use

CLI

Run brass in your project directory where file package.json is located.

Run brass -h for usage.

Programmatically

var brass = require('brass');
var options, emitter;

options = {
  workDir: '.'
};

emitter = brass.build(options, function (error) {
    console.log('finish');
});

emitter.on('info', function (data) {
    console.log(data);
});

API

build([options], [callback])

  • options Object - an optional object that supersedes options from package.json.
  • callback(error) Function - an optional callback function to run once package building have completed.

Options

Options are read from several locations and merged key-wise in particular order:

  1. Standard package.json properties (pkg).
  2. Object brass in package.json file.
  3. options argument in API function or CLI overrides.

Example

For given package.json file

{
  "name": "theapp",
  "version": "0.0.0",
  "brass": {
    "name": "myapp"
  }
}

and API call

brass.build({ version: "0.0.1" });

final options object would be:

{
  name: "myapp",
  version: "0.0.1"
}

Properties

Required:

  • type (default: rpm) - package type. For now only RPM is supported.
  • name (default: pkg.name) - package name.
  • version (default: pkg.version) - package version.
  • package (default: process.cwd()) - path to npm package to build.
  • workDir (default: os.tmpdir()) - work directory for temporary and build files.
  • summary (default: 'Node.js module '+ pkg.name) - short description.
  • description (default: pkg.description) - long description.
  • release (default: 1) - release number.
  • group (default: 'Applications/Internet') - RPM group (valid groups).
  • license (default: pkg.license) - license.
  • prefix (default: '/usr') - install prefix.

Binaries and service:

  • bin (default: pkg.bin) - map of command names to local filenames that will be symlinked into prefix/bin.
  • service (default: none) - system service description.
    • service.type - valid type: (systemd, sysv).
    • service.name - command name that will be placed into prefix/sbin.
    • service.target - local filename that the command will be linking to.
    • service.user- run process as another user.

File mapping:

  • files - an array of map objects.
  • files[].target - directory to copy files to.
  • files[].files - glob pattern.
  • files[].cwd - directory to start globbing from.
  • files[].type - 'config' for configuration files or empty for normal files.
  • files[].noreplace - don't replace files on package upgrade, it can be used in combination with type = config.
  • files[].attr - an file permission array [ chmod, user, group ].

Instead of map object a shorthand expression can be used. Simple glob pattern, e.g. **\*.js is equal to:

{
  "target": "/usr/lib/<name>",
  "files": "**/*.js",
  "cwd": "."
}

Optional RPM properties:

  • url (default: empty) - documentation URL.
  • distribution (default: empty) - usually Linux distribution name.
  • vendor (default: pkg.author) - organization that distributes the software.
  • packager (default: empty) - organization that actually packaged the software.

License

ISC