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

refactor: migrate typescript #418

Merged
merged 10 commits into from
Nov 9, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
rename Bluebird
stevenjoezhang committed Nov 1, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 71cbf4e41623bd34cba7160c89ce4d8e7b94d120
3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
node_modules/
coverage/
tmp/
assets/
assets/
dist/
8 changes: 6 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{
"extends": "hexo",
"root": true
"root": true,
"extends": "hexo/ts.js",
"parserOptions": {
"sourceType": "module",
"ecmaVersion": 2020
}
}
6 changes: 3 additions & 3 deletions lib/console/init.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

import BluebirdPromise from 'bluebird';
import BlueBirdPromise from 'bluebird';
import {join, resolve} from 'path';
import {magenta} from 'picocolors';
import {existsSync, readdirSync, rmdir, unlink, copyDir, readdir, stat} from 'hexo-fs';
@@ -20,7 +20,7 @@ async function initConsole(args) {

if (existsSync(target) && readdirSync(target).length !== 0) {
log.fatal(`${magenta(tildify(target))} not empty, please run \`hexo init\` on an empty folder and then copy your files into it`);
await BluebirdPromise.reject(new Error('target not empty'));
await BlueBirdPromise.reject(new Error('target not empty'));
}

log.info('Cloning hexo-starter', GIT_REPO_URL);
@@ -38,7 +38,7 @@ async function initConsole(args) {
await copyAsset(target);
}

await BluebirdPromise.all([
await BlueBirdPromise.all([
removeGitDir(target),
removeGitModules(target)
]);
6 changes: 3 additions & 3 deletions lib/console/version.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
'use strict';

import os from 'os';
import pkg from '../../package.json';
import BluebirdPromise from 'bluebird';
const pkg =require('../../package.json');
import BlueBirdPromise from 'bluebird';
import {spawn} from 'hexo-util';

async function versionConsole(args) {
@@ -33,7 +33,7 @@ async function versionConsole(args) {
console.log('%s: %s', key, versions[key]);
}

await BluebirdPromise.resolve();
await BlueBirdPromise.resolve();
}

export = versionConsole;
4 changes: 3 additions & 1 deletion lib/context.ts
Original file line number Diff line number Diff line change
@@ -30,7 +30,9 @@ class Context extends EventEmitter {
// Do nothing
}

call(name: string, args: object | Function, callback?: Function) {
call(name: string, args: object, callback: Function);
call(name: string, args: Function);
call(name, args: object | Function, callback?: Function) {
if (!callback && typeof args === 'function') {
callback = args;
args = {};
5 changes: 4 additions & 1 deletion test/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{
"extends": "hexo/test"
"extends": "hexo/test",
"rules": {
"@typescript-eslint/no-var-requires": 0
}
}