rename targetDir to targetFolder in deploy config

This commit is contained in:
陆柯 2022-11-30 13:48:48 +08:00
parent 2d28391d45
commit faa2ad2ef5

View File

@ -317,6 +317,15 @@ function deployToGit (connection) {
return return
} }
function commitMessage (connection) {
const message =
connection.m ||
connection.msg ||
connection.message ||
"Site updated: {{ now('YYYY-MM-DD HH:mm:ss') }}"
return swig.compile(message)(swigHelpers)
}
function git (...connection) { function git (...connection) {
return spawn('git', connection, { return spawn('git', connection, {
cwd: deployDir, cwd: deployDir,
@ -380,16 +389,16 @@ function deployToGit (connection) {
.then(function (exist) { .then(function (exist) {
if (exist) return if (exist) return
// log.info('Setting up Git deployment...') log.info('Setting up Git deployment...')
return setup() return setup()
}) })
.then(() => { .then(() => {
// log.info('Clearing .deploy_git folder...') log.info('Clearing .deploy_git folder...')
return fs.emptyDir(deployDir) return fs.emptyDir(deployDir)
}) })
.then(() => { .then(() => {
const opts = {} const opts = {}
// log.info('Copying files from local folder...') log.info('Copying files from local folder...')
if (typeof ignoreHidden === 'object') { if (typeof ignoreHidden === 'object') {
opts.ignoreHidden = ignoreHidden.public opts.ignoreHidden = ignoreHidden.public
} else { } else {
@ -410,7 +419,7 @@ function deployToGit (connection) {
return fs.copyDir(fromDir, deployDir, opts) return fs.copyDir(fromDir, deployDir, opts)
}) })
.then(() => { .then(() => {
// log.info('Copying files from extend dirs...') log.info('Copying files from extend dirs...')
if (!extendDirs) { if (!extendDirs) {
return return
@ -447,6 +456,15 @@ function deployToGit (connection) {
concurrency: 2 concurrency: 2
}) })
}) })
.then(() => {
if (connection.cname) {
log.info('Adding CNAME')
return fs.writeFile('CNAME', connection.cname, { flag: 'w' }, err => {
console.error(err)
})
}
return
})
.then(() => { .then(() => {
return parseConnection(connection) return parseConnection(connection)
}) })
@ -457,14 +475,5 @@ function deployToGit (connection) {
}) })
} // end of function exec } // end of function exec
function commitMessage (connection) {
const message =
connection.m ||
connection.msg ||
connection.message ||
"Site updated: {{ now('YYYY-MM-DD HH:mm:ss') }}"
return swig.compile(message)(swigHelpers)
}
exec() exec()
} }