qa-control 0.5.0 → 0.6.0
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 +1 -1
- package/bin/{0.3.0 → definition}/definition.js +680 -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 +15 -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,9 +36,7 @@ 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',
|
|
@@ -65,10 +59,7 @@ qaControl.msgs={
|
|
|
65
59
|
lack_of_files_section_in_package_json: 'Falta la sección "files" en package.json',
|
|
66
60
|
invalid_files_section_in_package_json: 'La sección "files" en package.json es inválida',
|
|
67
61
|
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
62
|
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
63
|
non_recomended_dependency_1_in_package_json: 'Dependencia no recomendada "$1" en package.json'
|
|
73
64
|
}
|
|
74
65
|
};
|
|
@@ -186,20 +177,12 @@ qaControl.nodeVerInTravisRE = /[678]/;
|
|
|
186
177
|
|
|
187
178
|
qaControl.verbose = false;
|
|
188
179
|
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);
|
|
180
|
+
qaControl.definition = require("./definition/definition.js")(qaControl);
|
|
196
181
|
|
|
197
182
|
qaControl.lang = process.env.qa_control_lang || 'en';
|
|
198
|
-
qaControl.deprecatedVersions = '< 0.0.1';
|
|
199
|
-
qaControl.currentVersion = '0.3.0';
|
|
200
183
|
|
|
201
184
|
qaControl.mainDoc = function mainDoc() {
|
|
202
|
-
return qaControl.
|
|
185
|
+
return qaControl.definition.fileNameMainDoc;
|
|
203
186
|
};
|
|
204
187
|
|
|
205
188
|
qaControl.fixMessages = function fixMessages(messagesToFix) {
|
|
@@ -226,22 +209,23 @@ qaControl.jsProjectName = function jsProjectName(projectName) {
|
|
|
226
209
|
};
|
|
227
210
|
|
|
228
211
|
qaControl.configReady=false;
|
|
229
|
-
var configReading=
|
|
212
|
+
var configReading=(function(){
|
|
213
|
+
var definition = qaControl.definition;
|
|
230
214
|
definition.firstLines=definition.firstLines||{};
|
|
231
215
|
return Promise.all(map(definition.sections['run-in'].values,function(runInProperties, runInValue){
|
|
232
216
|
return Promise.all(map(definition.sections.type.values,function(typeProperties, typeValue){
|
|
233
|
-
return fs.readFile(Path.join(__dirname,
|
|
217
|
+
return fs.readFile(Path.join(__dirname,'definition','first-lines-'+runInValue+'-'+typeValue+'.txt'),{encoding: 'utf8'}).catch(function(err){
|
|
234
218
|
if(err.code!=='ENOENT'){
|
|
235
219
|
throw err;
|
|
236
220
|
}
|
|
237
|
-
return fs.readFile(Path.join(__dirname,
|
|
221
|
+
return fs.readFile(Path.join(__dirname,'definition','first-lines-'+runInValue+'.txt'),{encoding: 'utf8'});
|
|
238
222
|
}).then(function(content){
|
|
239
223
|
definition.firstLines[runInValue]=definition.firstLines[runInValue]||{};
|
|
240
224
|
definition.firstLines[runInValue][typeValue]=content;
|
|
241
225
|
});
|
|
242
226
|
}));
|
|
243
227
|
}));
|
|
244
|
-
})).then(function(){
|
|
228
|
+
})().then(function(){
|
|
245
229
|
return qaControl.fixMessages(qaControl.msgs.en);
|
|
246
230
|
}).then(function(){
|
|
247
231
|
// only for test, in production this sleep must gone
|
|
@@ -275,6 +259,7 @@ qaControl.loadProject = function loadProject(projectDir) {
|
|
|
275
259
|
return fs.readdir(projectDir);
|
|
276
260
|
}).then(function(files) {
|
|
277
261
|
info.files = {};
|
|
262
|
+
files = files.filter(function(f){ return f !== 'cucardas.log'; });
|
|
278
263
|
/*jshint forin: false */
|
|
279
264
|
/*eslint-disable guard-for-in */
|
|
280
265
|
for(var f in files) { info.files[files[f]] = {}; }
|
|
@@ -321,18 +306,8 @@ qaControl.loadProject = function loadProject(projectDir) {
|
|
|
321
306
|
});
|
|
322
307
|
}
|
|
323
308
|
}
|
|
324
|
-
}).then(function() {
|
|
325
|
-
if(info.files['.travis.yml']){
|
|
326
|
-
info.dotTravis = yaml.load(info.files['.travis.yml'].content);
|
|
327
|
-
}
|
|
328
309
|
});
|
|
329
310
|
}).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
311
|
return info;
|
|
337
312
|
});
|
|
338
313
|
};
|
|
@@ -341,8 +316,8 @@ qaControl.controlInfo=function controlInfo(info, opts){
|
|
|
341
316
|
var resultWarnings=[];
|
|
342
317
|
var existingWarnings={};
|
|
343
318
|
var cmsgs = qaControl.cmdMsgs[qaControl.lang];
|
|
344
|
-
var rules = qaControl.
|
|
345
|
-
|
|
319
|
+
var rules = qaControl.definition.rules;
|
|
320
|
+
var silenced = ((info.packageJson || {})['qa-control'] || {}).silenced || [];
|
|
346
321
|
var cadenaDePromesas = Promise.resolve().then();
|
|
347
322
|
info.scoring = opts && opts.scoring;
|
|
348
323
|
forEach(rules, function(rule, ruleName) {
|
|
@@ -354,10 +329,11 @@ qaControl.controlInfo=function controlInfo(info, opts){
|
|
|
354
329
|
if(qaControl.verbose) { process.stdout.write(cmsgs.msg_checking+" '"+ruleName+"'...\n"); }
|
|
355
330
|
return checkInfo.warnings(info);
|
|
356
331
|
}).then(function(warningsOfThisRule) {
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
332
|
+
var activeWarnings = warningsOfThisRule.filter(function(w){ return silenced.indexOf(w.warning) === -1; });
|
|
333
|
+
if(activeWarnings.length) {
|
|
334
|
+
resultWarnings=resultWarnings.concat(activeWarnings);
|
|
335
|
+
activeWarnings.forEach(function(warning){
|
|
336
|
+
existingWarnings[warning.warning]=true;
|
|
361
337
|
});
|
|
362
338
|
if(rule.shouldAbort) { throw new Error("ruleIsAborting"); }
|
|
363
339
|
}
|
|
@@ -370,9 +346,6 @@ qaControl.controlInfo=function controlInfo(info, opts){
|
|
|
370
346
|
throw err;
|
|
371
347
|
}
|
|
372
348
|
}).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
349
|
return resultWarnings;
|
|
377
350
|
});
|
|
378
351
|
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