wisdom 13.0.2 → 13.0.5

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/ChangeLog CHANGED
@@ -1,3 +1,26 @@
1
+ 2022.05.24, v13.0.5
2
+
3
+ fix:
4
+ - wisdom: changelog
5
+
6
+
7
+ 2022.05.24, v13.0.4
8
+
9
+ fix:
10
+ - wisdom: traverse: rm maybe array
11
+
12
+
13
+ feature:
14
+ - wisdom: rm escape
15
+
16
+
17
+ 2022.05.24, v13.0.3
18
+
19
+ fix:
20
+ - wisdom: tag
21
+ - wisdom: build
22
+
23
+
1
24
  2022.05.24, v12.2.2
2
25
 
3
26
  fix:
package/lib/parser.js CHANGED
@@ -4,36 +4,42 @@ const {isArray} = Array;
4
4
 
5
5
  const maybeArray = (a) => isArray(a) ? a : [a];
6
6
 
7
+ const isUndefined = (a) => typeof a === 'undefined';
8
+
7
9
  const paths = [
8
- 'scripts.wisdom',
9
- 'scripts.wisdom:type',
10
+ '^scripts.wisdom',
11
+ '^scripts.wisdom:type',
10
12
  'changelog',
11
- ['changelog', false],
13
+ '!changelog',
12
14
  ':version',
13
- 'scripts.wisdom:build',
15
+ '^scripts.wisdom:build',
14
16
  ':commit',
15
17
  'tag',
16
- ['tag', false],
18
+ '!tag',
17
19
  ':release',
18
- '!private',
19
- 'scripts.wisdom:done',
20
+ '-private',
21
+ '^scripts.wisdom:done',
20
22
  ];
21
23
 
22
24
  const check = (info) => (data) => {
23
- const [path, value = 'any'] = maybeArray(data);
25
+ const [path] = maybeArray(data);
24
26
 
25
27
  if (path.startsWith(':'))
26
28
  return true;
27
29
 
28
- const result = jessy(path, info);
30
+ const cleanPath = path.replace(/[!^:]/, '');
31
+ const result = jessy(cleanPath, info);
32
+
33
+ if (path.startsWith('-'))
34
+ return !result || isUndefined(result);
29
35
 
30
36
  if (path.startsWith('!'))
31
- return !result;
37
+ return result === false;
32
38
 
33
- if (value === 'any')
39
+ if (path.startsWith('^'))
34
40
  return Boolean(result);
35
41
 
36
- return result === value;
42
+ return Boolean(result) || isUndefined(result);
37
43
  };
38
44
 
39
45
  export const parse = (info) => {
package/lib/runner.js CHANGED
@@ -34,7 +34,7 @@ export const run = async (paths, params) => {
34
34
  'type': async () => {
35
35
  await runWisdom('wisdom:type', type, version, info, emitter);
36
36
  },
37
- 'changelog:true': async () => {
37
+ 'changelog': async () => {
38
38
  const [error, data] = tryCatch(changelog, version);
39
39
 
40
40
  if (error) {
@@ -49,7 +49,7 @@ export const run = async (paths, params) => {
49
49
  const value = rmLines(data, 2);
50
50
  chlogStore(value);
51
51
  },
52
- 'changelog:false': () => {
52
+ '!changelog': () => {
53
53
  emitter.emit('data', 'changelog: false\n');
54
54
  },
55
55
  'version': async () => {
@@ -61,10 +61,10 @@ export const run = async (paths, params) => {
61
61
  'commit': () => {
62
62
  execute(cmd, version, cwd);
63
63
  },
64
- 'tag:true': () => {
64
+ 'tag': () => {
65
65
  execute(cmdTag, version, cwd);
66
66
  },
67
- 'tag:false': () => {
67
+ '!tag': () => {
68
68
  emitter.emit('data', 'tag: false\n');
69
69
  },
70
70
  'release': async () => {
package/lib/traverse.js CHANGED
@@ -1,23 +1,22 @@
1
- const {isArray} = Array;
2
-
3
- const maybeArray = (a) => isArray(a) ? a : [a];
4
-
5
1
  export const traverse = async (paths, visitors) => {
6
- for (const current of paths) {
7
- const [path, value = true] = maybeArray(current);
8
-
9
- if (path === 'scripts.wisdom') {
2
+ for (const path of paths) {
3
+ if (path === '^scripts.wisdom') {
10
4
  await visitors.wisdom();
11
5
  continue;
12
6
  }
13
7
 
14
- if (path === 'scripts.wisdom:type') {
8
+ if (path === '^scripts.wisdom:type') {
15
9
  await visitors.type();
16
10
  continue;
17
11
  }
18
12
 
19
13
  if (path === 'changelog') {
20
- await visitors[`changelog:${value}`]();
14
+ await visitors.changelog();
15
+ continue;
16
+ }
17
+
18
+ if (path === '!changelog') {
19
+ await visitors[`!changelog`]();
21
20
  continue;
22
21
  }
23
22
 
@@ -26,7 +25,7 @@ export const traverse = async (paths, visitors) => {
26
25
  continue;
27
26
  }
28
27
 
29
- if (path === 'scripts:wisdom:build') {
28
+ if (path === '^scripts.wisdom:build') {
30
29
  await visitors.build();
31
30
  continue;
32
31
  }
@@ -37,7 +36,12 @@ export const traverse = async (paths, visitors) => {
37
36
  }
38
37
 
39
38
  if (path === 'tag') {
40
- await visitors[`path:${value}`]();
39
+ await visitors.tag();
40
+ continue;
41
+ }
42
+
43
+ if (path === '!tag') {
44
+ await visitors[`!tag`]();
41
45
  continue;
42
46
  }
43
47
 
@@ -46,12 +50,12 @@ export const traverse = async (paths, visitors) => {
46
50
  continue;
47
51
  }
48
52
 
49
- if (path === '!private') {
53
+ if (path === '-private') {
50
54
  await visitors.publish();
51
55
  continue;
52
56
  }
53
57
 
54
- if (path === 'scripts.wisdom:done') {
58
+ if (path === '^scripts.wisdom:done') {
55
59
  await visitors.done();
56
60
  continue;
57
61
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wisdom",
3
- "version": "13.0.2",
3
+ "version": "13.0.5",
4
4
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
5
5
  "description": "configurable publish releases to github and npm",
6
6
  "homepage": "http://github.com/coderaiser/wisdom",