forked from Rainbow-CPaaS/Rainbow-Node-SDK
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGruntfile.js
More file actions
161 lines (149 loc) · 6.12 KB
/
Gruntfile.js
File metadata and controls
161 lines (149 loc) · 6.12 KB
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
module.exports = function (grunt) {
grunt.initConfig({
/* ------------------------------ VARIABLES -------------------------------- */
version: grunt.file.read("./config/version.js").split("\"")[1],
nodeSdkOrder: grunt.file.read("./jsdoc/cheatsheet/node/nodeSdkOrder") + "\n</div><!--MERMAID-->",
pkg: grunt.file.readJSON("package.json"),
jsdoc2md: {
separateOutputFiles: {
files: [
{ src: "lib/common/Events.js", dest: "build/events.md" },
{ src: "lib/services/Admin.js", dest: "build/admin.md" },
{ src: "lib/services/Bubbles.js", dest: "build/bubbles.md" },
{ src: "lib/services/Channels.js", dest: "build/channels.md" },
{ src: "lib/services/Contacts.js", dest: "build/contacts.md" },
{ src: "lib/services/Conversations.js", dest: "build/conversations.md" },
{ src: "lib/services/FileStorage.js", dest: "build/filestorage.md" },
{ src: "lib/services/IM.js", dest: "build/im.md" },
{ src: "lib/services/Presence.js", dest: "build/presence.md" },
{ src: "lib/services/Groups.js", dest: "build/groups.md" },
{ src: "index.js", dest: "build/sdk.md" },
{ src: "lib/common/models/Bubble.js", dest: "build/bubble.md" },
{ src: "lib/common/models/Channel.js", dest: "build/channel.md" },
{ src: "lib/common/models/Contact.js", dest: "build/contact.md" },
{ src: "lib/common/models/Conversation.js", dest: "build/conversation.md" },
{ src: "lib/common/models/Message.js", dest: "build/message.md" },
{ src: "lib/common/models/Settings.js", dest: "build/settings.md" },
]
}
},
clean: {
dist: ["build"],
},
eslint: {
all: ["lib/**/*.js", "index.js", "tests/**/*.js"],
watched: ["Gruntfile.js"],
options: {
configFile: ".eslintrc",
fix: true
},
checkstylereporter: {
src: ["lib/**/*.js", "index.js", "tests/**/*.js"],
configFile: ".eslintrc",
options: {
outputFile: "reportQUnit/eslint.xml",
format: "checkstyle"
}
},
},
watch: {
lint: {
files: ["lib/**/*.js", "index.js", "tests/**/*.js"],
tasks: ["eslint:all"]
}
},
jsdoc: {
nodesheets: {
src: [
"lib/services/Admin.js",
"lib/services/Bubbles.js",
"lib/services/Channels.js",
"lib/services/Contacts.js",
"lib/services/Conversations.js",
"lib/services/FileStorage.js",
"lib/services/Groups.js",
"lib/services/IM.js",
"lib/services/Presence.js",
"index.js",
"lib/common/Events.js",
"lib/common/models/Bubble.js",
"lib/common/models/Channel.js",
"lib/common/models/Conversation.js",
"lib/common/models/Contact.js",
"lib/common/models/Message.js"
],
dest: "bin/jsdoc",
options: {
template: "node_modules/rainbow_hub_sheets_generation/mermaidtemplate"
}
}
},
"copy-part-of-file": {
nodesheets: {
options: {
sourceFileStartPattern: "<!--START-->",
sourceFileEndPattern: "<!--END-->",
destinationFileStartPattern: "<div class=\"mermaid\">",
destinationFileEndPattern: "@@</div><!--MERMAID-->"
},
files: {
"./jsdoc/cheatsheet/node/nodesheets.html": ["./bin/jsdoc/sheets/diagram"]
}
}
},
copy: {
generatednodecheatsheet: {
files: [
{expand: true, cwd: "./jsdoc", src: ["cheatsheet/node/**/*.html"], dest: "bin/jsdoc/sheets", filter: "isFile"},
{expand: true, cwd: "./jsdoc", src: ["cheatsheet/node/**/*.css"], dest: "bin/jsdoc/sheets", filter: "isFile"},
{expand: true, cwd: "./jsdoc", src: ["cheatsheet/assets/**/*.*"], dest: "bin/jsdoc/sheets", filter: "isFile"},
{expand: true, cwd: "./node_modules/mermaid/dist", src: ["mermaid.js"], dest: "bin/jsdoc/sheets/cheatsheet", filter: "isFile"},
{expand: true, cwd: "./node_modules/rainbow_hub_sheets_generation/node_modules/mermaid/dist", src: ["mermaid.js"], dest: "bin/jsdoc/sheets/cheatsheet", filter: "isFile"}
]
}
},
replace: {
nodesheets: {
options: {
patterns: [
{
json: {
"<!--VERSION HERE-->": "<h3>Cheat Sheet Beta - NodeSdk - v<%= pkg.version %></h3>",
"</div><!--MERMAID-->": "<%= nodeSdkOrder %>"
}
}
]
},
files: [
{
expand: true,
flatten: true,
src: [
"jsdoc/cheatsheet/node/nodesheets.html",
],
dest: "bin/jsdoc/sheets/cheatsheet/node/"
}]
}
},
exec: {
renderNodeSheets: {
cmd: "node puppeteer.js node"
},
sitemapGeneration: {
cmd: "node sitemap_generation.js"
}
}
});
grunt.loadNpmTasks("grunt-jsdoc-to-markdown");
grunt.loadNpmTasks("grunt-eslint");
grunt.loadNpmTasks("grunt-contrib-clean");
grunt.loadNpmTasks("grunt-contrib-copy");
grunt.loadNpmTasks("grunt-contrib-watch");
grunt.loadNpmTasks("grunt-jsdoc");
grunt.loadNpmTasks("grunt-copy-part-of-file");
grunt.loadNpmTasks("grunt-replace");
grunt.loadNpmTasks("grunt-exec");
grunt.registerTask("default", ["clean:dist", "jsdoc2md", "nodesheets", "exec:sitemapGeneration"]);
grunt.registerTask("nodesheets", ["jsdoc:nodesheets", "copy-part-of-file:nodesheets", "copy:generatednodecheatsheet", "replace:nodesheets", "exec:renderNodeSheets"]);
grunt.registerTask("lint", ["eslint:all"]);
};