wikiploy 2.0.0 → 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.
- package/README.building your project.md +2 -4
- package/README.md +17 -10
- package/package.json +1 -1
- package/src/index.js +2 -1
- package/src/userPrompt.js +24 -1
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
|
-
- [
|
|
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
|
|
@@ -21,6 +22,12 @@ The only change is that you need to provide bot configuration to Wikiploy (as al
|
|
|
21
22
|
|
|
22
23
|
`WikiployLite` is now synonymous with `Wikiploy`. You can use either of the class names.
|
|
23
24
|
|
|
25
|
+
### userPrompt (v1.8)
|
|
26
|
+
|
|
27
|
+
Use the `userPrompt` helper function to prompt for a summary in your Wikiploy script. This is only a helper. You can still set up a static summary, but a prompt helps to ensure you don't forget to change the summary.
|
|
28
|
+
|
|
29
|
+
Note that when using `userPrompt` you have to use an interactive terminal. This might be a bit more tricky to set up but can still function as a one-click build from a commandbar (see [README: building your project](https://github.com/Eccenux/Wikiploy/blob/main/README.building%20your%20project.md)).
|
|
30
|
+
|
|
24
31
|
### nowiki (v1.7)
|
|
25
32
|
|
|
26
33
|
The `nowiki` property is a new option in `DeployConfig` since Wikiploy v1.7. It is now recommended to use `nowiki: true` for all JS files.
|
|
@@ -36,22 +43,22 @@ JavaScript page is still a wiki page... Kind of. It can be added to a category o
|
|
|
36
43
|
|
|
37
44
|
Don't add this option to CSS though. It won't work correctly.
|
|
38
45
|
|
|
39
|
-
### userPrompt (v1.8)
|
|
40
|
-
|
|
41
|
-
Use the `userPrompt` helper function to prompt for a summary in your Wikiploy script. This is only a helper. You can still set up a static summary, but a prompt helps to ensure you don't forget to change the summary.
|
|
42
|
-
|
|
43
|
-
Note that when using `userPrompt` you have to use an interactive terminal. This might be a bit more tricky to set up but can still function as a one-click build from a commandbar (see [README: building your project](https://github.com/Eccenux/Wikiploy/blob/main/README.building%20your%20project.md)).
|
|
44
|
-
|
|
45
46
|
## Using Wikiploy
|
|
46
47
|
|
|
48
|
+
Either use [Wikiploy project template](https://github.com/Eccenux/wikiploy-rollout-example/releases) or add Wikiploy to your project:
|
|
49
|
+
```bash
|
|
50
|
+
# npm install wikiploy --save-dev
|
|
51
|
+
npm i wikiploy -D
|
|
52
|
+
```
|
|
53
|
+
|
|
47
54
|
The `Wikiploy` class can be used to help deploy scripts. It is using a bot API to do that, but don't worry, you don't need to be a bot ;).
|
|
48
55
|
|
|
49
|
-
You do need to setup a bot password though (on [[Special:BotPasswords]]). It's not as hard as it might seem as **you can do this on *any* Wikimedia wiki and it will work for *all* WMF wikis**. You don't need a bot account for this to work. You will just create an alias for your
|
|
56
|
+
You do need to setup a bot password though (on [[Special:BotPasswords]]). It's not as hard as it might seem as **you can do this on *any* Wikimedia wiki and it will work for *all* WMF wikis**. You don't need a bot account for this to work. You will just create an alias for your standard account and a special password just for your scripts.
|
|
50
57
|
|
|
51
58
|
## Botpass configuration
|
|
52
59
|
A bot password is essentially a sub-account, designed to help keep your activities separated and secure. Setting up a sub-account is straightforward, and nearly anyone can do it.
|
|
53
60
|
|
|
54
|
-
1. Begin by setting up your sub-account on this page: [
|
|
61
|
+
1. Begin by setting up your sub-account on this page: [test.wikipedia.org/wiki/Special:BotPasswords](https://test.wikipedia.org/wiki/Special:BotPasswords).
|
|
55
62
|
2. Choose a name and specify the permissions for your sub-account. For instance, you should grant rights necessary for deploying gadgets (if applicable). You can refer to this example screenshot for setting up rights: [assets\Bot passwords - Test Wikipedia.png](https://github.com/Eccenux/Wikiploy/blob/main/assets/Bot%20passwords%20-%20Test%20Wikipedia.png).
|
|
56
63
|
3. Next, create your `bot.config.mjs` file. An example configuration file can be found here: `assets\public--bot.config.mjs`.
|
|
57
64
|
|
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 };
|