New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

gh-pages

Package Overview
Dependencies
Maintainers
0
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gh-pages - npm Package Compare versions

Comparing version 6.2.0 to 6.3.0

40

bin/gh-pages.js
#!/usr/bin/env node
const path = require('path');
const {Command} = require('commander');
const addr = require('email-addresses');
const ghpages = require('../lib/index.js');
const {Command} = require('commander');
const path = require('path');
const pkg = require('../package.json');
const addr = require('email-addresses');

@@ -27,3 +27,3 @@ function publish(dist, config) {

'-d, --dist <dist>',
'Base directory for all source files'
'Base directory for all source files',
)

@@ -33,3 +33,3 @@ .option(

'Pattern used to select which files to publish',
ghpages.defaults.src
ghpages.defaults.src,
)

@@ -39,3 +39,3 @@ .option(

'Name of the branch you are pushing to',
ghpages.defaults.branch
ghpages.defaults.branch,
)

@@ -45,3 +45,3 @@ .option(

'Target directory within the destination branch (relative to the root)',
ghpages.defaults.dest
ghpages.defaults.dest,
)

@@ -53,3 +53,3 @@ .option('-a, --add', 'Only add, and never remove existing files')

'commit message',
ghpages.defaults.message
ghpages.defaults.message,
)

@@ -62,3 +62,3 @@ .option('-g, --tag <tag>', 'add tag to commit')

'--cname <CNAME>',
'Add a CNAME file with the name of your custom domain'
'Add a CNAME file with the name of your custom domain',
)

@@ -70,7 +70,7 @@ .option('-r, --repo <repo>', 'URL of the repository you are pushing to')

'The name of the remote',
ghpages.defaults.remote
ghpages.defaults.remote,
)
.option(
'-u, --user <address>',
'The name and email of the user (defaults to the git config). Format is "Your Name <email@example.com>".'
'The name and email of the user (defaults to the git config). Format is "Your Name <email@example.com>".',
)

@@ -81,3 +81,3 @@ .option(

'(ignored if used together with --add).',
ghpages.defaults.remove
ghpages.defaults.remove,
)

@@ -87,7 +87,7 @@ .option('-n, --no-push', 'Commit only (with no push)')

'-f, --no-history',
'Push force new commit without parent history'
'Push force new commit without parent history',
)
.option(
'--before-add <file>',
'Execute the function exported by <file> before "git add"'
'Execute the function exported by <file> before "git add"',
)

@@ -104,3 +104,3 @@ .parse(args);

`Could not parse name and email from user option "${options.user}" ` +
'(format should be "Your Name <email@example.com>")'
'(format should be "Your Name <email@example.com>")',
);

@@ -112,5 +112,7 @@ }

if (options.beforeAdd) {
const m = require(require.resolve(options.beforeAdd, {
paths: [process.cwd()],
}));
const m = require(
require.resolve(options.beforeAdd, {
paths: [process.cwd()],
}),
);

@@ -124,3 +126,3 @@ if (typeof m === 'function') {

`Could not find function to execute before adding files in ` +
`"${options.beforeAdd}".\n `
`"${options.beforeAdd}".\n `,
);

@@ -127,0 +129,0 @@ }

const cp = require('child_process');
const fs = require('fs-extra');
const path = require('path');
const util = require('util');
const fs = require('fs-extra');

@@ -133,3 +133,3 @@ /**

}
}
},
);

@@ -147,3 +147,3 @@ };

}
return this.exec('rm', '--ignore-unmatch', '-r', '-f', ...files);
return this.exec('rm', '--ignore-unmatch', '-r', '-f', '--', ...files);
};

@@ -170,3 +170,3 @@

return this.exec('diff-index', '--quiet', 'HEAD').catch(() =>
this.exec('commit', '-m', message)
this.exec('commit', '-m', message),
);

@@ -212,3 +212,3 @@ };

throw new Error(
'Failed to get repo URL from options or current directory.'
'Failed to get repo URL from options or current directory.',
);

@@ -225,3 +225,3 @@ }

' remote ' +
'or must be configured with the "repo" option).'
'or must be configured with the "repo" option).',
);

@@ -228,0 +228,0 @@ });

@@ -0,10 +1,10 @@

const path = require('path');
const util = require('util');
const filenamify = require('filenamify');
const findCacheDir = require('find-cache-dir');
const fs = require('fs-extra');
const globby = require('globby');
const Git = require('./git.js');
const filenamify = require('filenamify');
const copy = require('./util.js').copy;
const getUser = require('./util.js').getUser;
const fs = require('fs-extra');
const globby = require('globby');
const path = require('path');
const util = require('util');

@@ -26,12 +26,9 @@ const log = util.debuglog('gh-pages');

}
exports.getCacheDir = getCacheDir;
function getRepo(options) {
if (options.repo) {
return Promise.resolve(options.repo);
} else {
const git = new Git(process.cwd(), options.git);
return git.getRemoteUrl(options.remote);
}
}
/**
* Clean the cache directory.
*/
exports.clean = function clean() {
fs.removeSync(getCacheDir());
};

