deploy-website
Advanced tools
Comparing version 0.0.4 to 0.0.5
@@ -21,2 +21,3 @@ "use strict"; | ||
const helpers_1 = require("../helpers"); | ||
const fs_1 = require("fs"); | ||
exports.defaults = { | ||
@@ -38,7 +39,14 @@ dest: '.', | ||
const log = util_1.default.debuglog('gh-pages'); | ||
const verbose = util_1.default.debuglog('gh-pages-verbose'); | ||
function getCacheDir() { | ||
return (0, find_cache_dir_1.default)({ name: 'gh-pages' }); | ||
let cache = (0, find_cache_dir_1.default)({ name: 'gh-pages' }); | ||
if (!cache) { | ||
cache = path_1.default.join(process.cwd(), '.cache/gh-pages'); | ||
if (!(0, fs_1.existsSync)(cache)) | ||
(0, fs_1.mkdirSync)(cache, { recursive: true }); | ||
} | ||
return cache; | ||
} | ||
function getRepo(options) { | ||
console.log('getRepo()', JSON.stringify(options)); | ||
verbose('getRepo()', JSON.stringify(options)); | ||
if (options.repo) { | ||
@@ -48,3 +56,3 @@ return Promise.resolve(options.repo); | ||
else { | ||
console.log('process.cwd()', process.cwd()); | ||
verbose('process.cwd()', process.cwd()); | ||
const git = new git_1.Git(process.cwd(), options.git); | ||
@@ -64,3 +72,3 @@ return git.getRemoteUrl(options.remote); | ||
if (err) | ||
console.log('error:', err.message); | ||
verbose('error:', err.message); | ||
return err; | ||
@@ -96,12 +104,12 @@ } | ||
const userPromise = options.user ? Promise.resolve(options.user) : git_1.Git.getUser(); | ||
console.log('ONE'); | ||
verbose('ONE'); | ||
const user = await userPromise; | ||
getRepo(options) | ||
.then(async (repo) => { | ||
console.log('TWO'); | ||
verbose('TWO'); | ||
repoUrl = repo; | ||
const prettyName = (0, filenamify_url_1.default)(repo.replace(/[:@]/gm, '')); | ||
const cacheDir = getCacheDir(); | ||
console.log('cacheDir', cacheDir); | ||
console.log('prettyName', prettyName); | ||
verbose('cacheDir', cacheDir); | ||
verbose('prettyName', prettyName); | ||
const clone = path_1.default.join(cacheDir, prettyName); | ||
@@ -113,3 +121,3 @@ log('Cloning %s into %s', repo, clone); | ||
.then(async (git) => { | ||
console.log('THREE'); | ||
verbose('THREE'); | ||
const url = await git.getRemoteUrl(options.remote); | ||
@@ -130,3 +138,3 @@ if (url !== repoUrl) { | ||
.then(git => { | ||
console.log('FOUR'); | ||
verbose('FOUR'); | ||
// only required if someone mucks with the checkout between builds | ||
@@ -133,0 +141,0 @@ log('Cleaning'); |
{ | ||
"name": "deploy-website", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "Deploy your static website to AWS S3 or GitHub Pages.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
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
33424
898
10