GithubHelp home page GithubHelp logo

isabella232 / module-smith Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nodejitsu/module-smith

0.0 0.0 0.0 267 KB

A simple extensible npm build bot that works on Linux, SmartOS, and Windows.

License: MIT License

JavaScript 100.00%

module-smith's Introduction

Module Smith

A simple extensible npm build bot that works on Linux, SmartOS, and Windows.

Example

Given a small script for building a specific module:

var assert = require('assert'),
    tmp = require('tmp'),
    ModuleSmith = require('module-smith');

var buildbot = ModuleSmith.createModuleSmith();

//
// Grab a temporary directory to build in
//
tmp.dir(function (err, tmpdir) {
  assert.ifError(err);
  //
  // Start our build
  //
  buildbot.build({
    repository: {
      type: 'git',
      url: '[email protected]:bmeck/bcrypt-example.git'
    },
    directories: {
      root: tmpdir
    }
  }, function (err, stream) {
    assert.ifError(err);
    //
    // Pipe out the data to stdio
    //
    stream.pipe(process.stdout);
  });
});

We can dump it to a file via:

node build.js > built.tgz

API

ModuleSmith.createModuleSmith(options)

  • Array options.versions: List of the versions supported with absolute version numbers like ie. '0.8.12'
  • BuildDescription options.defaults: The defaults for a build run using this ModuleSmith.

ModuleSmith.build(buildDescription, callback(err, tgzStream))

Runs a build

BuildDescription

{
  uid: 'nobody',
  gid: 'nobody',
  command: 'install',
  env: {
    'npm_config_registry': 'http://registry.npmjs.org',
    'npm_config_nodedir':  path.join(process.env.HOME, '.node-gyp')
  },
  repository: {
    type: 'git',
    url: '[email protected]:bmeck/bcrypt-example.git'
  },
  directories: {
    root: '/path/to/build/output/root'
  }
}

A build description enumerates a number of values

BuildDescription.command

The npm command that you wish to execute for the build. Can be:

  • install: Installs all module dependencies.
  • build: Runs node-gyp to build any binary dependencies.

BuildDescription.env

Optional environmental variables to spawn npm with.

Some interesting fields are:

  • npm_config_registry - registry to download from
  • npm_config_nodedir - location of node-gyp's include directory

BuildDescription.uid = 'nobody'

Optional user to spawn npm as.

BuildDescription.gid = undefined

Optional group to spawn npm under.

BuildDescription.package

Optional package.json overrides. Can be extended easily from the repository during npm.configure.

Some interesting fields are:

  • engines.node - version to spawn as

BuildDescription.repository

A checkout npm module repository to download before building.

BuildDescription.directories.root

The place to use for creating the build.

Understudy Actions

Extensibility for complex actions can be done via Understudy based actions, only before actions are supported.

  • build.configure (buildDescription)
  • npm.configure (buildDescription)
  • npm.package (buildDescription, package)
  • build.output (buildDescription, tgzStream)

Events

Notifications of actions that have been completed are available via the EventEmitter APIs.

  • npm.spawned (buildDescription, npmProcess)

#### Copyright (C) Charlie Robbins, Bradley Meck and the Contributors #### Authors: [Bradley Meck](https://github.com/bmeck), [Charlie Robbins](https://github.com/indexzero) #### License: MIT

Hammer Icon by Edward Boatman from The Noun Project

module-smith's People

Contributors

bmeck avatar indexzero avatar jcrugzz avatar mmalecki avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.