wisdom 13.0.0 → 13.0.3

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 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();
@@ -17,12 +17,19 @@ if (!arg || /^(-h|--help)$/.test(arg)) {
17
17
  process.exit();
18
18
  }
19
19
 
20
+ if (/^(-v|--v)$/.test(arg)) {
21
+ version();
22
+ process.exit();
23
+ }
24
+
20
25
  if (!/^(patch|minor|major)$/.test(arg)) {
21
26
  console.error(`'%s' is not a wisdom option. See 'wisdom --help'`, arg);
22
27
  process.exit();
23
28
  }
24
29
 
25
- wisdom(arg)
30
+ const dryRun = option === '--dry-run';
31
+
32
+ wisdom(arg, {dryRun})
26
33
  .on('data', (a) => {
27
34
  process.stdout.write(a);
28
35
  })
package/json/bin.json CHANGED
@@ -1,4 +1,5 @@
1
1
  {
2
+ "--dry-run ": "show tasks to run without actually running",
2
3
  "-h, --help ": "display this help and exit",
3
4
  "-v, --version ": "output version information and exit"
4
5
  }
package/lib/parser.js CHANGED
@@ -10,7 +10,7 @@ const paths = [
10
10
  'changelog',
11
11
  ['changelog', false],
12
12
  ':version',
13
- 'scripts:wisdom:build',
13
+ 'scripts.wisdom:build',
14
14
  ':commit',
15
15
  'tag',
16
16
  ['tag', false],
package/lib/runner.js CHANGED
@@ -28,10 +28,10 @@ export const run = async (paths, params) => {
28
28
  } = params;
29
29
 
30
30
  const [error] = await tryToCatch(traverse, paths, {
31
- 'scripts.wisdom': async () => {
31
+ 'wisdom': async () => {
32
32
  await runWisdom('wisdom', '', version, info, emitter);
33
33
  },
34
- 'scripts.wisdom:type': async () => {
34
+ 'type': async () => {
35
35
  await runWisdom('wisdom:type', type, version, info, emitter);
36
36
  },
37
37
  'changelog:true': async () => {
@@ -55,7 +55,7 @@ export const run = async (paths, params) => {
55
55
  'version': async () => {
56
56
  await versionio(version);
57
57
  },
58
- 'scripts.wisdom:build': async () => {
58
+ 'build': async () => {
59
59
  await runWisdom('wisdom:build', '', version, info, emitter);
60
60
  },
61
61
  'commit': () => {
@@ -79,7 +79,7 @@ export const run = async (paths, params) => {
79
79
  'publish': () => {
80
80
  execute(`npm publish`, version, cwd);
81
81
  },
82
- 'scripts.wisdom:done': async () => {
82
+ 'done': async () => {
83
83
  await runWisdom('wisdom:done', '', version, info, emitter);
84
84
  },
85
85
  });
package/lib/traverse.js CHANGED
@@ -7,12 +7,12 @@ export const traverse = async (paths, visitors) => {
7
7
  const [path, value = true] = maybeArray(current);
8
8
 
9
9
  if (path === 'scripts.wisdom') {
10
- await visitors['scripts.wisdom']();
10
+ await visitors.wisdom();
11
11
  continue;
12
12
  }
13
13
 
14
14
  if (path === 'scripts.wisdom:type') {
15
- await visitors['scripts.wisdom:type']();
15
+ await visitors.type();
16
16
  continue;
17
17
  }
18
18
 
@@ -26,8 +26,8 @@ export const traverse = async (paths, visitors) => {
26
26
  continue;
27
27
  }
28
28
 
29
- if (path === 'scripts:wisdom:build') {
30
- await visitors['scripts.wisdom:build']();
29
+ if (path === 'scripts.wisdom:build') {
30
+ await visitors.build();
31
31
  continue;
32
32
  }
33
33
 
@@ -51,8 +51,8 @@ export const traverse = async (paths, visitors) => {
51
51
  continue;
52
52
  }
53
53
 
54
- if (path === 'scripts:wisdom:done') {
55
- await visitors['scripts.wisdom:done']();
54
+ if (path === 'scripts.wisdom:done') {
55
+ await visitors.done();
56
56
  continue;
57
57
  }
58
58
  }
package/lib/wisdom.js CHANGED
@@ -38,7 +38,7 @@ const setInfoDir = (data) => {
38
38
 
39
39
  const getPkg = (data) => data.packageJson;
40
40
 
41
- export default (version) => {
41
+ export default (version, {dryRun}) => {
42
42
  const emitter = new EventEmitter();
43
43
 
44
44
  const onError = (e) => {
@@ -50,7 +50,12 @@ export default (version) => {
50
50
  if (validatePackage({version, emitter, info}))
51
51
  return;
52
52
 
53
- await publish(version, info, emitter);
53
+ await publish({
54
+ version,
55
+ info,
56
+ emitter,
57
+ dryRun,
58
+ });
54
59
  });
55
60
 
56
61
  readPackageUp()
@@ -62,7 +67,7 @@ export default (version) => {
62
67
  return emitter;
63
68
  };
64
69
 
65
- async function publish(version, info, emitter) {
70
+ async function publish({version, info, emitter, dryRun}) {
66
71
  let type = '--';
67
72
 
68
73
  if (!version.indexOf('v')) {
@@ -84,6 +89,12 @@ async function publish(version, info, emitter) {
84
89
  });
85
90
 
86
91
  const paths = parse(info);
92
+
93
+ if (dryRun) {
94
+ emitter.emit('data', `${paths.join('\n')}\n`);
95
+ return;
96
+ }
97
+
87
98
  const cwd = InfoDirStore();
88
99
 
89
100
  await run(paths, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wisdom",
3
- "version": "13.0.0",
3
+ "version": "13.0.3",
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",