Comparing version 4.0.0 to 5.0.0
@@ -56,3 +56,3 @@ const findCacheDir = require('find-cache-dir'); | ||
* @param {string} basePath The base path. | ||
* @param {Object} config Publish options. | ||
* @param {object} config Publish options. | ||
* @param {Function} callback Callback. | ||
@@ -92,8 +92,9 @@ * @return {Promise} A promise. | ||
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); | ||
} | ||
@@ -100,0 +101,0 @@ |
@@ -12,13 +12,13 @@ const path = require('path'); | ||
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); | ||
} | ||
@@ -74,3 +74,3 @@ exports.uniqueDirs = uniqueDirs; | ||
* 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 | ||
@@ -77,0 +77,0 @@ */ |
{ | ||
"name": "gh-pages", | ||
"version": "4.0.0", | ||
"version": "5.0.0", | ||
"description": "Publish to a gh-pages branch on GitHub (or any other branch on any other remote)", | ||
@@ -37,5 +37,5 @@ "keywords": [ | ||
"dependencies": { | ||
"async": "^2.6.1", | ||
"async": "^3.2.4", | ||
"commander": "^2.18.0", | ||
"email-addresses": "^3.0.1", | ||
"email-addresses": "^5.0.0", | ||
"filenamify": "^4.3.0", | ||
@@ -47,8 +47,8 @@ "find-cache-dir": "^3.3.1", | ||
"devDependencies": { | ||
"chai": "^4.3.6", | ||
"dir-compare": "^1.8.0", | ||
"eslint": "^8.15.0", | ||
"eslint-config-tschaub": "^14.0.0", | ||
"mocha": "^10.0.0", | ||
"sinon": "^14.0.0", | ||
"chai": "^4.3.7", | ||
"dir-compare": "^4.0.0", | ||
"eslint": "^8.32.0", | ||
"eslint-config-tschaub": "^14.1.2", | ||
"mocha": "^10.2.0", | ||
"sinon": "^15.0.1", | ||
"tmp": "^0.2.1" | ||
@@ -55,0 +55,0 @@ }, |
@@ -358,2 +358,14 @@ | ||
## GitHub Pages Project Sites | ||
There are three types of GitHub Pages sites: [project, user, and organization](https://docs.github.com/en/pages/getting-started-with-github-pages/about-github-pages#types-of-github-pages-sites). Since project sites are not hosted on the root `<user|org>.github.io` domain and instead under a URL path based on the repository name, they often require configuration tweaks for various build tools and frameworks. If not configured properly, a browser will usually log `net::ERR_ABORTED 404` errors when looking for compiled assets. | ||
Examples: | ||
- Create React App (which uses webpack under the hood) [requires the user to set a `"homepage"` property in their `package.json` so that built assets are referenced correctly in the final compiled HTML](https://create-react-app.dev/docs/deployment/#building-for-relative-paths). | ||
- This [has been often been thought of as an issue with `gh-pages`](https://github.com/tschaub/gh-pages/issues/285#issuecomment-805321474), though this package isn't able to control a project's build configuration. | ||
- Vite [requires a `"base"` property in its `vite.config.js`](https://vitejs.dev/guide/static-deploy.html#github-pages) | ||
- Next.js does not support deploying to GitHub Pages [because of an opinionated static export approach that puts all assets under a `_next` direcotry that GitHub Pages ignores](https://github.com/vercel/next.js/issues/9460). | ||
When using a project site, be sure to read the documentation for your particular build tool or framework to learn how to configure correct asset paths. | ||
## Debugging | ||
@@ -397,3 +409,3 @@ | ||
``` | ||
echo 'your_cutom_domain.online' > ./build/CNAME && gh-pages -d build" | ||
echo your_cutom_domain.online > ./build/CNAME && gh-pages -d build" | ||
``` | ||
@@ -400,0 +412,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
38483
807
450
+ Addedasync@3.2.6(transitive)
+ Addedemail-addresses@5.0.0(transitive)
- Removedasync@2.6.4(transitive)
- Removedemail-addresses@3.1.0(transitive)
- Removedlodash@4.17.21(transitive)
Updatedasync@^3.2.4
Updatedemail-addresses@^5.0.0