Skip to content

Commit

Permalink
Require Node.js 12
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed May 27, 2021
1 parent dbab2b6 commit 4ede4fc
Show file tree
Hide file tree
Showing 25 changed files with 48 additions and 52 deletions.
4 changes: 0 additions & 4 deletions .github/funding.yml

This file was deleted.

5 changes: 2 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@ jobs:
fail-fast: false
matrix:
node-version:
- 16
- 14
- 12
- 10
- 8
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- run: npm install
Expand Down
13 changes: 7 additions & 6 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,13 @@ declare namespace wallpaper {
}
}

// eslint-disable-next-line no-redeclare
declare const wallpaper: {
// TODO: remove this in the next major version
// when removed, each of the methods in this interface can be refactored to an explicit function export
// and `wallpaper` namespace may be removed completely along with the `export = wallpaper` export.
default: typeof wallpaper;

/**
Get the path to the wallpaper image currently set.
Expand Down Expand Up @@ -104,12 +110,7 @@ declare const wallpaper: {
})();
```
*/
setSolidColor?(rgbHexColor: string, options?: wallpaper.SetOptions): Promise<void>

// TODO: remove this in the next major version
// when removed, each of the methods in this interface can be refactored to an explicit function export
// and `wallpaper` namespace may be removed completely along with the `export = wallpaper` export.
default: typeof wallpaper;
setSolidColor?(rgbHexColor: string, options?: wallpaper.SetOptions): Promise<void>;
};

export = wallpaper;
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

let wallpaper;
if (process.platform === 'darwin') {
wallpaper = require('./source/macos');
wallpaper = require('./source/macos.js');
} else if (process.platform === 'win32') {
wallpaper = require('./source/win');
wallpaper = require('./source/windows.js');
} else {
wallpaper = require('./source/linux');
wallpaper = require('./source/linux.js');
}

