Skip to content

Commit

Permalink
Merge pull request #452 from tschaub/updates
Browse files Browse the repository at this point in the history
Assorted updates
  • Loading branch information
tschaub committed Jan 20, 2023
2 parents ef1c90d + bdc342b commit f323e23
Show file tree
Hide file tree
Showing 7 changed files with 634 additions and 413 deletions.
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

0 comments on commit f323e23

Please sign in to comment.