forked from Raynos/browserify-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.js
36 lines (30 loc) · 852 Bytes
/
example.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
var fs = require("fs")
, read = fs.createReadStream
, write = fs.createWriteStream
, join = require("path").join
, mkdirp = require("mkdirp")
, resources = join(__dirname, "resources")
, uris = [
"Makefile"
, "index.js"
, ".rageignore"
, "package.json"
, join("static", "index.html")
]
module.exports = Example
function Example(uri) {
var exampleDir = join(process.cwd(), "examples", uri)
mkdirp(join(exampleDir, "static"), function (err) {
if (err) {
throw err
}
uris.forEach(function (file) {
var target = file
if (file === ".rageignore") {
target = ".gitignore"
}
read(join(resources, file))
.pipe(write(join(exampleDir, target)))
})
})
}