Skip to content

Commit

Permalink
Use luxon instead of moment (#204)
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenjoezhang authored Jan 29, 2022
1 parent f14f44b commit 7d93124
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
8 changes: 4 additions & 4 deletions lib/deployer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
};

Expand Down Expand Up @@ -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);
}
28 changes: 14 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down

0 comments on commit 7d93124

Please sign in to comment.