wisdom 14.1.3 → 14.3.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 +17 -0
- package/README.md +4 -3
- package/bin/wisdom.js +6 -3
- package/lib/check-access.js +0 -1
- package/lib/get-env.js +2 -1
- package/lib/parse-commit-type.js +6 -8
- package/lib/parser.js +1 -3
- package/lib/prompts.js +5 -1
- package/lib/publish.js +7 -3
- package/lib/release.js +6 -4
- package/lib/run-wisdom.js +12 -4
- package/lib/runner.js +9 -7
- package/lib/traverse.js +0 -1
- package/lib/validate-package.js +2 -10
- package/lib/wisdom.js +2 -5
- package/package.json +7 -7
package/ChangeLog
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
2023.10.05, v14.3.0
|
|
2
|
+
|
|
3
|
+
feature:
|
|
4
|
+
- 349ecb5 package: eslint-plugin-putout v20.0.0
|
|
5
|
+
- 66c194f package: putout v32.2.0
|
|
6
|
+
|
|
7
|
+
2023.08.15, v14.2.0
|
|
8
|
+
|
|
9
|
+
feature:
|
|
10
|
+
- c3c87ad package: escover v3.5.2
|
|
11
|
+
- 0ec1499 package: eslint-plugin-n v16.0.1
|
|
12
|
+
- 3fd3ef2 package: eslint-plugin-putout v19.1.0
|
|
13
|
+
- 9de91b4 package: read-pkg-up v10.0.0
|
|
14
|
+
- a47e160 package: c8 v8.0.1
|
|
15
|
+
- 6d17e28 package: putout v31.2.0
|
|
16
|
+
- 3cb9fa7 commitType: read package-name
|
|
17
|
+
|
|
1
18
|
2023.03.07, v14.1.3
|
|
2
19
|
|
|
3
20
|
fix:
|
package/README.md
CHANGED
|
@@ -9,7 +9,9 @@
|
|
|
9
9
|
|
|
10
10
|
Tool for publishing releases to github and npm according to [Semantic Versionin](http://semver.org "Semantic Versioning").
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+

|
|
13
|
+
|
|
14
|
+
🎁**Wisdom** does next things:
|
|
13
15
|
|
|
14
16
|
- set env variable `$wisdom_version` and `$WISDOM_VERSION` with future version
|
|
15
17
|
- run command from `scripts.wisdom` of `package.json` (if exist);
|
|
@@ -45,7 +47,6 @@ One command do next things:
|
|
|
45
47
|
"url": "git://github.com/coderaiser/wisdom.git"
|
|
46
48
|
}
|
|
47
49
|
}
|
|
48
|
-
|
|
49
50
|
```
|
|
50
51
|
|
|
51
52
|
Before executing `wisdom`, `wisdom:type` and `wisdom:done` scripts will be expanded via [redrun](https://github.com/coderaiser/redrun) which will speed things up.
|
|
@@ -89,7 +90,7 @@ When you need configure `wisdom` you could declare them in `package.json` (**wit
|
|
|
89
90
|
```json
|
|
90
91
|
{
|
|
91
92
|
"changelog": true,
|
|
92
|
-
"commitType": "paren
|
|
93
|
+
"commitType": "colon|paren",
|
|
93
94
|
"tag": true,
|
|
94
95
|
"release": true,
|
|
95
96
|
"releaseTriesCount": 10,
|
package/bin/wisdom.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import {createRequire} from 'module';
|
|
3
|
+
import {createRequire} from 'node:module';
|
|
4
|
+
import process from 'node:process';
|
|
4
5
|
import wisdom from '../lib/wisdom.js';
|
|
5
6
|
import {choose} from '../lib/prompts.js';
|
|
6
7
|
|
|
@@ -40,7 +41,10 @@ if (!/^(patch|minor|major)$/.test(arg)) {
|
|
|
40
41
|
const dryRun = option === '--dry-run';
|
|
41
42
|
const force = option === '--force';
|
|
42
43
|
|
|
43
|
-
wisdom(arg, {
|
|
44
|
+
wisdom(arg, {
|
|
45
|
+
dryRun,
|
|
46
|
+
force,
|
|
47
|
+
})
|
|
44
48
|
.on('data', (a) => {
|
|
45
49
|
process.stdout.write(a);
|
|
46
50
|
})
|
|
@@ -68,4 +72,3 @@ function help() {
|
|
|
68
72
|
console.log(line);
|
|
69
73
|
}
|
|
70
74
|
}
|
|
71
|
-
|
package/lib/check-access.js
CHANGED
package/lib/get-env.js
CHANGED
package/lib/parse-commit-type.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
export const
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export const parseCommitType = (type = 'colon') => {
|
|
5
|
-
if (type === 'paren')
|
|
6
|
-
return PAREN;
|
|
1
|
+
export const parseCommitType = (info) => {
|
|
2
|
+
const {name = 'package', commitType = 'colon'} = info;
|
|
7
3
|
|
|
8
|
-
|
|
4
|
+
if (commitType === 'paren')
|
|
5
|
+
return `(${name})`;
|
|
6
|
+
|
|
7
|
+
return `: ${name}:`;
|
|
9
8
|
};
|
|
10
|
-
|
package/lib/parser.js
CHANGED
|
@@ -10,7 +10,6 @@ Determine if value should be used according to conditional prefixes:
|
|
|
10
10
|
- not exist, or disabled
|
|
11
11
|
not exist, or enabled
|
|
12
12
|
*/
|
|
13
|
-
|
|
14
13
|
const paths = [
|
|
15
14
|
'^scripts.wisdom',
|
|
16
15
|
'^scripts.wisdom:type',
|
|
@@ -42,10 +41,9 @@ const check = (info) => (path) => {
|
|
|
42
41
|
if (path.startsWith('^'))
|
|
43
42
|
return Boolean(result);
|
|
44
43
|
|
|
45
|
-
return
|
|
44
|
+
return result || isUndefined(result);
|
|
46
45
|
};
|
|
47
46
|
|
|
48
47
|
export const parse = (info) => {
|
|
49
48
|
return paths.filter(check(info));
|
|
50
49
|
};
|
|
51
|
-
|
package/lib/prompts.js
CHANGED
|
@@ -20,7 +20,11 @@ export const choose = async () => {
|
|
|
20
20
|
const prompt = new Select({
|
|
21
21
|
name: 'version',
|
|
22
22
|
message: 'What type of changes are you goint to publish 🎁 ?',
|
|
23
|
-
choices: [
|
|
23
|
+
choices: [
|
|
24
|
+
'patch',
|
|
25
|
+
'minor',
|
|
26
|
+
'major',
|
|
27
|
+
],
|
|
24
28
|
});
|
|
25
29
|
|
|
26
30
|
return await run(prompt);
|
package/lib/publish.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {execSync} from 'child_process';
|
|
1
|
+
import {execSync} from 'node:child_process';
|
|
2
2
|
import getEnv from './get-env.js';
|
|
3
3
|
|
|
4
4
|
export const publish = ({cwd, version}) => {
|
|
@@ -6,7 +6,12 @@ export const publish = ({cwd, version}) => {
|
|
|
6
6
|
};
|
|
7
7
|
|
|
8
8
|
function execute(cmd, version, cwd) {
|
|
9
|
-
const stdio = [
|
|
9
|
+
const stdio = [
|
|
10
|
+
0,
|
|
11
|
+
1,
|
|
12
|
+
2,
|
|
13
|
+
'pipe',
|
|
14
|
+
];
|
|
10
15
|
|
|
11
16
|
execSync(cmd, {
|
|
12
17
|
env: getEnv(version),
|
|
@@ -14,4 +19,3 @@ function execute(cmd, version, cwd) {
|
|
|
14
19
|
stdio,
|
|
15
20
|
});
|
|
16
21
|
}
|
|
17
|
-
|
package/lib/release.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import grizzly from 'grizzly';
|
|
2
2
|
import tryToCatch from 'try-to-catch';
|
|
3
|
-
|
|
4
3
|
import {markdown} from './markdown.js';
|
|
5
4
|
|
|
6
5
|
const isUndefined = (a) => typeof a === 'undefined';
|
|
@@ -64,7 +63,9 @@ export async function release({version, info, chlog, emitter, count}) {
|
|
|
64
63
|
}
|
|
65
64
|
|
|
66
65
|
function getRepoName(json) {
|
|
67
|
-
return json
|
|
66
|
+
return json
|
|
67
|
+
.repository
|
|
68
|
+
.url
|
|
68
69
|
.split('/')
|
|
69
70
|
.pop()
|
|
70
71
|
.replace('.git', '');
|
|
@@ -74,9 +75,10 @@ function getUser(json) {
|
|
|
74
75
|
const FROM_USER = 3;
|
|
75
76
|
const WITHOUT_REPO = -1;
|
|
76
77
|
|
|
77
|
-
return json
|
|
78
|
+
return json
|
|
79
|
+
.repository
|
|
80
|
+
.url
|
|
78
81
|
.split('/')
|
|
79
82
|
.slice(FROM_USER, WITHOUT_REPO)
|
|
80
83
|
.pop();
|
|
81
84
|
}
|
|
82
|
-
|
package/lib/run-wisdom.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import redrun from 'redrun';
|
|
2
2
|
import envir from 'envir';
|
|
3
3
|
import getEnv from './get-env.js';
|
|
4
|
-
import {execSync} from 'child_process';
|
|
4
|
+
import {execSync} from 'node:child_process';
|
|
5
|
+
import process from 'node:process';
|
|
5
6
|
|
|
6
7
|
const {PATH} = process.env;
|
|
7
8
|
const {cwd} = process;
|
|
@@ -21,8 +22,15 @@ export default async (name, type, version, info, emitter) => {
|
|
|
21
22
|
npm_package_version: info.version,
|
|
22
23
|
};
|
|
23
24
|
|
|
24
|
-
const stdio = [
|
|
25
|
+
const stdio = [
|
|
26
|
+
0,
|
|
27
|
+
1,
|
|
28
|
+
2,
|
|
29
|
+
'pipe',
|
|
30
|
+
];
|
|
25
31
|
|
|
26
|
-
execSync(cmd, {
|
|
32
|
+
execSync(cmd, {
|
|
33
|
+
env,
|
|
34
|
+
stdio,
|
|
35
|
+
});
|
|
27
36
|
};
|
|
28
|
-
|
package/lib/runner.js
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import {promisify} from 'util';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
import {execSync} from 'child_process';
|
|
4
|
-
|
|
1
|
+
import {promisify} from 'node:util';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import {execSync} from 'node:child_process';
|
|
5
4
|
import tryCatch from 'try-catch';
|
|
6
5
|
import tryToCatch from 'try-to-catch';
|
|
7
6
|
import _prepend from 'prepend';
|
|
8
7
|
import versionio from 'version-io';
|
|
9
8
|
import changelog from 'changelog-io';
|
|
10
|
-
|
|
11
9
|
import getEnv from './get-env.js';
|
|
12
10
|
import {release} from './release.js';
|
|
13
11
|
import runWisdom from './run-wisdom.js';
|
|
@@ -91,7 +89,12 @@ export const run = async (paths, params) => {
|
|
|
91
89
|
};
|
|
92
90
|
|
|
93
91
|
function execute(cmd, version, cwd) {
|
|
94
|
-
const stdio = [
|
|
92
|
+
const stdio = [
|
|
93
|
+
0,
|
|
94
|
+
1,
|
|
95
|
+
2,
|
|
96
|
+
'pipe',
|
|
97
|
+
];
|
|
95
98
|
|
|
96
99
|
execSync(cmd, {
|
|
97
100
|
env: getEnv(version),
|
|
@@ -106,4 +109,3 @@ function rmLines(str, count) {
|
|
|
106
109
|
.slice(count)
|
|
107
110
|
.join('\n');
|
|
108
111
|
}
|
|
109
|
-
|
package/lib/traverse.js
CHANGED
package/lib/validate-package.js
CHANGED
|
@@ -6,16 +6,8 @@ export const validatePackage = ({info, version, emitter}) => {
|
|
|
6
6
|
return emitter.emit('data', `'repository.url' should be defined`);
|
|
7
7
|
|
|
8
8
|
if (info.name.includes('@') && checkAccess(info))
|
|
9
|
-
return emitter.emit(
|
|
10
|
-
'data',
|
|
11
|
-
`looks like '${info.name}' has no 'access' property\n` +
|
|
12
|
-
`packages should have 'access' property set to 'public' or 'restricted' inside 'publishConfig'\n`,
|
|
13
|
-
);
|
|
9
|
+
return emitter.emit('data', `looks like '${info.name}' has no 'access' property\n` + `packages should have 'access' property set to 'public' or 'restricted' inside 'publishConfig'\n`);
|
|
14
10
|
|
|
15
11
|
if (!version)
|
|
16
|
-
return emitter.emit(
|
|
17
|
-
'data',
|
|
18
|
-
`publish <version>\n` +
|
|
19
|
-
`package: ${ info.name } ${ info.version }\n`,
|
|
20
|
-
);
|
|
12
|
+
return emitter.emit('data', `publish <version>\n` + `package: ${info.name} ${info.version}\n`);
|
|
21
13
|
};
|
package/lib/wisdom.js
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import path from 'path';
|
|
1
|
+
import path from 'node:path';
|
|
2
2
|
import {EventEmitter} from 'events';
|
|
3
|
-
|
|
4
3
|
import changelog from 'changelog-io';
|
|
5
4
|
import rendy from 'rendy';
|
|
6
5
|
import minor from 'minor';
|
|
7
6
|
import {readPackageUp} from 'read-pkg-up';
|
|
8
7
|
import fullstore from 'fullstore';
|
|
9
8
|
import currify from 'currify';
|
|
10
|
-
|
|
11
9
|
import {validatePackage} from './validate-package.js';
|
|
12
10
|
import {parseCommitType} from './parse-commit-type.js';
|
|
13
11
|
import {parse} from './parser.js';
|
|
@@ -86,7 +84,7 @@ async function publish({version, info, emitter, dryRun, force}) {
|
|
|
86
84
|
|
|
87
85
|
const cmd = rendy(Cmd, {
|
|
88
86
|
version: nextVersion,
|
|
89
|
-
commitType: parseCommitType(info
|
|
87
|
+
commitType: parseCommitType(info),
|
|
90
88
|
branch: info.branch || 'master',
|
|
91
89
|
});
|
|
92
90
|
|
|
@@ -118,4 +116,3 @@ async function publish({version, info, emitter, dryRun, force}) {
|
|
|
118
116
|
|
|
119
117
|
return emitter;
|
|
120
118
|
}
|
|
121
|
-
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wisdom",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.3.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",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"jessy": "^3.0.0",
|
|
42
42
|
"minor": "^1.2.0",
|
|
43
43
|
"prepend": "^1.0.1",
|
|
44
|
-
"read-pkg-up": "^
|
|
44
|
+
"read-pkg-up": "^10.0.0",
|
|
45
45
|
"readjson": "^2.2.2",
|
|
46
46
|
"redrun": "^10.0.0",
|
|
47
47
|
"rendy": "^3.0.1",
|
|
@@ -54,15 +54,15 @@
|
|
|
54
54
|
"node": ">=16"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"c8": "^
|
|
58
|
-
"escover": "^
|
|
57
|
+
"c8": "^8.0.1",
|
|
58
|
+
"escover": "^3.5.2",
|
|
59
59
|
"eslint": "^8.1.0",
|
|
60
|
-
"eslint-plugin-n": "^
|
|
61
|
-
"eslint-plugin-putout": "^
|
|
60
|
+
"eslint-plugin-n": "^16.0.1",
|
|
61
|
+
"eslint-plugin-putout": "^20.0.0",
|
|
62
62
|
"madrun": "^9.0.2",
|
|
63
63
|
"mock-import": "^3.0.2",
|
|
64
64
|
"montag": "^1.2.1",
|
|
65
|
-
"putout": "^
|
|
65
|
+
"putout": "^32.2.0",
|
|
66
66
|
"supertape": "^8.3.0"
|
|
67
67
|
}
|
|
68
68
|
}
|