module.exports = wallpaper;
Expand Down
2 changes: 1 addition & 1 deletion license
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) Sindre Sorhus <[email protected]> (sindresorhus.com)
Copyright (c) Sindre Sorhus <[email protected]> (https://sindresorhus.com)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
"author": {
"name": "Sindre Sorhus",
"email": "[email protected]",
"url": "sindresorhus.com"
"url": "https://sindresorhus.com"
},
"engines": {
"node": ">=8"
"node": ">=12"
},
"scripts": {
"test": "xo && ava && tsd"
Expand All @@ -33,8 +33,8 @@
],
"devDependencies": {
"ava": "^2.1.0",
"tsd": "^0.7.1",
"xo": "^0.24.0"
"tsd": "^0.15.1",
"xo": "^0.39.0"
},
"ava": {
"serial": true
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

> Get or set the desktop wallpaper
Works on macOS 10.12+, Linux, and Windows 10+.
Works on macOS 10.14.4+, Linux, and Windows 10+.

*Maintainer needed for the Linux part of the code. No new Linux-related changes will be accepted until someone with good Linux knowledge volunteers.*

Expand Down
4 changes: 2 additions & 2 deletions source/linux/background-managers/cinnamon.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
const {commandExists, execFile, hasLine} = require('../util');
const {commandExists, execFile, hasLine} = require('../util.js');

exports.isAvailable = async () => {
if (!await commandExists('gsettings')) {
Expand All @@ -9,7 +9,7 @@ exports.isAvailable = async () => {
try {
const {stdout} = await execFile('gsettings', ['list-schemas']);
return hasLine(stdout, 'org.cinnamon.desktop.background');
} catch (_) {
} catch {
return false;
}
};
Expand Down
2 changes: 1 addition & 1 deletion source/linux/background-managers/dconf.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
const {commandExists, execFile} = require('../util');
const {commandExists, execFile} = require('../util.js');

exports.isAvailable = () => commandExists('dconf');

Expand Down
2 changes: 1 addition & 1 deletion source/linux/background-managers/dcop.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
const {commandExists, execFile} = require('../util');
const {commandExists, execFile} = require('../util.js');

exports.isAvailable = () => commandExists('dcop');

Expand Down
2 changes: 1 addition & 1 deletion source/linux/background-managers/feh.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
const {commandExists, execFile} = require('../util');
const {commandExists, execFile} = require('../util.js');

exports.isAvailable = () => commandExists('feh');

Expand Down
2 changes: 1 addition & 1 deletion source/linux/background-managers/gconftool-2.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
const {commandExists, execFile} = require('../util');
const {commandExists, execFile} = require('../util.js');

exports.isAvailable = () => commandExists('gconftool-2');

Expand Down
2 changes: 1 addition & 1 deletion source/linux/background-managers/gnome.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
const {commandExists, execFile} = require('../util');
const {commandExists, execFile} = require('../util.js');

exports.isAvailable = () => commandExists('gsettings');

Expand Down
24 changes: 12 additions & 12 deletions source/linux/background-managers/index.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
'use strict';

module.exports = {
cinnamon: require('./cinnamon'),
dconf: require('./dconf'),
dcop: require('./dcop'),
feh: require('./feh'),
gconftool2: require('./gconftool-2'),
gnome: require('./gnome'),
mate: require('./mate'),
nitrogen: require('./nitrogen'),
pcmanfm: require('./pcmanfm'),
qdbus: require('./qdbus'),
setroot: require('./setroot'),
xfconfquery: require('./xfconf-query')
cinnamon: require('./cinnamon.js'),
dconf: require('./dconf.js'),
dcop: require('./dcop.js'),
feh: require('./feh.js'),
gconftool2: require('./gconftool-2.js'),
gnome: require('./gnome.js'),
mate: require('./mate.js'),
nitrogen: require('./nitrogen.js'),
pcmanfm: require('./pcmanfm.js'),
qdbus: require('./qdbus.js'),
setroot: require('./setroot.js'),
xfconfquery: require('./xfconf-query.js')
};
4 changes: 2 additions & 2 deletions source/linux/background-managers/mate.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
const {commandExists, execFile, hasLine} = require('../util');
const {commandExists, execFile, hasLine} = require('../util.js');

exports.isAvailable = async () => {
if (!await commandExists('gsettings')) {
Expand All @@ -9,7 +9,7 @@ exports.isAvailable = async () => {
try {
const {stdout} = await execFile('gsettings', ['list-schemas']);
return hasLine(stdout, 'org.mate.background');
} catch (_) {
} catch {
return false;
}
};
Expand Down
2 changes: 1 addition & 1 deletion source/linux/background-managers/nitrogen.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';
const path = require('path');
const os = require('os');
const {commandExists, execFile, readFile} = require('../util');
const {commandExists, execFile, readFile} = require('../util.js');

const homeDir = os.homedir();

Expand Down
2 changes: 1 addition & 1 deletion source/linux/background-managers/pcmanfm.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
const {commandExists, execFile} = require('../util');
const {commandExists, execFile} = require('../util.js');

exports.isAvailable = () => commandExists('pcmanfm');

Expand Down
2 changes: 1 addition & 1 deletion source/linux/background-managers/qdbus.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
const {commandExists, execFile} = require('../util');
const {commandExists, execFile} = require('../util.js');

exports.isAvailable = () => commandExists('qdbus');

Expand Down
2 changes: 1 addition & 1 deletion source/linux/background-managers/setroot.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
const {commandExists, execFile} = require('../util');
const {commandExists, execFile} = require('../util.js');

exports.isAvailable = () => commandExists('setroot');

Expand Down
2 changes: 1 addition & 1 deletion source/linux/background-managers/xfconf-query.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
const {commandExists, execFile} = require('../util');
const {commandExists, execFile} = require('../util.js');

exports.isAvailable = () => commandExists('xfconf-query');

Expand Down
2 changes: 1 addition & 1 deletion source/linux/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';
const path = require('path');
const managers = require('./background-managers');
const managers = require('./background-managers.js');

let availableApps;

Expand Down
2 changes: 1 addition & 1 deletion source/linux/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ exports.commandExists = async cmd => {
}

return true;
} catch (_) {
} catch {
return false;
}
};
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion source/win.js → source/windows.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const childProcess = require('child_process');
const execFile = promisify(childProcess.execFile);

// Binary source → https://github.com/sindresorhus/win-wallpaper
const binary = path.join(__dirname, 'win-wallpaper.exe');
const binary = path.join(__dirname, 'windows-wallpaper.exe');

exports.get = async () => {
const {stdout} = await execFile(binary);
Expand Down
2 changes: 1 addition & 1 deletion test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import path from 'path';
import test from 'ava';
import wallpaper from '.';
import wallpaper from './index.js';

const MACOS_COLOR_PLACEHOLDER_PATH = '/System/Library/PreferencePanes/DesktopScreenEffectsPref.prefPane/Contents/Resources/DesktopPictures.prefPane/Contents/Resources/Transparent.tiff';

Expand Down

0 comments on commit 4ede4fc

Please sign in to comment.