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,KAAK,EAAI,IAAK,eAEnC,EAAQ,QACV,IAAI,wBAAyB,EAAQ,OACrC,GAAG,cAAc,KAAK,KAAK,EAAI,IAAK,SAAU,EAAQ,QAExD,IAAI,iBACG,KAAK,EAAO,EAAU,KAAK,KAAK,EAAI,IAAK,EAAQ,OAAO,MAC7D,WACE,OAAO,CACT,OAGH,MAAM,GACE,QAAQ,QACb,EAAQ,WAAa,EAAQ,UAAU,IACvC,MAAK,IAAM,MAEd,MAAM,IACL,IAAI,cACG,EAAI,IAAI,QAEhB,MAAM,GACA,EAGE,EAAI,KAAK,SAAU,aAAc,EAAK,OAAO,MAAK,IAClD,EAAK,KAGH,EAAI,KAAK,SAAU,YAAa,EAAK,MAFnC,IAJF,IASV,MAAM,IACL,IAAI,cACG,EAAI,OAAO,EAAQ,YAE3B,MAAM,GACD,EAAQ,KACV,IAAI,WACG,EAAI,IAAI,EAAQ,KAAK,OAAO,IAEjC,IAAI,GACJ,IAAI,8BACG,MAGF,IAGV,MAAM,GACD,EAAQ,MACV,IAAI,WACG,EAAI,KAAK,EAAQ,OAAQ,EAAQ,QAAS,EAAQ,UAElD,IAGV,MACC,IAAM,MACL,IACK,EAAQ,SACV,EAAQ,IAAI,MACV,6DAGJ,EAAK,EAAM,KAIrB","file":"/npm/gh-pages@6.3.0/lib/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.37.0.\n * Original file: /npm/gh-pages@6.3.0/lib/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","const path = require('path');\nconst util = require('util');\nconst filenamify = require('filenamify');\nconst findCacheDir = require('find-cache-dir');\nconst fs = require('fs-extra');\nconst globby = require('globby');\nconst Git = require('./git.js');\nconst copy = require('./util.js').copy;\nconst getUser = require('./util.js').getUser;\n\nconst log = util.debuglog('gh-pages');\n\n/**\n * Get the cache directory.\n * @param {string} [optPath] Optional path.\n * @return {string} The full path to the cache directory.\n */\nfunction getCacheDir(optPath) {\n  const dir = findCacheDir({name: 'gh-pages'});\n  if (!optPath) {\n    return dir;\n  }\n\n  return path.join(dir, filenamify(optPath));\n}\n\n/**\n * Clean the cache directory.\n */\nexports.clean = function clean() {\n  fs.removeSync(getCacheDir());\n};\n\nexports.defaults = {\n  dest: '.',\n  add: false,\n  git: 'git',\n  depth: 1,\n  dotfiles: false,\n  branch: 'gh-pages',\n  remote: 'origin',\n  src: '**/*',\n  remove: '.',\n  push: true,\n  history: true,\n  message: 'Updates',\n  silent: false,\n};\n\nexports.getCacheDir = getCacheDir;\n\nfunction getRepo(options) {\n  if (options.repo) {\n    return Promise.resolve(options.repo);\n  } else {\n    const git = new Git(process.cwd(), options.git);\n    return git.getRemoteUrl(options.remote);\n  }\n}\n\n/**\n * Push a git branch to a remote (pushes gh-pages by default).\n * @param {string} basePath The base path.\n * @param {Object} config Publish options.\n * @param {Function} callback Callback.\n * @return {Promise} A promise.\n */\nexports.publish = function publish(basePath, config, callback) {\n  if (typeof config === 'function') {\n    callback = config;\n    config = {};\n  }\n\n  const options = Object.assign({}, exports.defaults, config);\n\n  // For backward compatibility before fixing #334\n  if (options.only) {\n    options.remove = options.only;\n  }\n\n  if (!callback) {\n    callback = function (err) {\n      if (err) {\n        log(err.message);\n      }\n    };\n  }\n\n  function done(err) {\n    try {\n      callback(err);\n    } catch (err2) {\n      log('Publish callback threw: %s', err2.message);\n    }\n  }\n\n  try {\n    if (!fs.statSync(basePath).isDirectory()) {\n      const err = new Error('The \"base\" option must be an existing directory');\n      done(err);\n      return Promise.reject(err);\n    }\n  } catch (err) {\n    done(err);\n    return Promise.reject(err);\n  }\n\n  const files = globby\n    .sync(options.src, {\n      cwd: basePath,\n      dot: options.dotfiles,\n    })\n    .filter((file) => {\n      return !fs.statSync(path.join(basePath, file)).isDirectory();\n    });\n\n  if (!Array.isArray(files) || files.length === 0) {\n    done(\n      new Error('The pattern in the \"src\" property didn\\'t match any files.'),\n    );\n    return;\n  }\n\n  let repoUrl;\n  let userPromise;\n  if (options.user) {\n    userPromise = Promise.resolve(options.user);\n  } else {\n    userPromise = getUser();\n  }\n  return userPromise.then((user) =>\n    getRepo(options)\n      .then((repo) => {\n        repoUrl = repo;\n        const clone = getCacheDir(repo);\n        log('Cloning %s into %s', repo, clone);\n        return Git.clone(repo, clone, options.branch, options);\n      })\n      .then((git) => {\n        return git.getRemoteUrl(options.remote).then((url) => {\n          if (url !== repoUrl) {\n            const message =\n              'Remote url mismatch.  Got \"' +\n              url +\n              '\" ' +\n              'but expected \"' +\n              repoUrl +\n              '\" in ' +\n              git.cwd +\n              '.  Try running the `gh-pages-clean` script first.';\n            throw new Error(message);\n          }\n          return git;\n        });\n      })\n      .then((git) => {\n        // only required if someone mucks with the checkout between builds\n        log('Cleaning');\n        return git.clean();\n      })\n      .then((git) => {\n        log('Fetching %s', options.remote);\n        return git.fetch(options.remote);\n      })\n      .then((git) => {\n        log('Checking out %s/%s ', options.remote, options.branch);\n        return git.checkout(options.remote, options.branch);\n      })\n      .then((git) => {\n        if (!options.history) {\n          return git.deleteRef(options.branch);\n        } else {\n          return git;\n        }\n      })\n      .then((git) => {\n        if (options.add) {\n          return git;\n        }\n\n        log('Removing files');\n        const files = globby\n          .sync(options.remove, {\n            cwd: path.join(git.cwd, options.dest),\n          })\n          .map((file) => path.join(options.dest, file));\n        if (files.length > 0) {\n          return git.rm(files);\n        } else {\n          return git;\n        }\n      })\n      .then((git) => {\n        if (options.nojekyll) {\n          log('Creating .nojekyll');\n          fs.createFileSync(path.join(git.cwd, '.nojekyll'));\n        }\n        if (options.cname) {\n          log('Creating CNAME for %s', options.cname);\n          fs.writeFileSync(path.join(git.cwd, 'CNAME'), options.cname);\n        }\n        log('Copying files');\n        return copy(files, basePath, path.join(git.cwd, options.dest)).then(\n          function () {\n            return git;\n          },\n        );\n      })\n      .then((git) => {\n        return Promise.resolve(\n          options.beforeAdd && options.beforeAdd(git),\n        ).then(() => git);\n      })\n      .then((git) => {\n        log('Adding all');\n        return git.add('.');\n      })\n      .then((git) => {\n        if (!user) {\n          return git;\n        }\n        return git.exec('config', 'user.email', user.email).then(() => {\n          if (!user.name) {\n            return git;\n          }\n          return git.exec('config', 'user.name', user.name);\n        });\n      })\n      .then((git) => {\n        log('Committing');\n        return git.commit(options.message);\n      })\n      .then((git) => {\n        if (options.tag) {\n          log('Tagging');\n          return git.tag(options.tag).catch((error) => {\n            // tagging failed probably because this tag alredy exists\n            log(error);\n            log('Tagging failed, continuing');\n            return git;\n          });\n        } else {\n          return git;\n        }\n      })\n      .then((git) => {\n        if (options.push) {\n          log('Pushing');\n          return git.push(options.remote, options.branch, !options.history);\n        } else {\n          return git;\n        }\n      })\n      .then(\n        () => done(),\n        (error) => {\n          if (options.silent) {\n            error = new Error(\n              'Unspecified error (run without silent option for detail)',\n            );\n          }\n          done(error);\n        },\n      ),\n  );\n};\n"]}