wisdom 13.0.3 → 13.1.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/ChangeLog CHANGED
@@ -1,3 +1,32 @@
1
+ 2022.05.24, v13.1.0
2
+
3
+ feature:
4
+ - wisdom: parser: simplify
5
+
6
+
7
+ 2022.05.24, v13.0.5
8
+
9
+ fix:
10
+ - wisdom: changelog
11
+
12
+
13
+ 2022.05.24, v13.0.4
14
+
15
+ fix:
16
+ - wisdom: traverse: rm maybe array
17
+
18
+
19
+ feature:
20
+ - wisdom: rm escape
21
+
22
+
23
+ 2022.05.24, v13.0.3
24
+
25
+ fix:
26
+ - wisdom: tag
27
+ - wisdom: build
28
+
29
+
1
30
  2022.05.24, v12.2.2
2
31
 
3
32
  fix:
package/lib/parser.js CHANGED
@@ -1,39 +1,48 @@
1
1
  import jessy from 'jessy';
2
2
 
3
- const {isArray} = Array;
3
+ const isUndefined = (a) => typeof a === 'undefined';
4
4
 
5
- const maybeArray = (a) => isArray(a) ? a : [a];
5
+ /*
6
+ Determine if value should be used according to conditional prefixes:
7
+ ^ exist
8
+ ! disabled
9
+ : always
10
+ - not exist, or disabled
11
+ not exist, or enabled
12
+ */
6
13
 
7
14
  const paths = [
8
- 'scripts.wisdom',
9
- 'scripts.wisdom:type',
15
+ '^scripts.wisdom',
16
+ '^scripts.wisdom:type',
10
17
  'changelog',
11
- ['changelog', false],
18
+ '!changelog',
12
19
  ':version',
13
- 'scripts.wisdom:build',
20
+ '^scripts.wisdom:build',
14
21
  ':commit',
15
22
  'tag',
16
- ['tag', false],
23
+ '!tag',
17
24
  ':release',
18
- '!private',
19
- 'scripts.wisdom:done',
25
+ '-private',
26
+ '^scripts.wisdom:done',
20
27
  ];
21
28
 
22
- const check = (info) => (data) => {
23
- const [path, value = 'any'] = maybeArray(data);
24
-
29
+ const check = (info) => (path) => {
25
30
  if (path.startsWith(':'))
26
31
  return true;
27
32
 
28
- const result = jessy(path, info);
33
+ const cleanPath = path.replace(/[!^:]/, '');
34
+ const result = jessy(cleanPath, info);
35
+
36
+ if (path.startsWith('-'))
37
+ return !result || isUndefined(result);
29
38
 
30
39
  if (path.startsWith('!'))
31
- return !result;
40
+ return !result && !isUndefined(result);
32
41
 
33
- if (value === 'any')
42
+ if (path.startsWith('^'))
34
43
  return Boolean(result);
35
44
 
36
- return result === value;
45
+ return Boolean(result) || isUndefined(result);
37
46
  };
38
47
 
39
48
  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.3",
3
+ "version": "13.1.0",
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",