From faa2ad2ef5d1e84b1143318609fd5707df5e687b Mon Sep 17 00:00:00 2001 From: "luk.lu" Date: Wed, 30 Nov 2022 13:48:48 +0800 Subject: [PATCH] rename targetDir to targetFolder in deploy config --- deploy.js | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/deploy.js b/deploy.js index b62c6f3..1c72cf0 100644 --- a/deploy.js +++ b/deploy.js @@ -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() }