|
1 | | -I added most of my Wikipedia user scripts to this GitHub to make pull requests/collaboration easier. |
| 1 | +Novem Linguae's Wikipedia user scripts. A user script is custom JavaScript that a logged in Wikipedia user can install, and that JS will then run on every Wikipedia page they visit. The main use case is tools for power users. |
2 | 2 |
|
3 | | -Keep in mind that the versions on Wikipedia may be slightly more up-to-date. |
| 3 | +My list of user scripts onwiki is located at https://en.wikipedia.org/wiki/User:Novem_Linguae/Templates/Scripts. Please visit this page to see a description of each user script, and the # of users that have installed it. |
4 | 4 |
|
5 | | -# Folders |
| 5 | +# Files and folders |
6 | 6 |
|
7 | | -User scripts in folders tend to contain some or all of the following: |
| 7 | +User scripts in the root directory as standalone files are simple and just use that one file. |
8 | 8 |
|
9 | | -- Unit tests (needs npm packages: Jest, Babel) |
10 | | -- PHP tools (meant to be run on localhost) that do something useful related to the script |
11 | | -- publish.php script - compiles multiple files into one file and writes it to my userspace on Wikipedia, requires a publish.config.php file though. See example file publish.config.example.php |
| 9 | +User scripts in folders are more complex scripts usually spanning multiple files, have unit tests, and have a deploy script. These tools are all located in the folder. There may also be PHP or browser tools related to the user script. |
| 10 | + |
| 11 | +# Linter |
| 12 | + |
| 13 | +- Install the linter by running `npm update` from the root directory. The linter is not run in CI, and is mainly for your IDE. |
12 | 14 |
|
13 | 15 | # Unit tests |
14 | 16 |
|
15 | | -I like unit tests. Lots of Wikipedia user scripts can be broken into true functions that input 1 string (wikicode) and output 1 string (wikicode). So they are a perfect fit for unit tests. Userscripts with a lot of unit tests include GANReviewTool, DraftCleaner, and SpeciesHelper. |
| 17 | +- Install unit tests by running `npm update` in applicable subdirectories. Then run the tests with `npm test`. Unit tests are run in CI and should always be passing before merging to the master branch. |
| 18 | + |
| 19 | +# Deploying |
| 20 | + |
| 21 | +- For single file user scripts in the root directory, just copy paste them onwiki. |
| 22 | +- For folders, spin up a PHP localhost, create a publish.config.php file in that folder (see publish.config.example.php as an example), then in browser visit that folder's publish.php file. Then you can click a button to deploy. |
| 23 | + |
| 24 | +# Issues and pull requests |
| 25 | + |
| 26 | +Issues and pull requests are both accepted. Feel free to create some. |
0 commit comments