Skip to content

Instantly share code, notes, and snippets.

View calvinmetcalf's full-sized avatar

Calvin Metcalf calvinmetcalf

View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
({
baseUrl: '../src',
mainConfigFile: '../src/script.js',
wrap: false,
name: '../node_modules/almond/almond',
include:'script',
insertRequire:['script'],
out: '../dist/script.js',
optimize: 'uglify2'
})
{
"main": "./src/script.js",
"scripts": {
"test": "something!!",
"build": "browserify . | uglifyjs -mc > dist/script.js"
}
}
{
"main": "./src/script.js",
"scripts": {
"test": "something!!",
"build-js": "browserify . > dist/script.js",
"min": "uglifyjs -mc dist/script.js > dist/script.min.js",
"build": "npm run build-js && npm run min"
}
}

NPM as a build system

The reasons that you often don't need grunt have been [done][love-unix] [to death][two], so I don't feel any need to lend my voice except to agree. I've also seen Make thrown around as another alternative. Make is a fine program on *nix systems but for node.js it's missing a copule things,

  1. it is global, you have to specify ./node_modules/uglify-js/bin/uglifyjs instead of just uglifyjs.
  2. it is a pain to use on windows.

Now before we turn this into a windows/*nix flame war let me point out, I do not develop on windows, I despise developing on windows, the only time I ever voluntarily touch windows machines is when I'm helping my fiance fix her laptop. But that being said I work with people who use windows and I'd like to continue working with them as I have no interest in doing the heroic work they do with our legacy .NET apps.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@calvinmetcalf
calvinmetcalf / index.js
Created April 2, 2014 13:42
requirebin sketch
var test = require('tape');
var PouchDB = require('pouchdb');
var immediate = require('immediate');
test('benchmarking', function (t) {
var db;
t.test('setup', function (t){
new PouchDB('test').then(function (d) {
d.destroy().then(function () {
new PouchDB('test').then(function (d) {
!function(e){if("object"==typeof exports)module.exports=e();else if("function"==typeof define&&define.amd)define(e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.PouchDB=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
"use strict";
var utils = _dereq_('./utils');
var merge = _dereq_('./merge');
var errors = _dereq_('./deps/errors');
var EventEmitter = _dereq_('events').EventEmitter;
/*
* A generic pouch adapter
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
</head>
<body>
<script src="pouchdb.js"></script>
<script>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
</head>
<body>
<script src="pouchdb.js"></script>
<script>
var body = document.getElementsByTagName('body')[0];