Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/eccenux/wiki-to-git
Node.js tool that helps to download Mediwiki page history and push it to a Git repository.
https://github.com/eccenux/wiki-to-git
gadgets git mediawiki wikipedia
Last synced: about 1 month ago
JSON representation
Node.js tool that helps to download Mediwiki page history and push it to a Git repository.
- Host: GitHub
- URL: https://github.com/eccenux/wiki-to-git
- Owner: Eccenux
- Created: 2023-07-11T15:00:34.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-10-22T22:23:47.000Z (about 1 year ago)
- Last Synced: 2024-09-26T05:23:14.579Z (about 2 months ago)
- Topics: gadgets, git, mediawiki, wikipedia
- Language: JavaScript
- Homepage: https://enux.pl/project/en/wiki-git-wiki2git
- Size: 209 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README-classes.md
Awesome Lists containing this project
README
Wiki to Git
==========================Using `Wiki To Git` classes.
I recommend using cmd tools, but you can also use a Node script if you prefer.
## Creating your script
Your export script should use `wiki-to-git` to create a new git repo.
Most of the time you will only need to change the top configuration from the snippet below.
```js
import { LoadData } from 'wiki-to-git';//
// Config.
// change this values to your needs
const site = 'en.wikipedia.org';
const page = 'MediaWiki:Gadget-exampleGadgetScript.js';
const repoName = 'wiki-exampleGadgetScript';
const filename = 'exampleGadgetScript.js';const loader = new LoadData(site);
/**
* Download page history from a MediaWiki site.
*/
console.log('\n\nDownload history for %s.', page);
// this will load
await loader.load(page);
// this will save history as JSON
await loader.saveHistory();
// this just shows a quick info (you can skip this)
loader.info();// You only need to read JSON if you changed it.
// Use load (and saveHistory) xor readHistory.
/**
* Read page history from JSON.
*
loader.history = [];
await loader.readHistory();
loader.info();/**
* Create Git repo.
*/
console.log('\n\nCreating Git repo (%s).', repoName);
loader.repoCreate(repoName);
console.log('\nSave history as %s.', filename);
loader.repoCommit(repoName, filename);
```That's it. Run this script in Node.js and you are done.