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
}
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) {
return spawn('git', connection, {
cwd: deployDir,
@ -380,16 +389,16 @@ function deployToGit (connection) {
.then(function (exist) {
if (exist) return
// log.info('Setting up Git deployment...')
log.info('Setting up Git deployment...')
return setup()
})
.then(() => {
// log.info('Clearing .deploy_git folder...')
log.info('Clearing .deploy_git folder...')
return fs.emptyDir(deployDir)
})
.then(() => {
const opts = {}
// log.info('Copying files from local folder...')
log.info('Copying files from local folder...')
if (typeof ignoreHidden === 'object') {
opts.ignoreHidden = ignoreHidden.public
} else {
@ -410,7 +419,7 @@ function deployToGit (connection) {
return fs.copyDir(fromDir, deployDir, opts)
})
.then(() => {
// log.info('Copying files from extend dirs...')
log.info('Copying files from extend dirs...')
if (!extendDirs) {
return
@ -447,6 +456,15 @@ function deployToGit (connection) {
concurrency: 2
})
})
.then(() => {
if (connection.cname) {
log.info('Adding CNAME')
return fs.writeFile('CNAME', connection.cname, { flag: 'w' }, err => {
console.error(err)
})
}
return
})
.then(() => {
return parseConnection(connection)
})
@ -457,14 +475,5 @@ function deployToGit (connection) {
})
} // 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()
}