Skip to content

Commit

Permalink
Merge pull request #159 from Krinkle/build
Browse files Browse the repository at this point in the history
build: Add Node 12, fix cache, discontinue Node 8
  • Loading branch information
macbre committed Apr 12, 2020
2 parents 7a41bd4 + 99160b6 commit 8c94d36
Show file tree
Hide file tree
Showing 12 changed files with 1,987 additions and 2,007 deletions.
11 changes: 6 additions & 5 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"extends": "wikimedia",
"env": {
"node": true,
"es6": true
},
"extends": [
"wikimedia",
"wikimedia/node",
"wikimedia/language/es2016"
],
"rules": {
"prefer-const": "off",
"no-console": "off"
}
}
9 changes: 2 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
language: node_js
sudo: false
node_js:
- 12
- 10
- 8
- 6
script: "npm test && npm run-script lint"
cache:
directories:
- node_modules
cache: npm
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
nodemw
======

[MediaWiki API](http://www.mediawiki.org/wiki/API:Main_page) client written in node.js
[MediaWiki API](https://www.mediawiki.org/wiki/API:Main_page) client written in node.js

[![NPM version](https://badge.fury.io/js/nodemw.png)](http://badge.fury.io/js/nodemw)
[![Build Status](https://api.travis-ci.org/macbre/nodemw.svg?branch=devel)](http://travis-ci.org/macbre/nodemw)
[![NPM version](https://badge.fury.io/js/nodemw.svg)](https://www.npmjs.com/package/nodemw)
[![Build Status](https://api.travis-ci.org/macbre/nodemw.svg?branch=devel)](https://travis-ci.org/macbre/nodemw)

[![Download stats](https://nodei.co/npm/nodemw.png?downloads=true&downloadRank=true)](https://nodei.co/npm/nodemw/)

Expand Down
8 changes: 6 additions & 2 deletions examples/getToken.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,15 @@ const Bot = require( '..' ),
} );

wikia.getToken( 'Main_page', 'edit', function ( err, token ) {
if ( err ) { wikia.log( err ); }
if ( err ) {
wikia.log( err );
}
wikia.log( 'Wikia:', token );
} );

wikipedia.getToken( 'Main_page', 'edit', function ( err, token ) {
if ( err ) { wikipedia.log( err ); }
if ( err ) {
wikipedia.log( err );
}
wikipedia.log( 'Wikipedia:', token );
} );
4 changes: 3 additions & 1 deletion examples/meaninglessNamedImages.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@ client.logIn( function () {
} );
let i = 0;
imagesToDo.forEach( function ( item ) {
setTimeout( function () { rename( item ); }, 10000 * i );
setTimeout( function () {
rename( item );
}, 10000 * i );
i++;
} );
console.log( `do przerobienia: ${i}` );
Expand Down
16 changes: 12 additions & 4 deletions examples/purge.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,34 @@ const Bot = require( '..' ),
} );

client.purge( [ 'Pomnik_Bamberki', 'Ratusz' ], function ( err, data ) {
if ( err ) { client.log( err ); }
if ( err ) {
client.log( err );
}
console.log( data );
} );

// purge all articles in a given category (note a "Category:" prefix)
client.purge( 'Category:Ratusz', function ( err, data ) {
if ( err ) { client.log( err ); }
if ( err ) {
client.log( err );
}
console.log( data );
} );

// purge all articles in a given category the old way (before MW 1.21)
client.getPagesInCategory( 'Ratusz', function ( err, pages ) {
if ( err ) { return; }
if ( err ) {
return;
}

const pageIds = pages
.filter( ( page ) => page.ns === 0 )
.map( ( page ) => page.pageid );

client.purge( pageIds, function ( err, data ) {
if ( err ) { client.log( err ); }
if ( err ) {
client.log( err );
}
console.log( data );
} );
} );
4 changes: 3 additions & 1 deletion examples/specialLog2csv.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ async.whilst(
} );
},
function ( err ) {
if ( err ) { throw err; }
if ( err ) {
throw err;
}

client.log( 'Done' );
}
Expand Down
2 changes: 1 addition & 1 deletion examples/wikidata.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class WikiData {
}
}

const data = new WikiData(); // eslint-disable-line one-var
const data = new WikiData();

data.getEntities(
[
Expand Down

0 comments on commit 8c94d36

Please sign in to comment.