wisdom 13.1.2 → 14.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 +14 -0
- package/bin/wisdom.js +13 -2
- package/json/bin.json +1 -0
- package/lib/prompts.js +41 -0
- package/lib/publish.js +17 -0
- package/lib/release.js +1 -1
- package/lib/wisdom.js +13 -7
- package/package.json +7 -6
package/ChangeLog
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
2023.03.07, v14.1.0
|
|
2
|
+
|
|
3
|
+
feature:
|
|
4
|
+
- bc4ed9c wisdom: add ability to ask before publishing major
|
|
5
|
+
|
|
6
|
+
2023.03.07, v14.0.0
|
|
7
|
+
|
|
8
|
+
feature:
|
|
9
|
+
- package: putout v29.0.1
|
|
10
|
+
- package: supertape v8.3.0
|
|
11
|
+
- package: changelog-io v8.0.0: add commit hash to produced ChangeLog
|
|
12
|
+
- package: eslint-plugin-putout v16.2.1
|
|
13
|
+
- package: putout v27.7.0
|
|
14
|
+
|
|
1
15
|
2022.06.17, v13.1.2
|
|
2
16
|
|
|
3
17
|
fix:
|
package/bin/wisdom.js
CHANGED
|
@@ -2,10 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
import {createRequire} from 'module';
|
|
4
4
|
import wisdom from '../lib/wisdom.js';
|
|
5
|
+
import {choose} from '../lib/prompts.js';
|
|
5
6
|
|
|
6
7
|
const require = createRequire(import.meta.url);
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
let [arg, option] = process.argv.slice(2);
|
|
10
|
+
|
|
11
|
+
if (arg === '--dry-run') {
|
|
12
|
+
arg = '';
|
|
13
|
+
option = '--dry-run';
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
if (!arg) {
|
|
17
|
+
arg = await choose();
|
|
18
|
+
}
|
|
9
19
|
|
|
10
20
|
if (/^(-v|--v)$/.test(arg)) {
|
|
11
21
|
version();
|
|
@@ -28,8 +38,9 @@ if (!/^(patch|minor|major)$/.test(arg)) {
|
|
|
28
38
|
}
|
|
29
39
|
|
|
30
40
|
const dryRun = option === '--dry-run';
|
|
41
|
+
const force = option === '--force';
|
|
31
42
|
|
|
32
|
-
wisdom(arg, {dryRun})
|
|
43
|
+
wisdom(arg, {dryRun, force})
|
|
33
44
|
.on('data', (a) => {
|
|
34
45
|
process.stdout.write(a);
|
|
35
46
|
})
|
package/json/bin.json
CHANGED
package/lib/prompts.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import enquirer from 'enquirer';
|
|
2
|
+
import actions from 'enquirer/lib/combos.js';
|
|
3
|
+
import tryToCatch from 'try-to-catch';
|
|
4
|
+
|
|
5
|
+
const {Select, Confirm} = enquirer;
|
|
6
|
+
|
|
7
|
+
const custom = {
|
|
8
|
+
h: 'left',
|
|
9
|
+
j: 'down',
|
|
10
|
+
k: 'up',
|
|
11
|
+
l: 'right',
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
actions.keys = {
|
|
15
|
+
...actions.keys,
|
|
16
|
+
...custom,
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const choose = async () => {
|
|
20
|
+
const prompt = new Select({
|
|
21
|
+
name: 'version',
|
|
22
|
+
message: 'What type of changes are you goint to publish 🎁 ?',
|
|
23
|
+
choices: ['patch', 'minor', 'major'],
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
return await run(prompt);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const ask = async (name, version) => {
|
|
30
|
+
const prompt = new Confirm({
|
|
31
|
+
name: 'question',
|
|
32
|
+
message: `Are you sure that you want to publish major version of '${name}': v${version}?`
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
return await run(prompt);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
async function run(prompt) {
|
|
39
|
+
const [, answer] = await tryToCatch(prompt.run.bind(prompt));
|
|
40
|
+
return answer;
|
|
41
|
+
}
|
package/lib/publish.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {execSync} from 'child_process';
|
|
2
|
+
import getEnv from './get-env.js';
|
|
3
|
+
|
|
4
|
+
export const publish = ({cwd, version}) => {
|
|
5
|
+
execute(`npm publish`, version, cwd);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
function execute(cmd, version, cwd) {
|
|
9
|
+
const stdio = [0, 1, 2, 'pipe'];
|
|
10
|
+
|
|
11
|
+
execSync(cmd, {
|
|
12
|
+
env: getEnv(version),
|
|
13
|
+
cwd,
|
|
14
|
+
stdio,
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
|
package/lib/release.js
CHANGED
|
@@ -12,7 +12,7 @@ export async function release({version, info, chlog, emitter, count}) {
|
|
|
12
12
|
return;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
const tag =
|
|
15
|
+
const tag = `v${version}`;
|
|
16
16
|
|
|
17
17
|
if (!info.repository) {
|
|
18
18
|
emitter.emit('data', `Error releasing on github: no 'repository' field found in 'package.json'\n`);
|
package/lib/wisdom.js
CHANGED
|
@@ -12,6 +12,7 @@ import {validatePackage} from './validate-package.js';
|
|
|
12
12
|
import {parseCommitType} from './parse-commit-type.js';
|
|
13
13
|
import {parse} from './parser.js';
|
|
14
14
|
import {run} from './runner.js';
|
|
15
|
+
import {ask} from './prompts.js';
|
|
15
16
|
|
|
16
17
|
const Cmd = [
|
|
17
18
|
'git add --all',
|
|
@@ -38,7 +39,7 @@ const setInfoDir = (data) => {
|
|
|
38
39
|
|
|
39
40
|
const getPkg = (data) => data.packageJson;
|
|
40
41
|
|
|
41
|
-
export default (version, {dryRun}) => {
|
|
42
|
+
export default (version, {dryRun, force}) => {
|
|
42
43
|
const emitter = new EventEmitter();
|
|
43
44
|
|
|
44
45
|
const onError = (e) => {
|
|
@@ -55,6 +56,7 @@ export default (version, {dryRun}) => {
|
|
|
55
56
|
info,
|
|
56
57
|
emitter,
|
|
57
58
|
dryRun,
|
|
59
|
+
force,
|
|
58
60
|
});
|
|
59
61
|
});
|
|
60
62
|
|
|
@@ -67,17 +69,21 @@ export default (version, {dryRun}) => {
|
|
|
67
69
|
return emitter;
|
|
68
70
|
};
|
|
69
71
|
|
|
70
|
-
async function publish({version, info, emitter, dryRun}) {
|
|
72
|
+
async function publish({version, info, emitter, dryRun, force}) {
|
|
71
73
|
let type = '--';
|
|
74
|
+
let nextVersion;
|
|
72
75
|
|
|
73
76
|
if (!version.indexOf('v')) {
|
|
74
|
-
|
|
75
|
-
type +=
|
|
77
|
+
nextVersion = version.slice(1);
|
|
78
|
+
type += `v${version}`;
|
|
76
79
|
} else if (/major|minor|patch/.test(version)) {
|
|
77
80
|
type += version;
|
|
78
|
-
|
|
81
|
+
nextVersion = minor(version, info.version);
|
|
79
82
|
}
|
|
80
83
|
|
|
84
|
+
if (!force && version === 'major' && !await ask(info.name, nextVersion))
|
|
85
|
+
return;
|
|
86
|
+
|
|
81
87
|
const cmd = rendy(Cmd, {
|
|
82
88
|
version,
|
|
83
89
|
commitType: parseCommitType(info.commitType),
|
|
@@ -85,7 +91,7 @@ async function publish({version, info, emitter, dryRun}) {
|
|
|
85
91
|
});
|
|
86
92
|
|
|
87
93
|
const cmdTag = rendy(CmdTag, {
|
|
88
|
-
version,
|
|
94
|
+
version: nextVersion,
|
|
89
95
|
});
|
|
90
96
|
|
|
91
97
|
const paths = parse(info);
|
|
@@ -103,11 +109,11 @@ async function publish({version, info, emitter, dryRun}) {
|
|
|
103
109
|
cwd,
|
|
104
110
|
info,
|
|
105
111
|
emitter,
|
|
106
|
-
version,
|
|
107
112
|
chlogStore,
|
|
108
113
|
cmd,
|
|
109
114
|
cmdTag,
|
|
110
115
|
InfoDirStore,
|
|
116
|
+
version: nextVersion,
|
|
111
117
|
});
|
|
112
118
|
|
|
113
119
|
return emitter;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wisdom",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "14.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",
|
|
@@ -33,8 +33,9 @@
|
|
|
33
33
|
"url": "git://github.com/coderaiser/wisdom.git"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"changelog-io": "^
|
|
36
|
+
"changelog-io": "^8.0.0",
|
|
37
37
|
"currify": "^4.0.0",
|
|
38
|
+
"enquirer": "^2.3.6",
|
|
38
39
|
"envir": "^2.0.0",
|
|
39
40
|
"fullstore": "^3.0.0",
|
|
40
41
|
"grizzly": "^5.0.0",
|
|
@@ -57,12 +58,12 @@
|
|
|
57
58
|
"c8": "^7.8.0",
|
|
58
59
|
"escover": "^2.1.2",
|
|
59
60
|
"eslint": "^8.1.0",
|
|
60
|
-
"eslint-plugin-
|
|
61
|
-
"eslint-plugin-putout": "^
|
|
61
|
+
"eslint-plugin-n": "^15.6.1",
|
|
62
|
+
"eslint-plugin-putout": "^16.2.1",
|
|
62
63
|
"madrun": "^9.0.2",
|
|
63
64
|
"mock-import": "^3.0.2",
|
|
64
65
|
"montag": "^1.2.1",
|
|
65
|
-
"putout": "^
|
|
66
|
-
"supertape": "^
|
|
66
|
+
"putout": "^29.0.1",
|
|
67
|
+
"supertape": "^8.3.0"
|
|
67
68
|
}
|
|
68
69
|
}
|