wisdom 13.0.1 → 13.0.4

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,20 @@
1
+ 2022.05.24, v13.0.4
2
+
3
+ fix:
4
+ - wisdom: traverse: rm maybe array
5
+
6
+
7
+ feature:
8
+ - wisdom: rm escape
9
+
10
+
11
+ 2022.05.24, v13.0.3
12
+
13
+ fix:
14
+ - wisdom: tag
15
+ - wisdom: build
16
+
17
+
1
18
  2022.05.24, v12.2.2
2
19
 
3
20
  fix:
package/README.md CHANGED
@@ -76,8 +76,9 @@ npm publish
76
76
  $ wisdom
77
77
  Usage: wisdom [patch|minor|major]
78
78
  Options:
79
- -h, --help : display this help and exit
80
- -v, --version : output version information and exit
79
+ --dry-run show tasks to run without actually running
80
+ -h, --help display this help and exit
81
+ -v, --version output version information and exit
81
82
  ```
82
83
 
83
84
  ## Configuration
package/bin/wisdom.js CHANGED
@@ -5,7 +5,7 @@ import wisdom from '../lib/wisdom.js';
5
5
 
6
6
  const require = createRequire(import.meta.url);
7
7
 
8
- const [arg] = process.argv.slice(2);
8
+ const [arg, option] = process.argv.slice(2);
9
9
 
10
10
  if (/^(-v|--v)$/.test(arg)) {
11
11
  version();
@@ -27,7 +27,7 @@ if (!/^(patch|minor|major)$/.test(arg)) {
27
27
  process.exit();
28
28
  }
29
29
 
30
- const dryRun = arg.includes('--dry-run');
30
+ const dryRun = option === '--dry-run';
31
31
 
32
32
  wisdom(arg, {dryRun})
33
33
  .on('data', (a) => {
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
37
  return !result;
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/lib/wisdom.js CHANGED
@@ -91,7 +91,7 @@ async function publish({version, info, emitter, dryRun}) {
91
91
  const paths = parse(info);
92
92
 
93
93
  if (dryRun) {
94
- emitter.emit('data', paths.join('\n'));
94
+ emitter.emit('data', `${paths.join('\n')}\n`);
95
95
  return;
96
96
  }
97
97
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wisdom",
3
- "version": "13.0.1",
3
+ "version": "13.0.4",
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",