wikiploy 2.0.1 → 2.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.
@@ -34,11 +34,9 @@ Your `package.json` (crucial part being `scripts`):
34
34
  "chai": "4.x",
35
35
  "eslint": "8.x",
36
36
  "less": "4.x",
37
- "mocha": "10.x"
37
+ "mocha": "10.x",
38
+ "wikiploy": "2.x"
38
39
  },
39
- "dependencies": {
40
- "wikiploy": "1.x"
41
- }
42
40
  }
43
41
  ```
44
42
 
package/README.md CHANGED
@@ -7,8 +7,9 @@ After the initial setup, you can quickly build and deploy your user scripts and
7
7
 
8
8
  See also:
9
9
 
10
- - [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).
11
- - [Wikipedia:Wikiploy on pl.wiki](https://pl.wikipedia.org/wiki/Wikipedia:Wikiploy) for Polish description.
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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wikiploy",
3
- "version": "2.0.1",
3
+ "version": "2.1.0",
4
4
  "description": "User scripts and gadgets deployment for MediaWiki (Wikipedia).",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
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
- export { userPrompt };
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 };