Skip to content

Commit 6c790a0

Browse files
authored
Merge pull request #395 from tw0517tw/filenamify
Switch from filenamify-url to filenamify
2 parents 2f93ce7 + 6ea427b commit 6c790a0

File tree

4 files changed

+83
-182
lines changed

4 files changed

+83
-182
lines changed

lib/index.js

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const findCacheDir = require('find-cache-dir');
22
const Git = require('./git');
3-
const filenamify = require('filenamify-url');
3+
const filenamify = require('filenamify');
44
const copy = require('./util').copy;
55
const getUser = require('./util').getUser;
66
const fs = require('fs-extra');
@@ -10,9 +10,20 @@ const util = require('util');
1010

1111
const log = util.debuglog('gh-pages');
1212

13-
function getCacheDir() {
14-
return findCacheDir({name: 'gh-pages'});
13+
/**
14+
* Get the cache directory.
15+
* @param {string} [optPath] Optional path.
16+
* @returns {string} The full path to the cache directory.
17+
*/
18+
function getCacheDir(optPath) {
19+
const dir = findCacheDir({name: 'gh-pages'});
20+
if (!optPath) {
21+
return dir;
22+
}
23+
24+
return path.join(dir, filenamify(optPath));
1525
}
26+
exports.getCacheDir = getCacheDir;
1627

1728
function getRepo(options) {
1829
if (options.repo) {
@@ -111,7 +122,7 @@ exports.publish = function publish(basePath, config, callback) {
111122
getRepo(options)
112123
.then(repo => {
113124
repoUrl = repo;
114-
const clone = path.join(getCacheDir(), filenamify(repo));
125+
const clone = getCacheDir(repo);
115126
log('Cloning %s into %s', repo, clone);
116127
return Git.clone(repo, clone, options.branch, options);
117128
})

package-lock.json

Lines changed: 21 additions & 177 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"async": "^2.6.1",
3838
"commander": "^2.18.0",
3939
"email-addresses": "^3.0.1",
40-
"filenamify-url": "^1.0.0",
40+
"filenamify": "^4.3.0",
4141
"find-cache-dir": "^3.3.1",
4242
"fs-extra": "^8.1.0",
4343
"globby": "^6.1.0"

0 commit comments

Comments
 (0)