qa-control 0.5.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/bin/{0.3.0 → definition}/definition.js +688 -764
- package/bin/{0.3.0 → definition}/first-lines-both.txt +25 -25
- package/bin/definition/first-lines-client.txt +3 -0
- package/bin/{0.3.0 → definition}/first-lines-server-app.txt +2 -2
- package/bin/{0.3.0 → definition}/first-lines-server-cmd-tool.txt +2 -2
- package/bin/{0.3.0 → definition}/first-lines-server.txt +3 -3
- package/bin/definition/first-lines-web.txt +3 -0
- package/bin/qa-control.js +17 -42
- package/bin/qac-init.js +0 -18
- package/package.json +1 -1
- package/bin/0.0.1/definition.js +0 -556
- package/bin/0.0.1/first-lines-both.txt +0 -28
- package/bin/0.0.1/first-lines-client.txt +0 -6
- package/bin/0.0.1/first-lines-server-app.txt +0 -6
- package/bin/0.0.1/first-lines-server.txt +0 -6
- package/bin/0.0.2/definition.js +0 -577
- package/bin/0.0.2/first-lines-both.txt +0 -28
- package/bin/0.0.2/first-lines-client.txt +0 -6
- package/bin/0.0.2/first-lines-server-app.txt +0 -6
- package/bin/0.0.2/first-lines-server.txt +0 -6
- package/bin/0.1.3/definition.js +0 -653
- package/bin/0.1.3/first-lines-both.txt +0 -28
- package/bin/0.1.3/first-lines-client.txt +0 -6
- package/bin/0.1.3/first-lines-server-app.txt +0 -7
- package/bin/0.1.3/first-lines-server.txt +0 -7
- package/bin/0.1.4/definition.js +0 -706
- package/bin/0.1.4/first-lines-both.txt +0 -28
- package/bin/0.1.4/first-lines-client.txt +0 -6
- package/bin/0.1.4/first-lines-server-app.txt +0 -7
- package/bin/0.1.4/first-lines-server.txt +0 -7
- package/bin/0.2.0/definition.js +0 -771
- package/bin/0.2.0/first-lines-both.txt +0 -27
- package/bin/0.2.0/first-lines-client.txt +0 -5
- package/bin/0.2.0/first-lines-server-app.txt +0 -6
- package/bin/0.2.0/first-lines-server-cmd-tool.txt +0 -6
- package/bin/0.2.0/first-lines-server.txt +0 -6
- package/bin/0.3.0/first-lines-client.txt +0 -3
- package/bin/0.3.0/first-lines-web.txt +0 -3
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
(function codenautasModuleDefinition(root, name, factory) {
|
|
4
|
-
/* global define */
|
|
5
|
-
/* istanbul ignore next */
|
|
6
|
-
if(typeof root.globalModuleName !== 'string'){
|
|
7
|
-
root.globalModuleName = name;
|
|
8
|
-
}
|
|
9
|
-
/* istanbul ignore next */
|
|
10
|
-
if(typeof exports === 'object' && typeof module === 'object'){
|
|
11
|
-
module.exports = factory();
|
|
12
|
-
}else if(typeof define === 'function' && define.amd){
|
|
13
|
-
define(factory);
|
|
14
|
-
}else if(typeof exports === 'object'){
|
|
15
|
-
exports[root.globalModuleName] = factory();
|
|
16
|
-
}else{
|
|
17
|
-
root[root.globalModuleName] = factory();
|
|
18
|
-
}
|
|
19
|
-
root.globalModuleName = null;
|
|
20
|
-
})(/*jshint -W040 */this, 'nombreDelModulo', function() {
|
|
21
|
-
/*jshint +W040 */
|
|
22
|
-
|
|
23
|
-
/*jshint -W004 */
|
|
24
|
-
var nombreDelModulo = {};
|
|
25
|
-
/*jshint +W004 */
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
(function codenautasModuleDefinition(root, name, factory) {
|
|
4
|
+
/* global define */
|
|
5
|
+
/* istanbul ignore next */
|
|
6
|
+
if(typeof root.globalModuleName !== 'string'){
|
|
7
|
+
root.globalModuleName = name;
|
|
8
|
+
}
|
|
9
|
+
/* istanbul ignore next */
|
|
10
|
+
if(typeof exports === 'object' && typeof module === 'object'){
|
|
11
|
+
module.exports = factory();
|
|
12
|
+
}else if(typeof define === 'function' && define.amd){
|
|
13
|
+
define(factory);
|
|
14
|
+
}else if(typeof exports === 'object'){
|
|
15
|
+
exports[root.globalModuleName] = factory();
|
|
16
|
+
}else{
|
|
17
|
+
root[root.globalModuleName] = factory();
|
|
18
|
+
}
|
|
19
|
+
root.globalModuleName = null;
|
|
20
|
+
})(/*jshint -W040 */this, 'nombreDelModulo', function() {
|
|
21
|
+
/*jshint +W040 */
|
|
22
|
+
|
|
23
|
+
/*jshint -W004 */
|
|
24
|
+
var nombreDelModulo = {};
|
|
25
|
+
/*jshint +W004 */
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
3
|
// APP
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
3
|
// CMD-TOOL
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var nombreDelModulo = {};
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var nombreDelModulo = {};
|
package/bin/qa-control.js
CHANGED
|
@@ -25,14 +25,10 @@ function forEach(obj, func) {
|
|
|
25
25
|
|
|
26
26
|
qaControl.msgs={
|
|
27
27
|
en:{
|
|
28
|
-
deprecated_qa_control_version: 'deprecated qa-control version',
|
|
29
28
|
repository_name_not_found: 'packageJson.repository must be in format /{[-a-zA-Z0-9_.]+}\/[-a-zA-Z0-9_.]+/'
|
|
30
29
|
},
|
|
31
30
|
es:{
|
|
32
|
-
no_test_in_last_node: 'falta probar para la última versión de node .travis.yaml',
|
|
33
|
-
deprecated_qa_control_version: 'la versión de qa-control es vieja',
|
|
34
31
|
deprecated_version: 'la version es demasiado vieja',
|
|
35
|
-
invalid_qa_control_version: 'la sección "package-version" en qa-control contiene un valor incorrecto',
|
|
36
32
|
invalid_value_1_in_parameter_2: 'valor invalido "$1" para el parametro "$2" en la sección qa-control',
|
|
37
33
|
lack_of_mandatory_file_1: 'falta el archivo obligatorio "$1"',
|
|
38
34
|
//lack_of_mandatory_parameter_1: 'falta el parámetro obligatorio "$1"',
|
|
@@ -40,13 +36,12 @@ qaControl.msgs={
|
|
|
40
36
|
no_qa_control_section_in_codenautas_project: 'falta la sección "qa-control" en package.json y aparenta ser un proyecto codenautas',
|
|
41
37
|
no_multilang_section_in_1: 'falta la sección multilang en el archivo $1',
|
|
42
38
|
no_package_json: 'falta el archivo package.json',
|
|
43
|
-
no_package_version_in_qa_control_section: 'falta la sección "package-version" en la sección qa-control',
|
|
44
39
|
no_qa_control_section_in_package_json: 'falta la sección qa-control en package.json',
|
|
45
|
-
no_version_in_section_codenautas: 'falta la entrada para "package-version" en la sección codenautas del package.json',
|
|
46
40
|
//unparseable_package_json: 'existe package.json pero no puede parsearse',
|
|
47
41
|
lack_of_cucarda_marker_in_readme:'falta la sección "cucardas" en README.md',
|
|
48
42
|
lack_of_mandatory_cucarda_1: 'falta la cucarda oblicatoria $1',
|
|
49
43
|
wrong_format_in_cucarda_1: 'la cucarda "$1" tiene formato incorrecto',
|
|
44
|
+
forbidden_cucarda_1: 'la cucarda "$1" no debe usarse en README.md',
|
|
50
45
|
lack_of_mandatory_line_1_in_file_2: 'falta la linea obligatoria $1 en el archivo $2',
|
|
51
46
|
file_1_does_not_match_custom_2: '$1 no respeta la custombre $2',
|
|
52
47
|
first_lines_does_not_match_in_file_1: 'las primeras líneas no coinciden en $1',
|
|
@@ -65,10 +60,7 @@ qaControl.msgs={
|
|
|
65
60
|
lack_of_files_section_in_package_json: 'Falta la sección "files" en package.json',
|
|
66
61
|
invalid_files_section_in_package_json: 'La sección "files" en package.json es inválida',
|
|
67
62
|
incorrect_ecmascript_versions_in_package_json: 'Las versiones de ECMAScript utilizadas en package.json son incorrectas',
|
|
68
|
-
older_version_of_qa_control_in_package_json: 'La versión de qa-control en el package.json es vieja',
|
|
69
63
|
unexpected_jshintconfig_section_in_package_json: 'No se esperaba la sección jshintConfig en package.json',
|
|
70
|
-
lack_of_travis_check_for_node_version_1: 'Falta el checkeo de node versión $1 en .travis.yml',
|
|
71
|
-
not_allowed_travis_failure_for_node_version_1: 'No se permite la falla de node versión $1 en .travis.yml',
|
|
72
64
|
non_recomended_dependency_1_in_package_json: 'Dependencia no recomendada "$1" en package.json'
|
|
73
65
|
}
|
|
74
66
|
};
|
|
@@ -129,6 +121,7 @@ qaControl.generateCucardas = function generateCucardas(cucardas, packageJson) {
|
|
|
129
121
|
/*eslint-disable guard-for-in */
|
|
130
122
|
for(var nombreCucarda in cucardas) {
|
|
131
123
|
var cucarda = cucardas[nombreCucarda];
|
|
124
|
+
if(cucarda.forbidden) { continue; }
|
|
132
125
|
if(!cucarda.check || cucarda.check(packageJson)) {
|
|
133
126
|
var cucaStr = cucarda.md.replace(/\bxxx\b/g,repo).replace(/\byyy\b/g,modulo);
|
|
134
127
|
cucaFileContent += cucaStr +'\n';
|
|
@@ -186,20 +179,12 @@ qaControl.nodeVerInTravisRE = /[678]/;
|
|
|
186
179
|
|
|
187
180
|
qaControl.verbose = false;
|
|
188
181
|
qaControl.cucardas_always = false;
|
|
189
|
-
qaControl.
|
|
190
|
-
qaControl.projectDefinition['0.0.1'] = require("./0.0.1/definition.js")(qaControl);
|
|
191
|
-
qaControl.projectDefinition['0.0.2'] = require("./0.0.2/definition.js")(qaControl);
|
|
192
|
-
qaControl.projectDefinition['0.1.3'] = require("./0.1.3/definition.js")(qaControl);
|
|
193
|
-
qaControl.projectDefinition['0.1.4'] = require("./0.1.4/definition.js")(qaControl);
|
|
194
|
-
qaControl.projectDefinition['0.2.0'] = require("./0.2.0/definition.js")(qaControl);
|
|
195
|
-
qaControl.projectDefinition['0.3.0'] = require("./0.3.0/definition.js")(qaControl);
|
|
182
|
+
qaControl.definition = require("./definition/definition.js")(qaControl);
|
|
196
183
|
|
|
197
184
|
qaControl.lang = process.env.qa_control_lang || 'en';
|
|
198
|
-
qaControl.deprecatedVersions = '< 0.0.1';
|
|
199
|
-
qaControl.currentVersion = '0.3.0';
|
|
200
185
|
|
|
201
186
|
qaControl.mainDoc = function mainDoc() {
|
|
202
|
-
return qaControl.
|
|
187
|
+
return qaControl.definition.fileNameMainDoc;
|
|
203
188
|
};
|
|
204
189
|
|
|
205
190
|
qaControl.fixMessages = function fixMessages(messagesToFix) {
|
|
@@ -226,22 +211,23 @@ qaControl.jsProjectName = function jsProjectName(projectName) {
|
|
|
226
211
|
};
|
|
227
212
|
|
|
228
213
|
qaControl.configReady=false;
|
|
229
|
-
var configReading=
|
|
214
|
+
var configReading=(function(){
|
|
215
|
+
var definition = qaControl.definition;
|
|
230
216
|
definition.firstLines=definition.firstLines||{};
|
|
231
217
|
return Promise.all(map(definition.sections['run-in'].values,function(runInProperties, runInValue){
|
|
232
218
|
return Promise.all(map(definition.sections.type.values,function(typeProperties, typeValue){
|
|
233
|
-
return fs.readFile(Path.join(__dirname,
|
|
219
|
+
return fs.readFile(Path.join(__dirname,'definition','first-lines-'+runInValue+'-'+typeValue+'.txt'),{encoding: 'utf8'}).catch(function(err){
|
|
234
220
|
if(err.code!=='ENOENT'){
|
|
235
221
|
throw err;
|
|
236
222
|
}
|
|
237
|
-
return fs.readFile(Path.join(__dirname,
|
|
223
|
+
return fs.readFile(Path.join(__dirname,'definition','first-lines-'+runInValue+'.txt'),{encoding: 'utf8'});
|
|
238
224
|
}).then(function(content){
|
|
239
225
|
definition.firstLines[runInValue]=definition.firstLines[runInValue]||{};
|
|
240
226
|
definition.firstLines[runInValue][typeValue]=content;
|
|
241
227
|
});
|
|
242
228
|
}));
|
|
243
229
|
}));
|
|
244
|
-
})).then(function(){
|
|
230
|
+
})().then(function(){
|
|
245
231
|
return qaControl.fixMessages(qaControl.msgs.en);
|
|
246
232
|
}).then(function(){
|
|
247
233
|
// only for test, in production this sleep must gone
|
|
@@ -275,6 +261,7 @@ qaControl.loadProject = function loadProject(projectDir) {
|
|
|
275
261
|
return fs.readdir(projectDir);
|
|
276
262
|
}).then(function(files) {
|
|
277
263
|
info.files = {};
|
|
264
|
+
files = files.filter(function(f){ return f !== 'cucardas.log'; });
|
|
278
265
|
/*jshint forin: false */
|
|
279
266
|
/*eslint-disable guard-for-in */
|
|
280
267
|
for(var f in files) { info.files[files[f]] = {}; }
|
|
@@ -321,18 +308,8 @@ qaControl.loadProject = function loadProject(projectDir) {
|
|
|
321
308
|
});
|
|
322
309
|
}
|
|
323
310
|
}
|
|
324
|
-
}).then(function() {
|
|
325
|
-
if(info.files['.travis.yml']){
|
|
326
|
-
info.dotTravis = yaml.load(info.files['.travis.yml'].content);
|
|
327
|
-
}
|
|
328
311
|
});
|
|
329
312
|
}).then(function() {
|
|
330
|
-
var verCheck = ((info.packageJson || {})['qa-control'] || {})['package-version'];
|
|
331
|
-
//console.log("verCheck", verCheck)
|
|
332
|
-
if(verCheck && ! (verCheck in qaControl.projectDefinition)) {
|
|
333
|
-
throw new Error("inexistent qa-control version: "+verCheck);
|
|
334
|
-
}
|
|
335
|
-
info.usedDefinition = (verCheck in qaControl.projectDefinition) ? verCheck : qaControl.currentVersion;
|
|
336
313
|
return info;
|
|
337
314
|
});
|
|
338
315
|
};
|
|
@@ -341,8 +318,8 @@ qaControl.controlInfo=function controlInfo(info, opts){
|
|
|
341
318
|
var resultWarnings=[];
|
|
342
319
|
var existingWarnings={};
|
|
343
320
|
var cmsgs = qaControl.cmdMsgs[qaControl.lang];
|
|
344
|
-
var rules = qaControl.
|
|
345
|
-
|
|
321
|
+
var rules = qaControl.definition.rules;
|
|
322
|
+
var silenced = ((info.packageJson || {})['qa-control'] || {}).silenced || [];
|
|
346
323
|
var cadenaDePromesas = Promise.resolve().then();
|
|
347
324
|
info.scoring = opts && opts.scoring;
|
|
348
325
|
forEach(rules, function(rule, ruleName) {
|
|
@@ -354,10 +331,11 @@ qaControl.controlInfo=function controlInfo(info, opts){
|
|
|
354
331
|
if(qaControl.verbose) { process.stdout.write(cmsgs.msg_checking+" '"+ruleName+"'...\n"); }
|
|
355
332
|
return checkInfo.warnings(info);
|
|
356
333
|
}).then(function(warningsOfThisRule) {
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
334
|
+
var activeWarnings = warningsOfThisRule.filter(function(w){ return silenced.indexOf(w.warning) === -1; });
|
|
335
|
+
if(activeWarnings.length) {
|
|
336
|
+
resultWarnings=resultWarnings.concat(activeWarnings);
|
|
337
|
+
activeWarnings.forEach(function(warning){
|
|
338
|
+
existingWarnings[warning.warning]=true;
|
|
361
339
|
});
|
|
362
340
|
if(rule.shouldAbort) { throw new Error("ruleIsAborting"); }
|
|
363
341
|
}
|
|
@@ -370,9 +348,6 @@ qaControl.controlInfo=function controlInfo(info, opts){
|
|
|
370
348
|
throw err;
|
|
371
349
|
}
|
|
372
350
|
}).then(function(){
|
|
373
|
-
if(info.usedDefinition !== qaControl.currentVersion) {
|
|
374
|
-
resultWarnings.push({warning:'older_version_of_qa_control_in_package_json', scoring:{notice:1}});
|
|
375
|
-
}
|
|
376
351
|
return resultWarnings;
|
|
377
352
|
});
|
|
378
353
|
return cadenaDePromesas;
|
package/bin/qac-init.js
CHANGED
|
@@ -282,24 +282,6 @@ qacInit.configParams = [
|
|
|
282
282
|
name:'jshintConfig', def:'', noPrompt:true, init: function(ctx) { this.def = ctx.input.qacJson['jshintConfig']; }
|
|
283
283
|
},{
|
|
284
284
|
name:'eslintConfig', def:'', noPrompt:true, init: function(ctx) { this.def = ctx.input.qacJson['eslintConfig']; }
|
|
285
|
-
},{
|
|
286
|
-
name:'qa-control-version', prompt: 'qa-control package-version', def:'',
|
|
287
|
-
init: function(ctx) { this.def = ctx.input.qacJson['qa-control']['package-version']; },
|
|
288
|
-
post: function(ctx) {
|
|
289
|
-
var contributors = ctx.input.existingJson.contributors || [];
|
|
290
|
-
var ver = ctx.result[this.name];
|
|
291
|
-
var qacData = ctx.input.qacJson['qa-control'];
|
|
292
|
-
qacData['package-version'] = ver;
|
|
293
|
-
return ver;
|
|
294
|
-
},
|
|
295
|
-
valid: function(ver) {
|
|
296
|
-
if(semver.valid(ver)) {
|
|
297
|
-
for(var v in qaControl.projectDefinition) {
|
|
298
|
-
if(semver.satisfies(ver, v)) { return true; }
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
return false;
|
|
302
|
-
}
|
|
303
285
|
},{
|
|
304
286
|
name:'qa-control', def:'', noPrompt:true, init: function(ctx) { this.def = ctx.input.qacJson['qa-control']; }
|
|
305
287
|
}
|
package/package.json
CHANGED