npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

wiki-to-git

v1.1.1

Published

Node.js tool that helps to download Mediwiki page history and push it to a Git repository.

Downloads

4

Readme

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 e.g. export your a 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 history of the gadget. You can use Wikiploy to deploy your gadget back to Wikipedia. You can also test easier with things like Mocha/Chai. You can also use build tools like Browserify or Webpack. Wikiploy will also help in deploying dev/test versions.

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

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