Wikipedia:WikiProject Articles for creation/Helper script/Contributing/Developer setup

Install these programs:

  • Git, to download the code to your computer and upload your changes
  • Node.js and npm, to download the libraries we depend on
  • Grunt, to test the code. (You'll need npm to install Grunt.)

Download the code:

  1. Create a fork of our repository.
  2. Pick a location on your computer to put the code, then clone the fork you just made.
    • Add the upstream. This will allow you to keep your copy of the code up to date. Run
      $ git remote add upstream https://github.com/WPAFC/afch-rewrite.git
      When you want to update your copy, run
      $ git fetch upstream && git checkout master && git merge upstream/master
      

Run the script:

  1. Run npm start and follow the instructions. As the instructions say, you will need to go to https://test.wikipedia.org/wiki/Main_Page?withJS=MediaWiki:Setup-afch-dev.js. Make sure you're logged in. It should show a link to a personal draft for your testing (ending in "Testing AFCH"). Click the link.
  2. In the row of tabs at the top ("User page", "Discussion", "Read", and so on), there should be a "More" menu. Open it. One of the items should be called "Review (AFCH beta)". Click that, and the AFCH interface should open.
  3. Try out the script! For your first action, try clicking "Comment", the yellow button, writing something, and clicking "Post comment". Some text should show up in the browser console. If you want to make it permanent, run AFCH.consts.mockItUp = true; in the browser console, and use the script to post another comment. When you reload the page, your comment should then be there.

Note that you'll need to run grunt build each time you change the style (.less files).

Troubleshooting edit

Checklist if the "Review (AFCH beta)" item didn't appear under the "More" menu:

  • Are you on the Test Wikipedia (that is, does your address bar contain "test.wikipedia.org")? If not, go there.
  • Are you on a draft page (that is, does the title of the page start with Draft:)? Are you viewing the page normally, not in edit mode? If not, go to this page and click "Publish page" on the bottom.
  • Are you currently running npm start in a terminal? If not, run it (in the project directory).
  • Does this page have a line that looks somewhat like mw.loader.load('http://localhost:4444?ctype=text/javascript&title=afch-dev.js', 'text/javascript');? If not, go to this page, copy and paste that line, and click "Publish page".
  • Navigate to http://localhost:4444/ (the number 4444 may be different; check the output of npm start) and make sure it loads. If it says "Parameters 'ctype' and/or 'title' not present.", the server is working fine. If not, check that npm start is running, and if it is, let us know.
  • Navigate to http://localhost:4444?ctype=text/javascript&title=afch-dev.js (again, the number 4444 may be different) and make sure it loads some JavaScript code. If not, check that npm start is running, and if it is, let us know.
  • Check the browser console.
    • Does "Loading failed" appear? Check that you have loaded the certificates in your browser (see the output of npm run generate-certificates or these instructions - ${ca_cert} is usually myCA.pem)

If it's still not there:

  • Go to this page, add console.log('hi!') on a new line, visit this page, and open the browser console; the message "hi!" should be printed. If not, let us know.

Other notes:

Miscellaneous edit

  • If you get a "AFCH error: user not listed", you're probably trying to use the script from the English Wikipedia (https://en.wikipedia.org, the website you're reading right now) rather than the Test Wikipedia (https://test.wikipedia.org). Testing on the English Wikipedia might use real drafts and thus cause confusion, so this script should usually be tested on the Test Wikipedia.