Giter VIP home page Giter VIP logo

wiki-to-git's Introduction

Wiki to Git

Wiki To Git is a tool that helps to download MediaWiki page history and push it to a Git repository.

You can used it to export things like a Wikipedia gadget to some Git server (e.g. GitHub or GitLab or Gitea). Or just export your user script to Git and work on it locally. The history of the Git repo will preserve authors and original messages (original description of changes). Essentially each edit becomes a commit.

Once done, you can start using external tools to edit and analyze the history of the gadget. You can use Wikiploy to deploy your gadget back to Wikipedia. Testing your code will also be easier with things like Mocha/Chai. You can also use build tools like Browserify or Webpack.

Using tools

Basic steps

Step. 1. Install tools via npm (Node.js):

npm i -g wiki-to-git

Step. 2. Load history metadata from wiki (this will create a history.json file):

wiki2git-load --site meta.wikimedia.org -p "User:Nux/global.js"

To see more options use:

wiki2git-load --help

Step. 3. Commit to a new or existing repo:

wiki2git-commit --site meta.wikimedia.org --repo "global-JS-CSS" -o "global.js"

This will automatically:

  1. Create a "global-JS-CSS" repositry.
  2. Download revisions from the site.
  3. Create a file global-JS-CSS/global.js.

That is it. You should check if the history of the git repo is OK and you can push it to your Git server (like e.g. Github).

More files

If you want to download more files, just run similar steps again. The repository will be detected, and commits will be added for the new file.

For example you might want to add CSS:

wiki2git-load --site meta.wikimedia.org -p "User:Nux/global.css"
wiki2git-commit --site meta.wikimedia.org --repo "global-JS-CSS" -o "global.css"

Creating a script (not using cmd)

I recommend using cmd tools, but you can also use a Node script if you prefer. See README-classes.md (on Github).

Troubleshooting

Supported Node versions

You'll need Node.js for this tool and your safest choice is the latest LTS version.

Wiki2git 1.1 has been successfully tested with Node versions 14, 16, 18, and 20.

Review git history

If something goes wrong you might want remove the .git subdirectory from the generated repo and try again.

To check the details of the repo use this:

git log --pretty=fuller

This will show more details then typical log. Note that committer should be your Git account and the author should be an author from the Wiki page history.

External links

wiki-to-git's People

Contributors

eccenux avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.