Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use luxon instead of moment #204

Merged
merged 1 commit into from Jan 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
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
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
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