npm.io
0.0.2 • Published 4 years ago

wp-plugin-installer

Licence
ISC
Version
0.0.2
Deps
3
Size
6 kB
Vulns
23
Weekly
0
Stars
1

wp-plugin-installer

Experimental package for installing WordPress plug-ins with Node.js

Installing

Using npm:

$ npm install --save wp-plugin-installer

Example

Loading
const installer = require('wp-plugin-installer');
Logging in

Before you can install plug-ins you have to authenticate with the website. This is done using the async login function:

await installer.login({
  url: 'https://wordpress.local',
  user: 'username/email',
  password: 'password',
});
Installing plug-ins

After authenticating you can install plug-ins with the async install function:

const pluginFile = fs.createReadStream('./plugin.zip');
await installer.install(pluginFile);

The plug-in will be installed on the website and will be activated automatically. To change this behaviour you can use the activate option:

const pluginFile = fs.createReadStream('./plugin.zip');
await installer.install(pluginFile, {
  activate: false,
});