wallpaper
Advanced tools
Comparing version 4.2.0 to 4.3.0
10
index.js
'use strict'; | ||
let wallpaper; | ||
if (process.platform === 'darwin') { | ||
module.exports = require('./source/macos'); | ||
wallpaper = require('./source/macos'); | ||
} else if (process.platform === 'win32') { | ||
module.exports = require('./source/win'); | ||
wallpaper = require('./source/win'); | ||
} else { | ||
module.exports = require('./source/linux'); | ||
wallpaper = require('./source/linux'); | ||
} | ||
module.exports = wallpaper; | ||
module.exports.default = wallpaper; |
{ | ||
"name": "wallpaper", | ||
"version": "4.2.0", | ||
"version": "4.3.0", | ||
"description": "Manage the desktop wallpaper", | ||
@@ -16,6 +16,7 @@ "license": "MIT", | ||
"scripts": { | ||
"test": "xo && ava" | ||
"test": "xo && ava && tsd-check" | ||
}, | ||
"files": [ | ||
"index.js", | ||
"index.d.ts", | ||
"source" | ||
@@ -35,5 +36,6 @@ ], | ||
"devDependencies": { | ||
"ava": "^1.0.1", | ||
"xo": "^0.23.0" | ||
"ava": "^1.3.1", | ||
"tsd-check": "^0.3.0", | ||
"xo": "^0.24.0" | ||
} | ||
} |
@@ -16,3 +16,7 @@ # wallpaper [![Build Status](https://travis-ci.org/sindresorhus/wallpaper.svg?branch=master)](https://travis-ci.org/sindresorhus/wallpaper) [![Build status](https://ci.appveyor.com/api/projects/status/xhwaihmhhplh5d05/branch/master?svg=true)](https://ci.appveyor.com/project/sindresorhus/wallpaper/branch/master) | ||
<a href="https://www.patreon.com/sindresorhus"> | ||
<img src="https://c5.patreon.com/external/logo/become_a_patron_button@2x.png" width="160"> | ||
</a> | ||
## Usage | ||
@@ -45,3 +49,3 @@ | ||
Type: `string` `number`<br> | ||
Values: `all` `main` or the index of a screen from `.screens()` | ||
Values: `all` `main` or the index of a screen from `.screens()`<br> | ||
Default: `main` | ||
@@ -59,3 +63,3 @@ | ||
Path to the image to set as the desktop wallpaper. | ||
The path to the image to set as the desktop wallpaper. | ||
@@ -86,3 +90,3 @@ #### options | ||
Returns a promise for an array of screens. | ||
Returns a promise for the available screens. | ||
@@ -89,0 +93,0 @@ ```js |
'use strict'; | ||
const {commandExists, execFile} = require('../util'); | ||
@@ -4,0 +3,0 @@ |
'use strict'; | ||
const {promisify} = require('util'); | ||
const childProcess = require('child_process'); | ||
const util = require('util'); | ||
const fs = require('fs'); | ||
const execFile = util.promisify(childProcess.execFile); | ||
const execFile = promisify(childProcess.execFile); | ||
@@ -27,3 +27,3 @@ exports.commandExists = async cmd => { | ||
exports.execFile = execFile; | ||
exports.exec = util.promisify(childProcess.exec); | ||
exports.readFile = util.promisify(fs.readFile); | ||
exports.exec = promisify(childProcess.exec); | ||
exports.readFile = promisify(fs.readFile); |
'use strict'; | ||
const util = require('util'); | ||
const {promisify} = require('util'); | ||
const path = require('path'); | ||
const childProcess = require('child_process'); | ||
const execFile = util.promisify(childProcess.execFile); | ||
const execFile = promisify(childProcess.execFile); | ||
// Binary source → https://github.com/sindresorhus/macos-wallpaper | ||
const bin = path.join(__dirname, 'macos-wallpaper'); | ||
const binary = path.join(__dirname, 'macos-wallpaper'); | ||
exports.get = async () => { | ||
const {stdout} = await execFile(bin, ['get']); | ||
const {stdout} = await execFile(binary, ['get']); | ||
return stdout.trim(); | ||
@@ -27,3 +27,3 @@ }; | ||
const args = [ | ||
const arguments_ = [ | ||
'set', | ||
@@ -37,8 +37,8 @@ path.resolve(imagePath), | ||
await execFile(bin, args); | ||
await execFile(binary, arguments_); | ||
}; | ||
exports.screens = async () => { | ||
const {stdout} = await execFile(bin, ['screens']); | ||
return stdout.trim().split('\n').map(x => x.replace(/^\d+ - /, '')); | ||
const {stdout} = await execFile(binary, ['screens']); | ||
return stdout.trim().split('\n').map(line => line.replace(/^\d+ - /, '')); | ||
}; |
'use strict'; | ||
const util = require('util'); | ||
const {promisify} = require('util'); | ||
const path = require('path'); | ||
const childProcess = require('child_process'); | ||
const execFile = util.promisify(childProcess.execFile); | ||
const execFile = promisify(childProcess.execFile); | ||
// Binary source → https://github.com/sindresorhus/win-wallpaper | ||
const bin = path.join(__dirname, 'win-wallpaper.exe'); | ||
const binary = path.join(__dirname, 'win-wallpaper.exe'); | ||
exports.get = async () => { | ||
const {stdout} = await execFile(bin); | ||
const {stdout} = await execFile(binary); | ||
return stdout.trim(); | ||
@@ -21,3 +21,3 @@ }; | ||
await execFile(bin, [path.resolve(imagePath)]); | ||
await execFile(binary, [path.resolve(imagePath)]); | ||
}; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
11449875
26
401
108
3
3