@@ -54,6 +51,17 @@ exports.defaults = {

exports.getCacheDir = getCacheDir;
function getRepo(options) {
if (options.repo) {
return Promise.resolve(options.repo);
} else {
const git = new Git(process.cwd(), options.git);
return git.getRemoteUrl(options.remote);
}
}
/**
* 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.

@@ -113,3 +121,3 @@ * @return {Promise} A promise.

done(
new Error('The pattern in the "src" property didn\'t match any files.')
new Error('The pattern in the "src" property didn\'t match any files.'),
);

@@ -201,3 +209,3 @@ return;

return git;
}
},
);

@@ -207,3 +215,3 @@ })

return Promise.resolve(
options.beforeAdd && options.beforeAdd(git)
options.beforeAdd && options.beforeAdd(git),
).then(() => git);

@@ -256,16 +264,9 @@ })

error = new Error(
'Unspecified error (run without silent option for detail)'
'Unspecified error (run without silent option for detail)',
);
}
done(error);
}
)
},
),
);
};
/**
* Clean the cache directory.
*/
exports.clean = function clean() {
fs.removeSync(getCacheDir());
};
const path = require('path');
const Git = require('./git.js');
const async = require('async');
const fs = require('fs-extra');
const Git = require('./git.js');

@@ -24,3 +24,2 @@ /**

}
exports.uniqueDirs = uniqueDirs;

@@ -70,2 +69,34 @@ /**

}
exports.copy = function (files, base, dest) {
return new Promise((resolve, reject) => {
const pairs = [];
const destFiles = [];
files.forEach((file) => {
const src = path.resolve(base, file);
const relative = path.relative(base, src);
const target = path.join(dest, relative);
pairs.push({
src: src,
dest: target,
});
destFiles.push(target);
});
async.eachSeries(dirsToCreate(destFiles), makeDir, (err) => {
if (err) {
return reject(err);
}
async.each(pairs, copyFile, (err) => {
if (err) {
return reject(err);
} else {
return resolve();
}
});
});
});
};
exports.copyFile = copyFile;
exports.dirsToCreate = dirsToCreate;

@@ -75,4 +106,4 @@

* Copy a file.
* @param {object} obj Object with src and dest properties.
* @param {function(Error)} callback Callback
* @param {Object} obj Object with src and dest properties.
* @param {function(Error):void} callback Callback
*/

@@ -103,3 +134,2 @@ function copyFile(obj, callback) {

}
exports.copyFile = copyFile;

@@ -109,3 +139,3 @@ /**

* @param {string} path Directory path.
* @param {function(Error)} callback Callback.
* @param {function(Error):void} callback Callback.
*/

@@ -136,32 +166,3 @@ function makeDir(path, callback) {

*/
exports.copy = function (files, base, dest) {
return new Promise((resolve, reject) => {
const pairs = [];
const destFiles = [];
files.forEach((file) => {
const src = path.resolve(base, file);
const relative = path.relative(base, src);
const target = path.join(dest, relative);
pairs.push({
src: src,
dest: target,
});
destFiles.push(target);
});
async.eachSeries(dirsToCreate(destFiles), makeDir, (err) => {
if (err) {
return reject(err);
}
async.each(pairs, copyFile, (err) => {
if (err) {
return reject(err);
} else {
return resolve();
}
});
});
});
};
exports.getUser = function (cwd) {

@@ -180,1 +181,3 @@ return Promise.all([

};
exports.uniqueDirs = uniqueDirs;
{
"name": "gh-pages",
"version": "6.2.0",
"version": "6.3.0",
"description": "Publish to a gh-pages branch on GitHub (or any other branch on any other remote)",

@@ -38,3 +38,3 @@ "keywords": [

"async": "^3.2.4",
"commander": "^11.0.0",
"commander": "^13.0.0",
"email-addresses": "^5.0.0",

@@ -49,5 +49,5 @@ "filenamify": "^4.3.0",

"dir-compare": "^5.0.0",
"eslint": "^8.32.0",
"eslint-config-tschaub": "^14.1.2",
"mocha": "^10.2.0",
"eslint": "^9.16.0",
"eslint-config-tschaub": "^15.2.0",
"mocha": "^11.0.1",
"sinon": "^19.0.2",

@@ -59,9 +59,3 @@ "tmp": "^0.2.1"

"gh-pages-clean": "bin/gh-pages-clean.js"
},
"eslintConfig": {
"extends": "tschaub",
"rules": {
"jsdoc/check-examples": "off"
}
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc