diff --git a/README.md b/README.md index afa6e8a..72d5f71 100644 --- a/README.md +++ b/README.md @@ -78,7 +78,7 @@ deploy: branch: branch_name ``` - **branch**: Git branch to deploy the static site to. Branch name specified in `repo:` takes priority. -- **message**: Commit message. Defaults to `Site updated: {{ now('YYYY-MM-DD HH:mm:ss') }}`. +- **message**: Commit message. Defaults to `Site updated: {{ now("yyyy-MM-dd HH:mm:ss") }}`. - **name** and **email**: User info for committing the change, overrides global config. This info is independent of git login. - **extend_dirs**: Additional directories to publish. e.g `demo`, `examples` - **ignore_hidden** (Boolean|Object): whether ignore hidden files to publish. GitHub requires the `.nojekyll` in root. diff --git a/lib/deployer.js b/lib/deployer.js index 0d1f3f6..e140930 100644 --- a/lib/deployer.js +++ b/lib/deployer.js @@ -4,14 +4,14 @@ const pathFn = require('path'); const fs = require('hexo-fs'); const chalk = require('chalk'); const nunjucks = require('nunjucks'); -const moment = require('moment'); +const { DateTime } = require("luxon"); const Promise = require('bluebird'); -const spawn = require('hexo-util/lib/spawn'); +const { spawn } = require('hexo-util'); const parseConfig = require('./parse_config'); const swigHelpers = { now: function(format) { - return moment().format(format); + return DateTime.now().toFormat(format); } }; @@ -149,6 +149,6 @@ module.exports = function(args) { }; function commitMessage(args) { - const message = args.m || args.msg || args.message || 'Site updated: {{ now(\'YYYY-MM-DD HH:mm:ss\') }}'; + const message = args.m || args.msg || args.message || 'Site updated: {{ now("yyyy-MM-dd HH:mm:ss") }}'; return nunjucks.renderString(message, swigHelpers); } diff --git a/package.json b/package.json index 28d1570..3b5a924 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "chalk": "^4.0.0", "hexo-fs": "^3.0.1", "hexo-util": "^2.1.0", - "moment": "^2.18.0", + "luxon": "^1.27.0", "nunjucks": "^3.2.1" }, "engines": {