Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assorted updates #452

Merged
merged 4 commits into from
Jan 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: 2

updates:
- package-ecosystem: npm
directory: "/"
schedule:
interval: weekly
open-pull-requests-limit: 10
versioning-strategy: increase-if-necessary

- package-ecosystem: github-actions
directory: "/"
schedule:
interval: weekly
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ jobs:
os:
- ubuntu-latest
node:
- 12
- 14
- 16
- 18

steps:
- name: Clone repository
Expand Down
9 changes: 5 additions & 4 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ exports.defaults = {
/**
* Push a git branch to a remote (pushes gh-pages by default).
* @param {string} basePath The base path.
* @param {Object} config Publish options.
* @param {object} config Publish options.
* @param {Function} callback Callback.
* @return {Promise} A promise.
*/
Expand Down Expand Up @@ -88,12 +88,13 @@ exports.publish = function publish(basePath, config, callback) {

try {
if (!fs.statSync(basePath).isDirectory()) {
done(new Error('The "base" option must be an existing directory'));
return;
const err = new Error('The "base" option must be an existing directory');
done(err);
return Promise.reject(err);
}
} catch (err) {
done(err);
return;
return Promise.reject(err);
}

const files = globby
Expand Down
10 changes: 5 additions & 5 deletions lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ const fs = require('fs-extra');
* @return {Array<string>} List of directory paths.
*/
function uniqueDirs(files) {
const dirs = {};
const dirs = new Set();
files.forEach((filepath) => {
const parts = path.dirname(filepath).split(path.sep);
let partial = parts[0] || '/';
dirs[partial] = true;
dirs.add(partial);
for (let i = 1, ii = parts.length; i < ii; ++i) {
partial = path.join(partial, parts[i]);
dirs[partial] = true;
dirs.add(partial);
}
});
return Object.keys(dirs);
return Array.from(dirs);
}
exports.uniqueDirs = uniqueDirs;

Expand Down Expand Up @@ -70,7 +70,7 @@ exports.dirsToCreate = dirsToCreate;

/**
* Copy a file.
* @param {Object} obj Object with src and dest properties.
* @param {object} obj Object with src and dest properties.
* @param {function(Error)} callback Callback
*/
function copyFile(obj, callback) {
Expand Down
Loading