This repository has been archived by the owner on Jun 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
/
checkcode_and_compile.cfg
488 lines (458 loc) · 15.9 KB
/
checkcode_and_compile.cfg
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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
[buildout]
parts +=
nodejs
npm_config
npms
npm_bins
merge_static_directories
do_merge_static_directories
frontend.current.link
frontend.scripts
bower
AdhocracySpec.ts
meta_api
resources
javascript
gruntfile
grunt
rubygems
stylesheets
hologram
styleguide
[tslint_json]
recipe = collective.recipe.template
inline =
{
"ban": [],
"rules": {
"class-name": true,
"comment-format": [true,
"check-space"
],
"curly": true,
"eofline": true,
"forin": true,
"indent": false,
"interface-name": false,
"jsdoc-format": true,
"label-position": true,
"label-undefined": true,
"max-line-length": [true, 140],
"no-any": false,
"no-arg": true,
"no-bitwise": true,
"no-console": [true,
"debug",
"info",
"time",
"timeEnd",
"trace"
],
"no-consecutive-blank-lines": false,
"no-construct": true,
"no-debugger": true,
"no-duplicate-key": true,
"no-duplicate-variable": true,
"no-empty": true,
"no-eval": true,
"no-string-literal": false,
"trailing-comma": {
"multiline": "never",
"singleline": "never"
},
"no-trailing-whitespace": true,
"no-unused-expression": true,
"no-unused-variable": true,
"no-unreachable": true,
"no-use-before-declare": true,
"no-var-requires": true,
"one-line": [true,
"check-catch",
"check-else",
"check-open-brace",
"check-whitespace"
],
"quotemark": [true, "double"],
"radix": true,
"semicolon": true,
"triple-equals": [true, "allow-null-check"],
"typedef": false,
"typedef-whitespace": [true,
["callSignature", "noSpace"],
["catchClause", "noSpace"],
["indexSignature", "space"]
],
"use-strict": [true,
"check-module",
"check-function"
],
"variable-name": [true, "allow-leading-underscore"],
"whitespace": [true,
"check-branch",
"check-decl",
"check-operator",
"check-separator",
"check-type"
]
}
}
output = ${buildout:directory}/etc/tslint.json
mode = 644
[check_code]
# Extends adhocracy_core/checkcode.cfg['check_code']
css_check =
if [ x$1 == x"-a" ]; then
CHANGED_SCSS=`git ls-files | grep '\.scss$' | grep -v 'third_party'`
else
CHANGED_SCSS=`git diff --staged --name-only --diff-filter=ACMR | grep '\.scss$' | grep -v 'third_party'`
fi
if [ -n "$CHANGED_SCSS" ] ; then
. source_env
${buildout:bin-directory}/grunt sasslint
ret_code=$(($ret_code + $?))
fi
js_check =
if [ x$1 == x"-a" ]; then
CHANGED_TS=`git ls-files | grep '\.ts$' | grep -v '\.d\.ts'`
else
CHANGED_TS=`git diff --staged --name-only --diff-filter=ACMR | grep '\.ts$' | grep -v '\.d\.ts'`
fi
if [ -n "$CHANGED_TS" ] ; then
${buildout:bin-directory}/tslint -c ${tslint_json:output} $CHANGED_TS
ret_code=$(($ret_code + $?))
fi
html_check =
if [ x$1 == x"-a" ]; then
CHANGED_HTML=`git ls-files | grep '\.html$'`
else
CHANGED_HTML=`git diff --staged --name-only --diff-filter=ACMR | grep '\.html$'`
fi
if [ -n "$CHANGED_HTML" ] ; then
. source_env
bin/grunt htmlhint
ret_code=$(($ret_code + $?))
fi
[nodejs]
recipe = gp.recipe.node
version = 4.4.5
scripts = node npm
[npm_config]
recipe = collective.recipe.template
inline =
{
"name": "adhocracy-frontend",
"version": "0.0.1",
"devDependencies": {
"typescript": "1.8.10",
"tslint": "3.15.1",
"bower": "1.8.0",
"jasmine": "2.4.1",
"protractor": "3.3.0",
"sync-exec": "0.6.2",
"q": "1.4.1",
"lodash": "4.15.0",
"node-fs": "0.1.7",
"grunt": "1.0.1",
"grunt-cli": "1.2.0",
"grunt-angular-templates": "1.1.0",
"requirejs": "2.2.0",
"grunt-contrib-requirejs": "1.0.0",
"htmlhint": "0.9.13",
"grunt-htmlhint": "0.9.13",
"mailparser": "0.6.1",
"ini": "1.3.4",
"node-sass": "3.8.0",
"grunt-sass": "1.2.1",
"grunt-sass-lint": "0.2.0"
}
}
output = ${buildout:directory}/package.json
mode = 700
[npms]
recipe = plone.recipe.command
command = ${buildout:bin-directory}/npm install
update-command = ${:command}
stop-on-error = yes
[npm_bins]
# npm doesn't seem to allow to specify the bin directory, so we link stuff manually.
recipe = plone.recipe.command
command =
cd ${buildout:bin-directory}
ln -sf ${buildout:directory}/node_modules/.bin/* .
update-command = ${:command}
stop-on-error = yes
[bower]
recipe = bowerrecipe
packages =
jquery#2.2.4
angular#1.5.8
angular-animate#1.5.8
angular-aria#1.5.8
angular-messages#1.5.8
angular-cache#4.6.0
angular-elastic#2.5.1
angular-scroll#1.0.0
angular-translate#2.11.1
angular-translate-loader-static-files#2.11.1
markdown-it#5.1.0
leaflet#0.7.7
leaflet.markercluster#v0.5.0
lodash#4.15.0
requirejs#2.2.0
requirejs-text#2.0.15
jasmine#2.4.1
blanket#1.1.7
q#1.4.1
moment#2.11.1
relatively-sticky#2.0.0
ng-flow#2.7.4
nidico/socialshareprivacy#392c61fef7b99b75dec90d16213c8c7a702d1809
webshim#1.15.10
lato#0.3.0
webfont-opensans#0.0.2
merriweather-fontface#f5fee770c034a92a3a551d52fcd34f210acf23d2
xi/sass-planifolia#0.3.1
executable = ${buildout:bin-directory}/node ${buildout:directory}/node_modules/.bin/bower --config.interactive=false
base-directory = ${adhocracy:frontend.static_dir}/lib
downloads = .
[AdhocracySpec.ts]
recipe = plone.recipe.command
command = cd ${adhocracy:frontend.static_dir}/js/ && ./AdhocracySpec.sh > AdhocracySpec.ts
update-command = ${:command}
stop-on-error = yes
[merge_static_directories]
recipe = collective.recipe.template
# Static directories to be merged. If a file exists in multiple directories
# the first one wins. Customizations should therefore be mentioned on top of
# core packages.
static_directories =
${adhocracy:frontend.core.static_dir}
inline =
#!/usr/bin/env python
""" Merge static directories of multiple packages.
Assumes that this script is in full control of all symlinks under
target_dir. If symlinks are manually set or created by other
scripts, they will be deleted.
"""
import os
import os.path
target_dir = "${adhocracy:frontend.static_dir}"
source_dirs = "${:static_directories}".split()
# remove old links from target dir
for target_root, dirnames, filenames in os.walk(target_dir):
for filename in filenames:
link_name = os.path.join(target_root, filename)
if os.path.islink(link_name):
os.unlink(link_name)
# set new symlinks
for source_dir in source_dirs:
for source_root, dirnames, filenames in os.walk(source_dir):
target_root = os.path.join(target_dir, os.path.relpath(source_root, source_dir))
if not os.path.exists(target_root):
os.makedirs(target_root)
elif not os.path.isdir(target_root):
raise Exception("unexpcted file {}".format(target_root))
for filename in filenames:
link_name = os.path.join(target_root, filename)
if os.path.exists(link_name):
continue
link_source = os.path.realpath(os.path.join(source_root, filename))
os.symlink(link_source, link_name)
output = ${buildout:bin-directory}/ad_merge_static_directories
mode = 700
[do_merge_static_directories]
recipe = plone.recipe.command
command =
${merge_static_directories:output}
update-command = ${do_merge_static_directories:command}
stop-on-error = yes
[meta_api]
# We save meta_api as a static file in order to use it in the resources part
# and deliver and cache it together with the static frontend resources.
recipe = plone.recipe.command
command =
${buildout:bin-directory}/prequest ${noserver.ini:output} /meta_api > ${:output}
update-command = ${:command}
output = ${adhocracy:frontend.static_dir}/meta_api.json
stop-on-error = yes
[resources]
recipe = plone.recipe.command
stop-on-error = True
command =
. ${source_env:output}
git ls-files --other ${:jsdir}/Resources_ | xargs rm -f
${buildout:bin-directory}/tsc --module commonjs --pretty ${:jsdir}/mkResources.ts
${buildout:bin-directory}/node ${:jsdir}/mkResources.js ${meta_api:output} ${:jsdir}
update-command = ${:command}
jsdir = ${adhocracy:frontend.static_dir}/js
stop-on-error = yes
[javascript]
recipe = plone.recipe.command
stop-on-error = True
command =
${buildout:bin-directory}/node ${buildout:bin-directory}/tsc -m umd --sourcemap --pretty ${adhocracy:frontend.static_dir}/js/Adhocracy*.ts
update-command = ${javascript:command}
[gruntfile]
recipe = collective.recipe.template
inline =
var sass = require("node-sass");
module.exports = function(grunt) {
grunt.initConfig({
ngtemplates: {
app: {
cwd: '${adhocracy:frontend.static_dir}',
src: 'js/**/**.html',
dest: '${adhocracy:frontend.static_dir}/js/templates.js',
options: {
prefix: '/static/',
bootstrap: function(module, script) {
return '\
define(["angular"], function (angular) {\
"use strict";\
var templates = angular.module("templates", []);\
templates.run(["$templateCache", function($templateCache) {\
' + script + '\
}]);\
return templates;\
});';
}
}
}
},
requirejs: {
compile: {
options: {
baseUrl: "${adhocracy:frontend.static_dir}/js",
paths: {
text: "empty:",
jquery: "empty:",
angular: "empty:",
angularAnimate: "empty:",
angularAria: "empty:",
"angular-cache": "empty:",
angularTranslate: "empty:",
angularTranslateLoader: "empty:",
angularElastic: "empty:",
angularScroll: "empty:",
angularFlow: "empty:",
angularMessages: "empty:",
angularPlaceholderShim: "empty:",
flow: "empty:",
lodash: "empty:",
q: "empty:",
modernizr: "empty:",
moment: "empty:",
leaflet: "empty:",
leafletMarkerCluster: "empty:",
markdownit: "empty:",
sticky: "empty:",
socialSharePrivacy: "empty:",
polyfiller: "empty:",
adhTemplates: "./templates"
},
name: "Adhocracy",
out: "${adhocracy:frontend.static_dir}/js/Adhocracy.min.js"
}
}
},
htmlhint: {
options: {
"tagname-lowercase": true,
"attr-lowercase": true,
"attr-value-double-quotes": true,
"tag-pair": true,
"id-unique": true,
"attr-no-duplication": true,
"img-alt-require": true,
"style-disabled": true
},
src: ["${adhocracy:frontend.static_dir}/js/**/*.html"]
},
sass: {
options: {
sourceMap: true,
outputStyle: "compressed",
functions: {
"cachebust": function() {
return new sass.types.String("" + Date.now());
}
}
},
dist: {
files: {
"src/current/current/build/stylesheets/a3.css": "src/current/current/build/stylesheets/scss/a3.scss"
}
}
},
sasslint: {
target: ["src/current/current/build/stylesheets/scss/**/*.scss"]
}
});
grunt.loadNpmTasks('grunt-angular-templates');
grunt.loadNpmTasks('grunt-contrib-requirejs');
grunt.loadNpmTasks('grunt-htmlhint');
grunt.loadNpmTasks('grunt-sass');
grunt.loadNpmTasks('grunt-sass-lint');
grunt.registerTask('default', ['ngtemplates', 'requirejs']);
};
output = ${buildout:directory}/Gruntfile.js
mode = 644
[grunt]
recipe = plone.recipe.command
command =
. ${source_env:output}
${buildout:bin-directory}/grunt
update-command = ${grunt:command}
stop-on-error = yes
[rubygems]
recipe = rubygemsrecipe
gems =
hologram==1.4.0
[frontend.current.link]
recipe = plone.recipe.command
command =
ln -sfn ${buildout:directory}/src/${adhocracy:frontend_package_name} ${buildout:directory}/src/current
ln -sfn ${buildout:directory}/src/${adhocracy:frontend_package_name}/${adhocracy:frontend_package_name} ${buildout:directory}/src/current/current
stop-on-error = yes
[frontend.scripts]
recipe = plone.recipe.command
command =
ln -sfn ${buildout:directory}/src/adhocracy_frontend/adhocracy_frontend/scripts/all_styleguides.sh ${buildout:bin-directory}/ad_all_styleguides
ln -sfn ${buildout:directory}/src/adhocracy_frontend/adhocracy_frontend/scripts/extract_messages.sh ${buildout:bin-directory}/ad_extract_messages
stop-on-error = yes
[stylesheets]
recipe = plone.recipe.command
command =
. ${source_env:output}
${buildout:bin-directory}/grunt sass
update-command = ${stylesheets:command}
stop-on-error = yes
[hologram]
recipe = collective.recipe.template
inline =
# Hologram will run from same directory where this config file resides
# All paths should be relative to there
# The directory containing the source files to parse recursively
source: ${buildout:directory}/${adhocracy:frontend.static_dir}/stylesheets/scss
# The directory that hologram will build to
destination: ${buildout:directory}/${adhocracy:frontend.static_dir}/styleguide
# The assets needed to build the docs (includes header.html,
# footer.html, etc)
# You may put doc related assets here too: images, css, etc.
documentation_assets: ../docs/styleguide_assets
# Any other asset folders that need to be copied to the destination
# folder. Typically this will include the css that you are trying to
# document. May also include additional folders as needed.
dependencies:
# Mark which category should be the index page
# Alternatively, you may have an index.md in the documenatation assets
# folder instead of specifying this configu.
index: base
output = ${buildout:directory}/etc/hologram.yml
mode = 644
[styleguide]
recipe = plone.recipe.command
command =
${buildout:bin-directory}/hologram ${hologram:output}
update-command = ${styleguide:command}
stop-on-error = yes