diff --git a/README.md b/README.md index 06a3860..dd22911 100644 --- a/README.md +++ b/README.md @@ -77,7 +77,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-lock.json b/package-lock.json index de05f00..0b515c1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,7 @@ "chalk": "^4.1.2", "hexo-fs": "^3.1.0", "hexo-util": "^2.5.0", - "moment": "^2.29.1", + "luxon": "^2.3.0", "nunjucks": "^3.2.3" }, "devDependencies": { @@ -2619,6 +2619,14 @@ "node": ">=10" } }, + "node_modules/luxon": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/luxon/-/luxon-2.3.0.tgz", + "integrity": "sha512-gv6jZCV+gGIrVKhO90yrsn8qXPKD8HYZJtrUDSfEbow8Tkw84T9OnCyJhWvnJIaIF/tBuiAjZuQHUt1LddX2mg==", + "engines": { + "node": ">=12" + } + }, "node_modules/make-dir": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", @@ -2836,14 +2844,6 @@ "url": "https://github.com/chalk/supports-color?sponsor=1" } }, - "node_modules/moment": { - "version": "2.29.1", - "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.1.tgz", - "integrity": "sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ==", - "engines": { - "node": "*" - } - }, "node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -6030,6 +6030,11 @@ "yallist": "^4.0.0" } }, + "luxon": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/luxon/-/luxon-2.3.0.tgz", + "integrity": "sha512-gv6jZCV+gGIrVKhO90yrsn8qXPKD8HYZJtrUDSfEbow8Tkw84T9OnCyJhWvnJIaIF/tBuiAjZuQHUt1LddX2mg==" + }, "make-dir": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", @@ -6193,11 +6198,6 @@ } } }, - "moment": { - "version": "2.29.1", - "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.1.tgz", - "integrity": "sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ==" - }, "ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", diff --git a/package.json b/package.json index 294df5e..1f20fd8 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "chalk": "^4.1.2", "hexo-fs": "^3.1.0", "hexo-util": "^2.5.0", - "moment": "^2.29.1", + "luxon": "^2.3.0", "nunjucks": "^3.2.3" }, "engines": {