qa-control 0.6.8 → 0.6.11

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.
@@ -0,0 +1,11 @@
1
+ name: Build and test
2
+
3
+ on:
4
+ push:
5
+ branches: [master]
6
+ pull_request:
7
+ branches: [master]
8
+
9
+ jobs:
10
+ ci:
11
+ uses: codenautas/.github/.github/workflows/node-build-and-test.yaml@v1
@@ -0,0 +1,16 @@
1
+ name: Publish from Tag
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - 'v[0-9]+.[0-9]*'
7
+
8
+ permissions:
9
+ id-token: write
10
+ contents: read
11
+
12
+ jobs:
13
+ publish:
14
+ uses: codenautas/.github/.github/workflows/npm-publish-from-tag.yaml@v1
15
+ with:
16
+ node_version: '24'
@@ -0,0 +1,11 @@
1
+ name: QA control
2
+
3
+ on:
4
+ push:
5
+ branches: [master]
6
+ pull_request:
7
+ branches: [master]
8
+
9
+ jobs:
10
+ qa:
11
+ uses: codenautas/.github/.github/workflows/qa-control.yaml@v1
@@ -36,6 +36,68 @@ function softRegExp(realRegex) {
36
36
  return new RegExp(re, 'im');
37
37
  }
38
38
 
39
+ /**
40
+ *
41
+ * @param {string} tagText
42
+ * @param {string} colour
43
+ * @param {string|null} [label]
44
+ * @returns
45
+ */
46
+ function stabilityCucarda(tagText, colour, label){
47
+
48
+ return '!['+tagText+'](https://img.shields.io/badge/stability-'+encodeURIComponent(label || tagText)+'-'+colour+'.svg)';
49
+ /*
50
+ var colour = 'red';
51
+ if(/^rc/i.test(lqa)) { colour = 'yellow'; }
52
+ else if(/beta/i.test(lqa)) { colour = 'orange'; }
53
+ var badge =
54
+ cucaFileContent += badge + '\n';
55
+ return cucaFileContent;
56
+ */
57
+ }
58
+
59
+ function cucardaDefinition(colour, tag, type, opts){
60
+ function theTag(packageJson){
61
+ var qaTag = semver.prerelease(packageJson.version)?.[0];
62
+ if(qaTag) {
63
+ var tagText = String(qaTag);
64
+ var lqa = tagText.toLowerCase();
65
+ return lqa;
66
+ }
67
+ return '';
68
+ }
69
+ switch (type) {
70
+ case 'purpose':
71
+ return {
72
+ check: function(packageJson) {
73
+ return packageJson?.['qa-control']?.purpose === tag
74
+ },
75
+ md:'![proof-of-concept](https://img.shields.io/badge/stability-' + (opts||tag) + '-' + colour + '.svg)'
76
+ }
77
+ case 'tag':
78
+ return {
79
+ check: function(packageJson) {
80
+ return !packageJson?.['qa-control']?.purpose &&
81
+ (theTag(packageJson) == tag || tag == 'unkown-tag' && !theTag(packageJson).match(/^(rc|beta|alpha)$/i));
82
+ },
83
+ md: stabilityCucarda(tag, colour, tag)
84
+ }
85
+ case 'version':
86
+ return {
87
+ check: function(packageJson) {
88
+ return !packageJson?.['qa-control']?.purpose && !theTag(packageJson) &&
89
+ semver.satisfies(packageJson.version, opts);
90
+ },
91
+ md: stabilityCucarda(tag, colour, tag)
92
+ }
93
+ default:
94
+ throw new Error('Cucarda mal definida: '+JSON.stringify(arguments))
95
+ }
96
+ }
97
+
98
+ // If package sets an explicit tag in qa-control or top-level tag, use it
99
+
100
+
39
101
  /**
40
102
  * @param {object} qaControl
41
103
  * @returns {QADefinition}
@@ -76,52 +138,15 @@ module.exports = function(qaControl){
76
138
  '.eslintrc.yml':{ presentIf: function(pj) { return pj['qa-control'] && pj['qa-control'].profile !== 'minimum'; } }
77
139
  },
78
140
  cucardas:{
79
- 'proof-of-concept':{
80
- check: function(packageJson){
81
- return packageJson?.['qa-control']?.purpose==='proof-of-concept';
82
- },
83
- md:'![proof-of-concept](https://img.shields.io/badge/stability-proof_of_concept-ff70c0.svg)',
84
- imgExample:'https://img.shields.io/badge/stability-designing-red.svg'
85
- },
86
- designing:{
87
- check: function(packageJson){
88
- return semver.satisfies(packageJson.version,'0.0.x') && !packageJson?.['qa-control']?.purpose;
89
- },
90
- md:'![designing](https://img.shields.io/badge/stability-designing-red.svg)',
91
- imgExample:'https://img.shields.io/badge/stability-designing-red.svg',
92
- docDescription: 'opt. manual'
93
- },
94
- extending:{
95
- check: function(packageJson){
96
- return semver.satisfies(packageJson.version,'0.x.x') &&
97
- !semver.satisfies(packageJson.version,'0.0.x') &&
98
- !packageJson?.['qa-control'].purpose;
99
- },
100
- md:'![extending](https://img.shields.io/badge/stability-extending-orange.svg)',
101
- imgExample:'https://img.shields.io/badge/stability-extending-orange.svg',
102
- docDescription: 'opt. manual'
103
- },
104
- training:{
105
- check: function(packageJson){
106
- return packageJson?.['qa-control']?.purpose==='training';
107
- },
108
- md:'![training](https://img.shields.io/badge/stability-training-ffa0c0.svg)',
109
- imgExample:'https://img.shields.io/badge/stability-training-ffa0c0.svg'
110
- },
111
- example:{
112
- check: function(packageJson){
113
- return packageJson?.['qa-control']?.purpose==='example';
114
- },
115
- md:'![example](https://img.shields.io/badge/stability-example-a0a0f0.svg)',
116
- imgExample:'https://img.shields.io/badge/stability-example-a0a0f0.svg'
117
- },
118
- stable:{
119
- check: function(packageJson){
120
- return semver.satisfies(packageJson.version,'>=1.0.0') && !packageJson?.['qa-control']?.purpose;
121
- },
122
- md:'![stable](https://img.shields.io/badge/stability-stable-blue.svg)',
123
- imgExample:'https://img.shields.io/badge/stability-stable-blue.svg'
124
- },
141
+ 'proof-of-concept': cucardaDefinition('ff70c0', 'proof-of-concept', 'purpose', 'proof_of_concept'),
142
+ rc: cucardaDefinition('yellow', 'rc', 'tag'),
143
+ beta: cucardaDefinition('orange', 'beta', 'tag'),
144
+ alpha: cucardaDefinition('red', 'alpha', 'tag'),
145
+ designing: cucardaDefinition('red', 'designing', 'version', '~0.0.0'),
146
+ extending: cucardaDefinition('orange', 'extending', 'version', '>=0.1.0 <1.0.0'),
147
+ stable: cucardaDefinition('blue', 'stable', 'version', '>=1.0.0'),
148
+ training: cucardaDefinition('ffa0c0', 'training', 'purpose'),
149
+ example: cucardaDefinition('a0a0f0', 'example', 'purpose'),
125
150
  'npm-version':{
126
151
  mandatory:true,
127
152
  md:'[![npm-version](https://img.shields.io/npm/v/yyy.svg)](https://npmjs.org/package/yyy)',
@@ -382,7 +407,11 @@ module.exports = function(qaControl){
382
407
  /*jshint forin: false */
