-
Notifications
You must be signed in to change notification settings - Fork 7
/
index.js
52 lines (47 loc) · 1.52 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
const appRoot = require('app-root-path');
const chalk = require('chalk');
const pluginPack = require('./package.json');
const { throwInfo, throwError } = require('./lib/helpers/utils');
require('./lib/highlighter')(hexo);
require('./lib/filters')(hexo);
require('./lib/generators')(hexo);
require('./lib/injector')(hexo);
require('./lib/commands')(hexo);
var themePack;
try {
themePack = require(appRoot + '/node_modules/hexo-theme-aurora/package.json');
} catch (error) {
throwInfo(
'Aurora Plugin',
`Aurora Plugin fail to get current Aurora Theme version from package location, trying to get from themes folder instead...`
);
try {
themePack = require(appRoot + '/themes/aurora/package.json');
} catch (error) {
throwError(
'Aurora Plugin Error',
`Aurora Plugin fail to get current Aurora Theme version, please make sure you have the theme installed.`
);
return;
}
}
hexo.on('generateAfter', function () {
console.log(
chalk.green('INFO ') +
chalk.yellow('API data generated with ') +
chalk.cyan.bold('hexo-plugin-aurora') +
chalk.magenta(' v' + pluginPack.version)
);
});
hexo.on('exit', function () {
console.log(
chalk.green('INFO ') +
'Thanks for using: ' +
chalk.cyan.bold('hexo-plugin-aurora') +
chalk.magenta(' v' + pluginPack.version) +
' & ' +
chalk.cyan.bold('hexo-theme-aurora') +
chalk.magenta(' v' + themePack.version)
);
console.log(chalk.green('INFO ') + 'Crafted by ' + chalk.cyan.bold('bennyxguo <三钻>'));
});