/
Justo.js
78 lines (69 loc) · 1.87 KB
/
Justo.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
//imports
const justo = require("justo");
const catalog = justo.catalog;
const babel = require("justo-plugin-babel");
const copy = require("justo-plugin-fs").copy;
const clean = require("justo-plugin-fs").clean;
const eslint = require("justo-plugin-eslint");
const publish = require("justo-plugin-npm").publish;
const install = require("justo-plugin-npm").install;
//catalog
catalog.workflow({name: "build", desc: "Build the package"}, function() {
clean("Remove build directory", {
dirs: ["build/es5"]
});
eslint("Best practices and grammar", {
output: true,
src: [
"index.js",
"Justo.js",
"lib/",
"test/unit/index.js",
"test/unit/lib/"
]
});
babel("Transpile", {
comments: false,
retainLines: true,
preset: "es2015",
files: [
{src: "index.js", dst: "build/es5/"},
{src: "lib/", dst: "build/es5/lib"}
]
});
clean("Remove dist directory", {
dirs: ["dist/es5"]
});
copy(
"Create package",
{
src: "build/es5/index.js",
dst: "dist/es5/nodejs/justo-generator-express/"
},
{
src: "build/es5/lib/",
dst: "dist/es5/nodejs/justo-generator-express/lib"
},
{
src: ["package.json", "README.md", "template/"],
dst: "dist/es5/nodejs/justo-generator-express/"
}
);
});
catalog.macro({name: "test", desc: "Unit testing"}, {
require: "justo-assert",
src: ["test/unit/index.js", "test/unit/lib/"]
});
catalog.workflow({name: "publish", desc: "NPM publish."}, function() {
publish("Publish in NPM", {
who: "justojs",
src: "dist/es5/nodejs/justo-generator-express/"
});
});
catalog.workflow({name: "install", desc: "Install the generator to test."}, function() {
install("Install", {
pkg: "dist/es5/nodejs/justo-generator-express/",
global: true
});
});
catalog.macro({name: "default", desc: "Default task."}, ["build", "test"]);