You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: DEVELOPER.md
+15-14
Original file line number
Diff line number
Diff line change
@@ -8,14 +8,14 @@ Things to watch out for:
8
8
9
9
- Items and processes laid out in [CONTRIBUTING.md](./CONTRIBUTING.md) are followed.
10
10
- Twinkle is meant to run on the latest weekly version of MediaWiki as rolled out every Thursday on the English Wikipedia. Backwards compatibility is not guaranteed.
11
-
- The goal is for Twinkle and Morebits to support the same [browsers for which MediaWiki provides Grade A support](https://www.mediawiki.org/wiki/Browser_compatibility), except IE 11. The Twinkle gadget on enwiki is configured so that we can use up to JavaScript version ES6. However, due to the MediaWiki minifier, we must not use keywords from ES2016 or later, such as async/await and RegEx /s flag. New functions from ES2016 or later, such as Array.includes() should be okay since these will not break the minifier.
11
+
- The goal is for Twinkle and Morebits to support the same [browsers for which MediaWiki provides Grade A support](https://www.mediawiki.org/wiki/Browser_compatibility). The Twinkle gadget on enwiki is configured so that we can use up to JavaScript version ES6. However, due to the MediaWiki minifier, we must not use keywords from ES2016 or later, such as async/await and RegEx /s flag. New functions from ES2016 or later, such as Array.includes() should be okay since these will not break the minifier.
12
12
- Certain positional jQuery selectors like `:first`, `:last`, and `:eq` were [deprecated in jQuery version 3.4.0](https://blog.jquery.com/2019/04/10/jquery-3-4-0-released/) and should probably not be reintroduced. Instead, use methods like `.first()`, `.last()`, or `.eq()`.
13
13
14
14
## Updating scripts on Wikipedia
15
15
16
16
There are two ways to upload Twinkle scripts to Wikipedia or another destination. You can do it with a [Perl script](#synchronization-using-syncpl) (recommended) or [manually](#manual-synchronization).
17
17
18
-
After the files are synced, ensure that [MediaWiki:Gadgets-definition][] contains the gadget definition found in [gadget.txt](./gadget.txt) (`sync.pl` will report its status). In addition to the `Twinkle` definition, the gadget installs the `morebits` library as a hidden gadget, making it efficiently available for other tools to use. `Twinkle-pagestyles` is a hidden [peer gadget](https://www.mediawiki.org/wiki/ResourceLoader/Migration_guide_(users)#Gadget_peers) of Twinkle. Before Twinkle has loaded, it adds space where the TW menu would go in the Vector skin, so that the top bar does not "jump".
18
+
After the files are synced, ensure that [MediaWiki:Gadgets-definition][] contains the gadget definition found in [gadget.txt](./gadget.txt) (`deploy.pl` will report its status). In addition to the `Twinkle` definition, the gadget installs the `morebits` library as a hidden gadget, making it efficiently available for other tools to use. `Twinkle-pagestyles` is a hidden [peer gadget](https://www.mediawiki.org/wiki/ResourceLoader/Migration_guide_(users)#Gadget_peers) of Twinkle. Before Twinkle has loaded, it adds space where the TW menu would go in the Vector skin, so that the top bar does not "jump".
19
19
20
20
[select2][] is also uploaded as a hidden gadget for better menus and to take advantage of the Resource Loader over the [Toolforge CDN](https://tools.wmflabs.org/cdnjs/); it is done so under the [MIT license](https://github.com/select2/select2/blob/develop/LICENSE.md). Loading via the ResourceLoader causes it to register as a nodejs/commonjs environment with `module.exports`, so a slight tweak has been made, eliminating that check. Ideally, this will be handled differently (see [external libraries](https://www.mediawiki.org/wiki/ResourceLoader/Migration_guide_for_extension_developers#Special_case_of_external_libraries) and [T108655](https://phabricator.wikimedia.org/T108655). As such, be careful when updating select2 from upstream.
21
21
@@ -51,9 +51,9 @@ Each Twinkle module and dependency lives on the wiki as a separate file. The lis
There is a synchronization script called `sync.pl`, which can be used to deploy updates to on-wiki gadgets, or update the repository based on on-wiki changes. For full details, run `perl sync.pl --help`.
56
+
There is a synchronization script called `deploy.pl`, which can be used to deploy updates to on-wiki gadgets, or update the repository based on on-wiki changes. For full details, run `perl deploy.pl --help`.
57
57
58
58
The program depends on a few Perl modules, namely [`MediaWiki::API`][MediaWiki::API], [`Git::Repository`][Git::Repository], [`File::Slurper`][File::Slurper], and [`Config::General`][Config::General]. These can be installed easily using [`App::cpanminus`][App::cpanminus]:
59
59
@@ -75,25 +75,25 @@ When running the program, you can enter your credentials on the command line usi
75
75
76
76
Using the `deploy` mode, [interface-admins][intadmin] can deploy Twinkle files live to their MediaWiki:Gadget locations. You will need to set up a bot password at [Special:BotPasswords][special_botpass].
If no files are provided, it will just report the status of the gadget. You may also `deploy`**all** files via
81
81
82
-
sync.pl --mode=deploy --all
82
+
deploy.pl --mode=deploy --all
83
83
84
-
Note that for syncing to a non-Enwiki project, you will also need to specify the --lang and/or --family parameters. For instance, to sync the files with`fr.wikiquote.org` you should specify `--lang=fr --family=wikiquote`, such as
84
+
Note that for syncing to a non-Enwiki project, you will also need to specify the --lang and/or --family parameters. For instance, to deploy to`fr.wikiquote.org` you should specify `--lang=fr --family=wikiquote`, such as
When `deploy`ing or `push`ing, the script will attempt to parse the latest on-wiki edit summary for the commit of the last update, and will use that to create an edit summary using the changes committed since then. If it cannot find anything that looks like a commit hash, it will give you the most recent commits for each file and prompt you to enter an edit summary manually.
89
89
90
90
To `pull` user Foobar's changes (i.e. `User:Foobar/morebits.js`) down from the wiki, do:
The `--base` flag operates as a *prefix*; note the presence of the trailing `/`.
99
99
@@ -136,7 +136,7 @@ The `--base` flag operates as a *prefix*; note the presence of the trailing `/`.
136
136
137
137
#### Work instruction
138
138
139
-
If you are an interface admin on English Wikipedia and you want to deploy Twinkle's master branch, and you aren't interested in sync.pl's fancy options, here's a simple work instruction. Don't forget to change the username and password.
139
+
If you are an interface admin on English Wikipedia and you want to deploy Twinkle's master branch, and you aren't interested in deploy.pl's fancy options, here's a simple work instruction. Don't forget to change the username and password.
140
140
141
141
Microsoft Windows:
142
142
```
@@ -163,19 +163,20 @@ Every time:
163
163
- In your browser, go to GitHub, go to your Twinkle fork, and check if it says it is out of date. If so, click "Sync fork"
164
164
- `git pull`
165
165
- `cd scripts`
166
-
- `perl sync.pl --mode=deploy --all`
166
+
- `perl deploy.pl --mode=deploy --all`
167
167
- it'll ask yes/no. type y
168
168
- if it prompts you for any edit summaries, just hit enter to skip
169
169
- there will be lots of "Warning: unable to close filehandle" messages, and some other problems such as displaying ←[0m←[96m for line breaks. you can ignore these. shouldn't be a problem.
170
170
```
171
171
172
172
### Dependencies
173
173
174
-
All the dependencies that Twinkle uses are JavaScript **dev** dependencies. They are not used at all on-wiki and are just used during development. Here's what they are and what they do. This may help with evaluating dependabot patches (dependabot is a GitHub bot that helps keep libraries up to date by submitting pull requests).
174
+
All the dependencies that Twinkle uses are JavaScript **dev** dependencies. They are not used at all on-wiki and are just used during development. Here's what they are and what they do.
175
175
176
176
- eslint - Used by continuous integration for enforcing code linting rules.
177
177
- jest - Used by continuous integration for unit testing.
178
178
- jest-environment-jsdom - Needed for Jest to work.
179
179
- mock-mediawiki - Used by continuous integration for unit testing.
180
180
- mwn - Used when you run `npm start`. `npm start` is what enables localhost testing.
181
-
- Everything else - Dependabot will not usually try to update these unless one of the 5 above dependencies gets out of date. It is probably best to update the above dependencies instead.
181
+
182
+
When updating dependencies, CI should take care of testing most of that. Manually testing `npm start` should be the only additional check needed.
Please include "Twinkle Security" in the subject line and include as much information in the body as you are capable of providing. We will respond as quickly as we are able with further steps.
10
+
Please include "Twinkle Security" in the subject line and include as much information in the body as you are capable of providing. We will respond as quickly as we are able with further steps.
11
11
12
-
If one of use doesn't respond in a timely fashion, you can try to [contact another interface-admin](https://en.wikipedia.org/wiki/Special:ActiveUsers?groups=interface-admin&excludegroups=bot) with the same information.
12
+
If one of us doesn't respond in a timely fashion, you can try to [contact another interface-admin](https://en.wikipedia.org/wiki/Special:ActiveUsers?groups=interface-admin&excludegroups=bot) with the same information.
0 commit comments