wikiploy 2.0.1 → 2.1.1
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.building your project.md +2 -4
- package/README.md +40 -2
- package/package.json +1 -1
- package/src/index.js +2 -1
- package/src/userPrompt.js +24 -1
package/README.md
CHANGED
|
@@ -7,12 +7,50 @@ After the initial setup, you can quickly build and deploy your user scripts and
|
|
|
7
7
|
|
|
8
8
|
See also:
|
|
9
9
|
|
|
10
|
-
- [
|
|
11
|
-
- [
|
|
10
|
+
- [Wikiploy project template](https://github.com/Eccenux/wikiploy-rollout-example/releases) — quick start for you gadgets.
|
|
11
|
+
- [README: building your project](https://github.com/Eccenux/Wikiploy/blob/main/README.building%20your%20project.md) — recommendation on how to build JS and CSS for your gadgets (includes unit testing setup).
|
|
12
|
+
- [Wikipedia:Wikiploy on pl.wiki](https://pl.wikipedia.org/wiki/Wikipedia:Wikiploy) — Polish description.
|
|
12
13
|
- (more links on the bottom)
|
|
13
14
|
|
|
14
15
|
## New capabilities
|
|
15
16
|
|
|
17
|
+
### setupSummary (v2.1)
|
|
18
|
+
|
|
19
|
+
A helper function that can replace your usages of `userPrompt`. It prompts a user and then supplies
|
|
20
|
+
The `setupSummary` function initializes a summary for a given bot. It requires a `Wikiploy` bot object and optionally takes a gadget version and a standard summary text.
|
|
21
|
+
|
|
22
|
+
#### Parameters
|
|
23
|
+
|
|
24
|
+
- `ployBot`: A `Wikiploy` bot object. This is required to setup the `summary()` function.
|
|
25
|
+
- `version` (optional): The version of your gadget. Defaults to an empty string if not provided.
|
|
26
|
+
- `standardSummary` (optional): A string that provides a standard summary aside from the version. Defaults to "changes from Github".
|
|
27
|
+
|
|
28
|
+
For a prompt answer: "fixed bug #123", you would get: "v5.6.0: fixed bug #123" (`v${version}: ${summary}`).
|
|
29
|
+
|
|
30
|
+
#### Usage
|
|
31
|
+
|
|
32
|
+
Basic usage:
|
|
33
|
+
```js
|
|
34
|
+
// custom summary from a prompt
|
|
35
|
+
await setupSummary(ployBot);
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Version from package:
|
|
39
|
+
```js
|
|
40
|
+
(async () => {
|
|
41
|
+
// custom summary from a prompt
|
|
42
|
+
let version = await readVersion('package.json');
|
|
43
|
+
await setupSummary(ployBot, version);
|
|
44
|
+
|
|
45
|
+
// [...]
|
|
46
|
+
|
|
47
|
+
await ployBot.deploy(configs);
|
|
48
|
+
})().catch(err => {
|
|
49
|
+
console.error(err);
|
|
50
|
+
process.exit(1);
|
|
51
|
+
});
|
|
52
|
+
```
|
|
53
|
+
|
|
16
54
|
### Lightweight Dependencies (v2.0)
|
|
17
55
|
|
|
18
56
|
We had a good run, but it's time to bid farewell to [Puppeteer](https://pptr.dev/) and free the puppets ;). Obviously, this might be a breaking change if you really need to use it. However, the Wikiploy API doesn't really change...
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import DeployConfig from './DeployConfig.js';
|
|
2
2
|
import WikiployLite from './WikiployLite.js';
|
|
3
3
|
import * as verlib from './version.js';
|
|
4
|
-
import { userPrompt } from './userPrompt.js';
|
|
4
|
+
import { userPrompt, setupSummary } from './userPrompt.js';
|
|
5
5
|
|
|
6
6
|
const Wikiploy = WikiployLite;
|
|
7
7
|
|
|
@@ -9,6 +9,7 @@ export {
|
|
|
9
9
|
DeployConfig,
|
|
10
10
|
verlib,
|
|
11
11
|
userPrompt,
|
|
12
|
+
setupSummary,
|
|
12
13
|
WikiployLite,
|
|
13
14
|
Wikiploy
|
|
14
15
|
};
|
package/src/userPrompt.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import readline from 'node:readline';
|
|
2
2
|
import { stdin as input, stdout as output } from 'node:process';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Prompt for summary.
|
|
6
|
+
* @param {String} prompt Prompt information to display.
|
|
7
|
+
* @returns
|
|
8
|
+
*/
|
|
4
9
|
const userPrompt = (prompt) => {
|
|
5
10
|
const rl = readline.createInterface({ input, output });
|
|
6
11
|
|
|
@@ -13,4 +18,22 @@ const userPrompt = (prompt) => {
|
|
|
13
18
|
});
|
|
14
19
|
};
|
|
15
20
|
|
|
16
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Read (prompt) and setup summary.
|
|
23
|
+
* @param {WikiployLite} ployBot Bot object (required to setup `summary()`).
|
|
24
|
+
* @param {Number} version Gadget version.
|
|
25
|
+
* @param {String} standardSummary Standard summary (aside from version).
|
|
26
|
+
*/
|
|
27
|
+
async function setupSummary(ployBot, version = '', standardSummary = 'changes from Github') {
|
|
28
|
+
let info = version.length ? `(empty for a standard summary prefixed with v${version})` : `(empty for a standard summary)`;
|
|
29
|
+
let summary = await userPrompt(`Summary of changes ${info}:`);
|
|
30
|
+
if (typeof summary !== 'string' || !summary.length) {
|
|
31
|
+
summary = standardSummary;
|
|
32
|
+
}
|
|
33
|
+
ployBot.summary = () => {
|
|
34
|
+
return version.length ? `v${version}: ${summary}` : summary;
|
|
35
|
+
};
|
|
36
|
+
console.log(`[INFO] summary: »${ployBot.summary()}«\n`);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export { userPrompt, setupSummary };
|