Skip to content

Commit

Permalink
Init hexo-symbols-count-time-2
Browse files Browse the repository at this point in the history
  • Loading branch information
uiolee committed Jul 9, 2023
1 parent 28f41ab commit 94d2a2d
Show file tree
Hide file tree
Showing 23 changed files with 5,195 additions and 218 deletions.
22 changes: 22 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
'use strict';
module.exports = {
root: true,
env: {
browser: true,
commonjs: true,
es2021: true,
node: true
},
extends: 'hexo',
overrides: [
{
files: ['test/**'],
extends: 'hexo/test'
}
],
parserOptions: {
ecmaVersion: 'latest'
},
rules: {
}
};
4 changes: 0 additions & 4 deletions .eslintrc.json

This file was deleted.

11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "npm" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
22 changes: 22 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

code:
- '**.js'
- 'lib/**'

doc:
- '**.md'

test:
- 'test/**'

github:
- '.github/*'

action:
- '.github/workflows/**'

dependencies:
- 'package*.json'

dot:
- '.*'
45 changes: 45 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
changelog:
categories:
- title: "code changes"
labels:
- "code"

- title: "New Features"
labels:
- "feat"

- title: "Bug Fixes"
labels:
- "fix"

- title: "Improvements"
labels:
- "improvement"
- "perf"

- title: "Documentation"
labels:
- "doc"

- title: "Dependencies"
labels:
- "dependencies"

- title: "Chore"
labels:
- "github"
- "action"
- "chore"
- "dot"

- title: "Revert"
labels:
- "revert"

- title: "Uncategorized"
labels:
- "*"

exclude:
labels:
- "skip release"
29 changes: 0 additions & 29 deletions .github/stale.yml

This file was deleted.

12 changes: 12 additions & 0 deletions .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: "Pull Request Labeler"
on:
- pull_request_target

jobs:
triage:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v4
46 changes: 46 additions & 0 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Linter

on:
push:
branches: ['main']
paths:
- '**.js?'
- '**.ts?'
- 'lib/**'
- 'test/**'
- '.github/workflows/linter.yml'
pull_request:
paths:
- '**.js?'
- '**.ts?'
- 'lib/**'
- 'test/**'
- '.github/workflows/linter.yml'

jobs:
linter:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: "lts/*"

- uses: actions/cache@v3
with:
path: |
~/.npm
node_modules
key: ${{ runner.OS }}-node-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.OS }}-node-
- name: Install Dependencies
run: npm ci

- name: Lint
run: |
npm run lint
env:
CI: true
46 changes: 46 additions & 0 deletions .github/workflows/npm-publish-github-packages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages

name: Gihub Package

on:
workflow_dispatch:
release:
types: ["published"]

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 'lts/*'
- run: npm ci
- run: npm test

publish-gpr:
needs: test
runs-on: ubuntu-latest
env:
SCOPE: "@${{github.repository_owner}}"
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "lts/*"
registry-url: "https://npm.pkg.github.com/"
# Defaults to the user or organization that owns the workflow file
scope: ${{env.SCOPE}}
token: ${{secrets.GITHUB_TOKEN}}
always-auth: true

- run: |
node .github/workflows/package.js
- run: npm publish --registry=https://npm.pkg.github.com
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
33 changes: 33 additions & 0 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages

name: npmjs Package

on:
workflow_dispatch:
release:
types: ["published"]

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "lts/*"
- run: npm ci
- run: npm test

publish-npm:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "lts/*"
registry-url: https://registry.npmjs.org/
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
8 changes: 8 additions & 0 deletions .github/workflows/package.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
'use strict';

const { readFileSync, writeFileSync } = require('fs');

const pk = JSON.parse(readFileSync('package.json'));
pk.name = pk.name.startsWith('@') ? pk.name : `${process.env.SCOPE}/${pk.name}`;
writeFileSync('package.json', JSON.stringify(pk, null, 2));
console.log(pk.name);
85 changes: 85 additions & 0 deletions .github/workflows/tester.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Tester

on:
push:
branches: ['main']
paths:
- '**.js?'
- '**.ts?'
- 'lib/**'
- 'test/**'
- 'package*.json'
- '.github/workflows/tester.yml'
pull_request:
paths:
- '**.js?'
- '**.ts?'
- 'lib/**'
- 'test/**'
- 'package*.json'
- '.github/workflows/tester.yml'

jobs:
tester:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
fail-fast: false

steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: "lts/*"

- uses: actions/cache@v3
with:
path: |
~/.npm
node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }}
restore-keys: ${{ runner.os }}-node-

- name: Install Dependencies
run: npm ci

- name: Test
run: npm run test

env:
CI: true

coverage:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]

steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: "lts/*"

- uses: actions/cache@v3
with:
path: |
~/.npm
node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }}
restore-keys: ${{ runner.os }}-node-

- name: Install Dependencies
run: npm ci

- name: Coverage
run: npm run test-cov
env:
CI: true

- uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.github_token }}
Loading

0 comments on commit 94d2a2d

Please sign in to comment.