383
408
  for(var nombreCucarda in cucardas) {
384
409
  var cucarda = cucardas[nombreCucarda];
385
- var cucaID = cucarda.forbidden ? '!['+nombreCucarda+']' : '!['+/!\[([-a-z]+)]/.exec(cucarda.md)[1]+']';
410
+ try{
411
+ var cucaID = cucarda.forbidden ? '!['+nombreCucarda+']' : '!['+/!\[([-a-z]+)]/.exec(cucarda.md)[1]+']';
412
+ }catch(err){
413
+ console.log('######################################', cucarda, err)
414
+ }
386
415
  var cucaStr = cucarda.md ? cucarda.md.replace(/\bxxx\b/g,repo).replace(/\byyy\b/g,modulo) : '';
387
416
  if(cucarda.forbidden) {
388
417
  if(readme.indexOf(cucaID) !== -1) {
package/bin/qa-control.js CHANGED
@@ -121,6 +121,8 @@ qaControl.getRepositoryUrl = function getRepositoryUrl(packageJson) {
121
121
  qaControl.cucaMarker = '<!-- cucardas -->';
122
122
  qaControl.generateCucardas = function generateCucardas(cucardas, packageJson) {
123
123
  var cucaFileContent = qaControl.cucaMarker+'\n';
124
+ /** @type {{tag:string|null}} */
125
+ var info = { tag: null }
124
126
  var modulo=packageJson.name;
125
127
  var repo=qaControl.getRepositoryUrl(packageJson).replace('/'+modulo,'');
126
128
  /*jshint forin: false */
@@ -324,7 +326,7 @@ qaControl.loadProject = function loadProject(projectDir) {
324
326
  /**
325
327
  *
326
328
  * @param {ProjectInfo} info
327
- * @param {QAOptions} opts
329
+ * @param {QAOptions} [opts]
328
330
  * @returns
329
331
  */
330
332
  qaControl.controlInfo=function controlInfo(info, opts){
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "qa-control",
3
3
  "description": "QA control of things that nobody controls",
4
- "version": "0.6.8",
4
+ "version": "0.6.11",
5
5
  "author": "Codenautas <codenautas@googlegroups.com>",
6
6
  "license": "MIT",
7
7
  "repository": "codenautas/qa-control",
@@ -59,7 +59,8 @@
59
59
  "all": "npm test && npm run test-cov && npm run report && npm run qac"
60
60
  },
61
61
  "files": [
62
- "bin"
62
+ "bin",
63
+ ".github/workflows"
63
64
  ],
64
65
  "qa-control": {
65
66
  "package-version": "0.3.0",