# lorry

> ![Very Long Truck](https://media.giphy.com/media/yQ3dHjhGpI98Y/giphy.gif)

Latest version **0.1.0** (published 2017-06-28) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2017-06-28 |
| First published | 2015-10-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=8.0.0 |
| Dependencies | 21 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Steve Davis |
| Maintainers | celeryclub |

## Links

- npm: https://www.npmjs.com/package/lorry
- Repository: https://github.com/celeryclub/lorry
- Homepage: https://github.com/celeryclub/lorry#readme
- Issues: https://github.com/celeryclub/lorry/issues
- npm.io page: https://npm.io/package/lorry

## Dependencies (21)

- [del](https://npm.io/package/del.md) ^3.0.0
- [gulp](https://npm.io/package/gulp.md) ^3.9.1
- [colors](https://npm.io/package/colors.md) ^1.1.2
- [extend](https://npm.io/package/extend.md) ^3.0.1
- [morgan](https://npm.io/package/morgan.md) ^1.8.2
- [gulp-s3](https://npm.io/package/gulp-s3.md) ^0.11.0
- [tiny-lr](https://npm.io/package/tiny-lr.md) ^1.0.5
- [minimist](https://npm.io/package/minimist.md) ^1.2.0
- [through2](https://npm.io/package/through2.md) ^2.0.3
- [gulp-sass](https://npm.io/package/gulp-sass.md) ^3.1.0
- [gulp-concat](https://npm.io/package/gulp-concat.md) ^2.6.1
- [gulp-dedupe](https://npm.io/package/gulp-dedupe.md) 0.0.2
- [gulp-insert](https://npm.io/package/gulp-insert.md) ^0.5.0
- [gulp-uglify](https://npm.io/package/gulp-uglify.md) ^3.0.0
- [streamqueue](https://npm.io/package/streamqueue.md) ^1.1.1
- [gulp-connect](https://npm.io/package/gulp-connect.md) ^5.0.0
- [run-sequence](https://npm.io/package/run-sequence.md) ^1.2.2
- [gulp-template](https://npm.io/package/gulp-template.md) ^4.0.0
- [gulp-clean-css](https://npm.io/package/gulp-clean-css.md) ^3.4.2
- [gulp-angular-templatecache](https://npm.io/package/gulp-angular-templatecache.md) ^2.0.0
- [connect-history-api-fallback](https://npm.io/package/connect-history-api-fallback.md) ^1.3.0

## Recent versions

- 0.1.0 (latest) — 2017-06-28
- 0.0.7 — 2017-06-28
- 0.0.6 — 2017-06-28
- 0.0.5 — 2017-06-28
- 0.0.4 — 2017-06-28
- 0.0.3 — 2017-06-28
- 0.0.2 — 2017-06-28
- 0.0.1 — 2017-06-28
- 1.0.0 — 2015-10-15

## README

# Lorry

![Very Long Truck](https://media.giphy.com/media/yQ3dHjhGpI98Y/giphy.gif)

## API

### `lorry(environment, projectConfig)`

Creates a new instance of lorry.

##### `environment`

The name of the environment to use for building. lorry will look for an environment with this name in `environments`.

Type: `String`  
Required: yes

Note: If it's available, lorry will use `process.env.NODE_ENV` instead of the provided value.

##### `projectConfig`

The configuration object for your project, which will be merged with the default configuration.

Type: `Object`  
Required: no  
Default value: `{}`

### `lorry.config`

Returns the complete configuration object - `projectConfig` merged with the default configuration.

### `lorry.locals`

Returns an object with the following keys:

```js
* stylesheetUrls
* javascriptUrls
* metaTags
```

### `lorry.build()`

Builds all assets as described in `manifest`.

### `lorry.watch(liveReload)`

Watches all files described in `manifest` for changes, and rebuilds changed assets.

##### `liveReload`

Whether or not to start a [LiveReload](http://livereload.com/) server on port 35729.

Type: `Boolean`  
Required: no  
Default value: `false`

### `lorry.installTask(taskName)`

Sets up a [Gulp](https://github.com/gulpjs/gulp) task. The available tasks are as follows:

```js
* build // build the project - equivalent to lorry.build()
* server // start a local server and watch for changes
* deploy // deploy to bucket specified in environment.deploy
```

##### `taskName`

The name of the task being installed.

Type: `String`  
Required: yes  

### `lorry.setDefaultTask(taskName)`

Sets one of the installed Gulp tasks as the default (i.e., the task that will be executed when you simply run `gulp`).

##### `taskName`

The name of the task being set as default.

Type: `String`  
Required: yes  

## Configuration options

```js
// Default values shown
var config = {
  _package: require('./package.json'),
  manifest: require('./manifest.json'),
  buildDirectory: 'public',
  indexOutputPath: 'index.html',
  assetOutputPath: 'assets',
  setStrictMode: true,
  concatenateTemplates: false,
  angularModule: undefined, // (required when using concatenateTemplates)
  templateAssetOutputPath: assetOutputPath, // assetOutputPath to use in concatenated templates
  devHost: 'localhost',
  devPort: 9001,
  livereload: true
};
```

## Example usage

### Standalone mode

```js
// server.js

var express = require('express'),
    minimist = require('minimist');

var options = minimist(process.argv.slice(2)),
    environment = options.environment || options.e || 'staging';

var lorry = require('lorry')(environment);

lorry.build();

if (!process.env.NODE_ENV || process.env.NODE_ENV === 'development') {
  lorry.watch(true);
}

var app = express();

app.set('port', (process.env.PORT || lorry.config.devPort));

app.use('/assets', express.static(path.join(__dirname, lorry.config.buildDirectory, lorry.config.assetOutputPath), {
  fallthrough: false
}));

app.get('*', function(request, response) {
  response.render('index.html', lorry.locals;
});

app.listen(app.get('port'), function() {
  console.log('Node app is running on port', app.get('port'));
});

```

### Gulp mode

```js
// gulpfile.js

var minimist = require('minimist');

var options = minimist(process.argv.slice(2)),
    environment = options.environment || options.e || 'staging';

var lorry = require('lorry')(environment, config);

lorry.installTask('build');
lorry.installTask('server');
lorry.installTask('deploy');

lorry.setDefaultTask('server');
```

## Command-line switches

```sh
--remote / -r
# Build for remote execution
# This option is automatically set to true when running the "deploy" task or when NODE_ENV is set to something other than "development"
```

## Command-line arguments

The following arguments will override values specified in the config object

```sh
--environment / -e
# Environment to use for build and deploy tasks
# This can be an environment key from the environments object, or the path to a file that contains a complete environment object.
# For an example, see the "Development environment" section below.
```

```sh
--host / -h
# Development server hostname
```

```sh
--port / -p
# Development server port number
```

## Development environment

To use a custom environment for development, create a gitignored file (i.e. `development.json`) and pass this filename to gulp as the `--environment` argument.

File-based environments have the special property `base`, which specifies that this environment should extend an environment from the environments object with the given name. An example file-based environment is below.

```json
{
  "base": "production",

  "dependencies": {
    "javascripts": [
      "//sdk.boxxspring.com/angularjs-boxxspring-sdk-2.0.10.js",
      "//localhost:8081/theme-boxxspring-sdk-1.13.0.js"
   ]
  }
}
```

## Notes

lorry is designed to work with the [Source Version Buildpack](https://elements.heroku.com/buildpacks/ianpurvis/heroku-buildpack-version) for Heroku, or a similar buildpack that sets the `SOURCE_VERSION` environment variable in `profile.d`. This value is used to build asset paths that include a query string for cache busting.

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