Skip to content

Commit

Permalink
fix: update tersify (#113)
Browse files Browse the repository at this point in the history
* fix: update tersify

and update project

* chore: update github action for cjs/esm

* chore: add missing coverage script
  • Loading branch information
unional authored Dec 6, 2021
1 parent 9d904e0 commit 31f1c51
Show file tree
Hide file tree
Showing 20 changed files with 3,710 additions and 6,562 deletions.
111 changes: 0 additions & 111 deletions .circleci/config.yml

This file was deleted.

2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ node_modules
dist*
lib*
out*
cjs
esm
22 changes: 14 additions & 8 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
{
"env": {
"node": true,
"es6": true,
"jest": true,
"node": true
"jest": true
},
"extends": "plugin:harmony/recommended",
"extends": [
"plugin:harmony/latest"
],
"overrides": [
{
"extends": "plugin:harmony/ts-recommended",
"files": [
"*.ts",
"*.tsx"
]
"*.ts"
],
"parserOptions": {
"project": "tsconfig.json"
},
"rules": {
"no-use-before-define": "off"
}
}
],
"root": true
]
}
151 changes: 151 additions & 0 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
name: nodejs
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
with:
fetch-depth: 1
- name: setup yarn-cache
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: cache yarn global cache
uses: actions/cache@v1
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: cache node_modules
uses: actions/cache@v1
with:
path: node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/yarn.lock') }}
- run: yarn
- run: yarn lint
- run: yarn build
- run: yarn dependency-check
- name: upload cjs folder
uses: actions/upload-artifact@v1
with:
name: cjs
path: cjs
- name: upload esm folder
uses: actions/upload-artifact@v1
with:
name: esm
path: esm
test-nodejs:
runs-on: ubuntu-latest
needs: build
strategy:
matrix:
node-version: [12, 14, 16]
steps:
- uses: actions/checkout@v1
with:
fetch-depth: 1
- name: setup yarn-cache
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: cache yarn global cache
if: runner.os != 'macos-latest'
uses: actions/cache@v1
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: cache node_modules
uses: actions/cache@v1
with:
path: node_modules
key: ${{ runner.os }}-node-modules-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}
- run: yarn
- run: yarn coverage --maxWorkers=2
- name: codecov
if: matrix.node-version == 16
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: codacy
if: github.repository == 'unional/tersify' && matrix.node-version == 16
uses: codacy/codacy-coverage-reporter-action@master
with:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
coverage-reports: coverage/clover.xml
test-platform:
runs-on: ${{ matrix.os }}
needs: build
strategy:
matrix:
os: ['macos-latest', 'windows-latest']
steps:
- uses: actions/checkout@v1
with:
fetch-depth: 1
- name: setup yarn-cache
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: cache yarn global cache
if: runner.os != 'macos-latest'
uses: actions/cache@v1
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: cache node_modules
uses: actions/cache@v1
with:
path: node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/yarn.lock') }}
- run: yarn
- run: yarn coverage --maxWorkers=2
release:
name: release
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
needs:
- test-nodejs
- test-platform
steps:
- uses: actions/checkout@v1
- name: setup yarn-cache
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: cache yarn global cache
uses: actions/cache@v1
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: download cjs folder
uses: actions/download-artifact@v1
with:
name: cjs
- name: download esm folder
uses: actions/download-artifact@v1
with:
name: esm
- name: cache node_modules
uses: actions/cache@v1
with:
path: node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/yarn.lock') }}
- run: yarn
- run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,5 @@ node_modules
dist*
lib*
out*
cjs
esm
7 changes: 7 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"branches": [
"main",
"next",
"beta"
]
}
20 changes: 0 additions & 20 deletions .travis.yml

This file was deleted.

5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,8 @@
"url": "http://json.schemastore.org/tsconfig"
}
],
"eslint.enable": true
"eslint.enable": true,
"cSpell.words": [
"tersify"
]
}
27 changes: 0 additions & 27 deletions .vscode/tasks.json

This file was deleted.

20 changes: 20 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
module.exports = {
presets: [
[
'@babel/preset-env',
{
targets: {
node: 'current',
},
},
],
['@babel/preset-typescript', {
allowNamespaces: true
}],
],
plugins: [
'@babel/plugin-proposal-class-properties',
'@babel/plugin-proposal-optional-chaining',
'@babel/plugin-proposal-nullish-coalescing-operator'
],
};
1 change: 1 addition & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = { extends: ['@commitlint/config-conventional'] }
Loading

0 comments on commit 31f1c51

Please sign in to comment.