diff --git a/lib/publish-gh-pages.js b/lib/publish-gh-pages.js index 7b2f6ba162..3877b599a7 100755 --- a/lib/publish-gh-pages.js +++ b/lib/publish-gh-pages.js @@ -110,18 +110,14 @@ shell.exec('git rm -rf .'); shell.cd('../..'); -fromPath = path.join('build', PROJECT_PATH, '/'); -toPath = path.join('build', `${PROJECT_NAME}-${DEPLOYMENT_BRANCH}`); -// In github.io case, project is deployed to root. Need to not recursively -// copy the deployment-branch to be. -excludePath = `${PROJECT_NAME}-${DEPLOYMENT_BRANCH}`; -// cannot use shell.cp because it doesn't support copying dotfiles and we -// need to copy directories like .circleci, for example -// https://github.com/shelljs/shelljs/issues/79 -shell.exec( - `rsync -rtv --exclude=${excludePath} --exclude=.DS_Store ${fromPath} ${ - toPath - }` +shell.cp( + '-R', + // in github.io case, project is deployed to root. need to not recursively + // copy the deployment-branch to be. + // The !(...) represents the same thing as "everything but this" + // Copies everything in /build except the directory after the !. + path.join('build', PROJECT_PATH, `!(${PROJECT_NAME}-${DEPLOYMENT_BRANCH})`), + path.join('build', `${PROJECT_NAME}-${DEPLOYMENT_BRANCH}`) ); shell.cd(path.join('build', `${PROJECT_NAME}-${DEPLOYMENT_BRANCH}`));