# sardines

> Combine all node.js scripts into one file. Run it as a single executable, or online.

Latest version **0.4.5** (published 2013-06-27) · 0 weekly downloads

## Install

```sh
npm install sardines
pnpm add sardines
yarn add sardines
bun add sardines
```

Provides the command `sardines`.

## Health

**Score 10/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; low quality score; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.4.5 |
| Published | 2013-06-27 |
| First published | 2011-07-16 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 8 |
| Known vulnerabilities | 0 (+9 in 3 direct dependencies) |
| Install scripts | no |
| GitHub stars | 37 |
| Author | Craig Condon |
| Maintainers | architectd |

## Links

- npm: https://www.npmjs.com/package/sardines
- Repository: http://github.com/crcn/sardines
- npm.io page: https://npm.io/package/sardines

## Dependencies (8)

- [ejs](https://npm.io/package/ejs.md) 0.8.x
- [step](https://npm.io/package/step.md) 0.0.x
- [amdify](https://npm.io/package/amdify.md) 0.0.x
- [outcome](https://npm.io/package/outcome.md) 0.0.x
- [structr](https://npm.io/package/structr.md) 0.2.x
- [optimist](https://npm.io/package/optimist.md) 0.3.x
- [uglify-js](https://npm.io/package/uglify-js.md) 1.3.x
- [underscore](https://npm.io/package/underscore.md) 1.4.x

## Recent versions

- 0.4.5 (latest) — 2013-06-27
- 0.4.4 — 2013-05-15
- 0.4.3 — 2013-04-27
- 0.4.2 — 2013-04-26
- 0.4.1 — 2013-04-20
- 0.4.0 — 2013-04-09
- 0.3.5 — 2013-01-21
- 0.3.4 — 2012-12-20
- 0.3.3 — 2012-11-02
- 0.3.2 — 2012-08-20
- 0.3.1 — 2012-06-30
- 0.3.0 — 2012-06-22
- 0.2.5 — 2012-02-18
- 0.2.4 — 2012-01-18
- 0.2.3 — 2012-01-13
- … 10 more at https://npm.io/package/sardines/versions

## README

## What is it?

Combine all node.js scripts into one file. Run it as a single executable, or online.

## Features

- Combine all scripts into one (shrinkwrap method)
- Asynchronously load all scripts (browserify method)
- express middleware

### JS Example

```javascript
var sardines = require("sardines"),
fs = require("fs");

sardines.shrinkwrap({
	entry: __filename
}, function(err, content) {
	fs.writeFile(__dirname + "/shrinkwrapped.js", content);
});
```

### Express example
```javascript
var server = require("express").createServer();
server.use(require("sardines").middleware({
	directory: __dirname + "/public"
}));
server.listen(8080);
```

In your browser, load a script and append one of the following query arguments: `shrinkwrap`, `browserify`, or `wrap`.

Like so:

```bash
http://localhost:8080/js/app.js?browserify # asynchronously loads ALL scripts vs loading into one
http://localhost:8080/js/app.js?shrinkwrap # loads all scripts into one
http://localhost:8080/js/app.js?wrap # wraps the script in a function so it doesn't pollute the global namespace
```

## Terminal Usage

```bash

Usage: sardines [include] -e [entry] -o [output] -p [port] -d -s

Options:
  -s, --server     run the http server             
  -d, --directory  public directory for http server  [default: cwd]
  -p, --port                                         [default: 8080]
  -m  --method                                       [default: "shrinkwrap"]
```


## Terminal Examples

```bash
sardines -e app.js -o app.shrinkwrap.js -m shrinkwrap # shrinkwrap the app
sardines -s # start the server
```

---
_Source: https://npm.io/package/sardines · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
