Skip to content

Commit

Permalink
chore: drop Node.js 10 (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenjoezhang committed Mar 31, 2021
1 parent b70a66a commit 1a637a0
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 28 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/linter.yml
@@ -0,0 +1,20 @@
name: Linter

on: [push, pull_request]

jobs:
linter:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js 14.x
uses: actions/setup-node@v2
with:
node-version: '14.x'
- name: Install Dependencies
run: npm install
- name: Lint
run: |
npm run eslint
env:
CI: true
46 changes: 46 additions & 0 deletions .github/workflows/tester.yml
@@ -0,0 +1,46 @@
name: Tester

on: [push, pull_request]

jobs:
tester:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
node-version: ['12.x', '14.x']
fail-fast: false
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Install Dependencies
run: npm install
- name: Test
run: npm run test
env:
CI: true
coverage:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
node-version: ['14.x']
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Install Dependencies
run: npm install
- name: Coverage
run: npm run test-cov
env:
CI: true
- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.github_token }}
3 changes: 2 additions & 1 deletion .gitignore
Expand Up @@ -3,4 +3,5 @@ node_modules/
tmp/
*.log
.idea/
.nyc_output/
.nyc_output/
coverage/
21 changes: 0 additions & 21 deletions .travis.yml

This file was deleted.

3 changes: 1 addition & 2 deletions lib/generator.js
@@ -1,13 +1,12 @@
'use strict';

const pagination = require('hexo-pagination');
const { sort } = require('timsort');

module.exports = function(locals) {
const config = this.config;
const posts = locals.posts.sort(config.index_generator.order_by);

sort(posts.data, (a, b) => (b.sticky || 0) - (a.sticky || 0));
posts.data.sort((a, b) => (b.sticky || 0) - (a.sticky || 0));

const paginationDir = config.pagination_dir || 'page';
const path = config.index_generator.path || '';
Expand Down
7 changes: 3 additions & 4 deletions package.json
Expand Up @@ -6,7 +6,7 @@
"scripts": {
"eslint": "eslint .",
"test": "mocha test/index.js",
"test-cov": "nyc npm run test"
"test-cov": "nyc --reporter=lcovonly npm run test"
},
"directories": {
"lib": "./lib"
Expand All @@ -16,7 +16,7 @@
"lib/"
],
"engines": {
"node": ">=10.13.0"
"node": ">=12.9.0"
},
"repository": "hexojs/hexo-generator-index",
"homepage": "http://hexo.io/",
Expand All @@ -37,7 +37,6 @@
"nyc": "^15.0.0"
},
"dependencies": {
"hexo-pagination": "1.0.0",
"timsort": "^0.3.0"
"hexo-pagination": "1.0.0"
}
}

0 comments on commit 1a637a0

Please sign in to comment.