Skip to content
This repository was archived by the owner on Jun 29, 2022. It is now read-only.

Commit 8ac122e

Browse files
committed
refactor: change code base to TypeScript, better workflow
1 parent 7d89fd3 commit 8ac122e

34 files changed

+6245
-1784
lines changed

.commitlintrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"extends": [
3+
"@commitlint/config-conventional"
4+
]
5+
}

.editorconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 2
6+
tab_width = 2
7+
end_of_line = lf
8+
charset = utf-8
9+
trim_trailing_whitespace = true
10+
insert_final_newline = true

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
lib

.eslintrc.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
const { md, mdx } = require('@1stg/eslint-config/overrides')
2+
3+
module.exports = {
4+
extends: ['plugin:prettier/recommended'],
5+
overrides: [md, mdx],
6+
rules: {
7+
'prettier/prettier': 2,
8+
},
9+
}

.github/workflows/nodejs.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Node CI
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
strategy:
8+
matrix:
9+
node: [8.x, 10.x, 12.x]
10+
os: [macOS-latest, ubuntu-latest]
11+
runs-on: ${{ matrix.os }}
12+
steps:
13+
- uses: actions/checkout@v1
14+
- name: Use Node.js ${{ matrix.node }}
15+
uses: actions/setup-node@v1
16+
with:
17+
node-version: ${{ matrix.node }}
18+
- name: setup yarn
19+
run: |
20+
curl -o- -L https://yarnpkg.com/install.sh | bash
21+
export PATH="$HOME/.yarn/bin:$PATH"
22+
- name: build, lint, test
23+
run: |
24+
yarn --frozen-lockfile
25+
yarn lint
26+
yarn build
27+
yarn test
28+
env:
29+
CI: true
30+
31+
# codecov:
32+
# runs-on: macOS-latest
33+
# needs: build
34+
# steps:
35+
# - name: Report Test Code Coverage
36+
# if: matrix.node == '12.x'
37+
# run: |
38+
# yarn global add codecov codacy-coverage
39+
# codecov
40+
# cat ./coverage/lcov.info | codacy-coverage
41+
# env:
42+
# CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
43+
44+
deploy:
45+
runs-on: macOS-latest
46+
needs: build
47+
steps:
48+
- name: Publish Release and npm Package
49+
if: github.event_name == 'push' && github.ref == 'master' && matrix.node == '12.x'
50+
run: bash deploy.sh
51+
env:
52+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54+
GH_BRANCH: ${{ github.ref }}
55+
GH_REPO: ${{ github.repository }}
56+
57+
codecheck:
58+
runs-on: macOS-latest
59+
needs: [build, deploy]
60+
steps:
61+
- name: Code Check
62+
if: matrix.node == '12.x'
63+
run: |
64+
yarn add -D @codechecks/client @codechecks/build-size-watcher
65+
yarn codechecks
66+
env:
67+
CC_SECRET: ${{ secrets.CC_SECRET }}

.gitignore

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1+
lib
12
node_modules
2-
yarn-error.log
3-
yarn.lock
4-
.idea
5-
.vscode
3+
*.log

.huskyrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require('@1stg/husky-config')

.lintstagedrc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"tests/**/*.{js,json,ts,tsx}": [
3+
"prettier --write",
4+
"git add"
5+
],
6+
"src/*.{js,ts}": [
7+
"eslint --fix",
8+
"git add"
9+
],
10+
"*.md": [
11+
"eslint --fix",
12+
"git add"
13+
]
14+
}

.prettierrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"@1stg/prettier-config"

.remarkrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"plugins": [
3+
"@1stg/remark-config"
4+
]
5+
}

0 commit comments

Comments
 (0)