# smurf

> Fe development tool

Latest version **0.2.61** (published 2020-02-27) · 0 weekly downloads

## Install

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

Provides the command `smurf`.

## 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.2.61 |
| Published | 2020-02-27 |
| First published | 2017-06-17 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 8 |
| Unpacked size | 57.1 KB |
| Known vulnerabilities | 0 (+4 in 3 direct dependencies) |
| Install scripts | no |
| Author | purple.calm |
| Maintainers | purple.calm |

## Links

- npm: https://www.npmjs.com/package/smurf
- npm.io page: https://npm.io/package/smurf

## Dependencies (8)

- [MD5](https://npm.io/package/MD5.md) 1.3.0
- [async](https://npm.io/package/async.md) 2.6.0
- [colors](https://npm.io/package/colors.md) *
- [express](https://npm.io/package/express.md) 4.13.3
- [hogan.js](https://npm.io/package/hogan.js.md) 2.0.0
- [optimist](https://npm.io/package/optimist.md) 0.3.x
- [clean-css](https://npm.io/package/clean-css.md) 3.4.6
- [uglify-js](https://npm.io/package/uglify-js.md) 3.4.*

## Recent versions

- 0.2.61 (latest) — 2020-02-27
- 0.2.5 — 2019-04-16
- 0.2.4 — 2018-07-23
- 0.2.3 — 2018-07-22
- 0.2.2 — 2018-07-02
- 0.2.1 — 2018-05-31
- 0.1.9 — 2018-05-14
- 0.1.8 — 2018-02-27
- 0.1.7 — 2017-07-06
- 0.1.6 — 2017-07-04
- 0.1.5 — 2017-07-04
- 0.1.4 — 2017-07-04
- 0.1.3 — 2017-07-04
- 0.1.2 — 2017-07-04
- 0.1.1 — 2017-07-03
- … 1 more at https://npm.io/package/smurf/versions

## README

![](http://img.eucita.com/fe/smurf.png)
===

## Require
* rsync (http://rsync.samba.org/)
* requirejs ( for local dev mode )

## Installation
```bash
$ npm install smurf -g
```

## Quick Start
before we run the commands of smurf, we should have a project first

### create a project
(directory structure)
```
project
├─┬src
│ └──...
└─.config
```

#### .config file
```
{
	"job": "job",	// String job name,
	"require": {
		"src": "path of requirejs.js",		//required, relative path of requirejs.js
		"mustache": "path of hogan.js",		//require by using template
		"paths": {
			"lib": "common/lib"				//alias
		}
	},

	"registry": "http://registry.npm.fe.eucita.com",	//private npm registry
														//it will downloads all dependencies by using "smurf install" command

	"exports":[						//exports files
		"index/index",				// index/index@ver.js & index/index@ver.css
		"test/test.js"				// test/test@ver.js
		"test/cssonly.css"			// test/cssonly@ver.css
									// required test/cssonly.js file
	],

	"html": [],

	"dependencies": {
		"app": "*",
		"jquery": "1.7.x",
		"hogan": "*",
		"requirejs": "*",
		"icons": "*",
		"button": "*",
		"jquery-api": "*",
		"dialog": "*",
		"switcher": "*",
		"filter-select": "*",
		"filter-select-date": "*"
	},

	"dev": {						//for rsync to server
		"host": "127.0.0.1",
		"path": "/home/q/www/project/"
	}
}
```

### get dependencies
```
$ smurf install
```

### start a server
before start server, make sure the working directory contains project
```bash
$ sudo smurf server
```

server has three modes, [SRC|DEV|PRD]
  * SRC: source mode, return every file, easy to debug
  * DEV: package mode, return a package of required files
  * PRD: product mode, return minified code

```bash
$ sudo smurf server -m DEV
```

### pack
packing exports files

before run pack, make sure the project is working directory
```bash
$ smurf pack
```

result
```
project
├─┬dev(package directory)
│ ├─┬index
│ │ ├──index@dev.js
│ │ └──index@dev.css
│ └─┬test
│   ├──test@dev.js
│   └──cssonly@dev.css
│
├─┬src
│ ├─┬index
│ │ └──index.js
│ └─┬test
│   ├──test.js
│   └──cssonly.js
└─.config
```

### min
minify exports files

before run min, make sure the project is working directory
```bash
$ smurf min
```

result
```
├─┬dev(package directory)
│ ├─┬index
│ │ ├──index@bc23723a6ebdd528a774264d37173293.js
│ │ └──index@db47495f5329bd6a6df53228034d4746.css
│ └─┬test
│   ├──test@dev.js
│   └──cssonly@dev.css
│
├─┬src
│ ├─┬index
│ │ └──index.js
│ └─┬test
│   ├──test.js
│   └──cssonly.js
└─.config

project
├─┬prd(product directory)
│ ├─┬index
│ │ ├──index@bc23723a6ebdd528a774264d37173293.js
│ │ └──index@db47495f5329bd6a6df53228034d4746.css
│ └─┬test
│   ├──test@version1.js
│   └──cssonly@version2.css
│
├─┬ver(versions directory)
│ ├─┬index
│ │ ├──index.js.ver (bc23723a6ebdd528a774264d37173293)
│ │ └──index.css.ver (db47495f5329bd6a6df53228034d4746)
│ └─┬test
│   ├──test.js.ver (version1)
│   └──cssonly.css.ver (version2)
│
├─┬src
│ ├─┬index
│ │ └──index.js
│ └─┬test
│   ├──test.js
│   └──cssonly.js
└─.config
```

### sync
sync all package to target server

*make sure you installed rsync* (find it here http://rsync.samba.org/)

*set dev environment in .config*

before run sync
  * make sure the project is working directory
  * make sure you packed your project before
```bash
$ smurf sync
```
we also run pack and sync together
```bash
$ smurf pack && smurf sync
```

### Hole .config file sample
```
{
	"job": "vs",
	"require": {
		"src": "node_modules/requirejs/index.js",
		"mustache": "node_modules/hogan/index.js",
		"prd": "node_modules/release/index.js",
		"paths": {
			"modules":"modules"
		}
	},

	"html": [{
		"name": "index.jsp",
		"title": "Viewscope",
		"domain": "static.eucita.com",
		"body": "index/index.mustache",
		"js": "index/index.js",
		"css": "index/index.css"
	},{
		"name": "manage.jsp",
		"title": "Viewscope Manage",
		"domain": "static.eucita.com",
		"body": "manage/index.mustache",
		"js": "manage/index.js",
		"css": "manage/index.css"
	}],

	"exports":[
		"index/index",
		"manage/index"
	],

	"dependencies": {
		"app": "*",
		"jquery": "1.7.x",
		"hogan": "*",
		"release": "*",
		"requirejs": "*",
		"icons": "*",
		"button": "*",
		"jquery-api": "*",
		"dialog": "*",
		"switcher": "*",
		"filter-select": "*",
		"filter-select-date": "*"
	},

	"registry": "http://registry.npm.fe.eucita.com"
}
```

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