This repository has been archived by the owner on Mar 27, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit e358ed7
Showing
15 changed files
with
832 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
extends: | ||
- '@commitlint/config-conventional' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"parser": "@typescript-eslint/parser", | ||
"extends": ["plugin:@typescript-eslint/recommended"], | ||
"parserOptions": { "ecmaVersion": 2018, "sourceType": "module" }, | ||
"rules": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/dist | ||
/node_modules | ||
/coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
v12.14.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"semi": true, | ||
"trailingComma": "all", | ||
"singleQuote": true, | ||
"printWidth": 120, | ||
"tabWidth": 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
repositoryUrl: [email protected]:silver-xu/ts-module-boilerplate.git | ||
plugins: | ||
- '@semantic-release/commit-analyzer' | ||
- '@semantic-release/release-notes-generator' | ||
- '@semantic-release/npm' | ||
- '@semantic-release/git' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
language: node_js | ||
node_js: | ||
- '12.14.1' | ||
jobs: | ||
include: | ||
- stage: test | ||
script: yarn test | ||
after_success: | ||
- yarn codecov | ||
- stage: publish | ||
if: branch = master | ||
script: semantic-release | ||
before_install: | ||
- openssl aes-256-cbc -K $encrypted_7d58c9ef7168_key -iv $encrypted_7d58c9ef7168_iv -in git_deploy_key.enc -out /tmp/git_deploy_key -d | ||
- chmod 600 /tmp/git_deploy_key | ||
- echo 'echo ${SSH_PASSPHRASE}' > /tmp/askpass && chmod +x /tmp/askpass | ||
- eval "$(ssh-agent -s)" | ||
- DISPLAY=":0.0" SSH_ASKPASS="/tmp/askpass" setsid ssh-add /tmp/git_deploy_key </dev/null | ||
notifications: | ||
email: | ||
recipients: | ||
- [email protected] | ||
on_success: always | ||
on_failure: always |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# TS Module Boilerplate [![Build Status](https://travis-ci.org/silver-xu/ts-module-boilerplate.svg?branch=master)](https://travis-ci.org/silver-xu/ts-module-boilerplate) [![codecov](https://codecov.io/gh/silver-xu/ts-module-boilerplate/branch/master/graph/badge.svg)](https://codecov.io/gh/silver-xu/ts-module-boilerplate) [![greenkeeper](https://badges.greenkeeper.io/silver-xu/ts-module-boilerplate.svg?style=flat)](https://badges.greenkeeper.io/silver-xu/ts-module-boilerplate.svg?style=flat) | ||
|
||
> Typescript Module boilerplate powered by ESlint, Prettier, Husky, Semantic-Release and Commitlint | ||
## Summary | ||
|
||
> This repo is built to start Typescript module projets quickly without missing the essential development tools and build pipelines. | ||
> Please feel free to fork and use as your own project template. | ||
## Features | ||
|
||
- Typescript support | ||
- Linting with ESLint | ||
- Prettier Support | ||
- Travis CI Integration | ||
- Codecov Integration | ||
- Jest Integration | ||
- Linting check @ pre-commit | ||
- Semantic-Release | ||
- Commitlint |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
module.exports = { | ||
roots: ['src'], | ||
transform: { '\\.ts$': ['ts-jest'] }, | ||
collectCoverage: true, | ||
collectCoverageFrom: ['src/**/*.{ts,js}'], | ||
coverageThreshold: { | ||
global: { | ||
branches: 80, | ||
functions: 80, | ||
lines: 80, | ||
statements: -10, | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
{ | ||
"name": "ts-module-boilerplate", | ||
"description": "Typescript npm module boilerplate", | ||
"main": "dist/index.js", | ||
"scripts": { | ||
"start": "yarn build && node dist/index", | ||
"build": "tsc", | ||
"lint": "eslint src/**/*.ts", | ||
"format": "eslint src/**/*.ts --fix", | ||
"test": "jest", | ||
"codecov": "codecov", | ||
"semantic-release": "semantic-release" | ||
}, | ||
"author": "Silver Xu", | ||
"license": "AGPL-3.0-only", | ||
"devDependencies": { | ||
"@commitlint/cli": "^8.3.4", | ||
"@commitlint/config-conventional": "^8.3.4", | ||
"@semantic-release/commit-analyzer": "^8.0.0", | ||
"@semantic-release/git": "^9.0.0", | ||
"@semantic-release/npm": "^7.0.0", | ||
"@semantic-release/release-notes-generator": "^9.0.0", | ||
"@types/jest": "^25.1.0", | ||
"@semantic-release/commit-analyzer": "^7.0.0", | ||
"@semantic-release/git": "^8.0.0", | ||
"@semantic-release/npm": "^6.0.0", | ||
"@semantic-release/release-notes-generator": "^7.3.5", | ||
"@typescript-eslint/eslint-plugin": "^2.15.0", | ||
"@typescript-eslint/parser": "^2.15.0", | ||
"codecov": "^3.6.1", | ||
"eslint": "^6.8.0", | ||
"husky": "^4.0.6", | ||
"jest": "^24.9.0", | ||
"semantic-release": "^17.0.0", | ||
"ts-jest": "^25.1.0", | ||
"typescript": "^3.7.4" | ||
}, | ||
"husky": { | ||
"hooks": { | ||
"pre-commit": "yarn lint", | ||
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS" | ||
} | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/silver-xu/ts-module-boilerplate.git" | ||
}, | ||
"version": "1.1.3" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { greet } from '.'; | ||
|
||
describe('index', () => { | ||
describe('greet', () => { | ||
it('should return greeting with name specified', () => { | ||
const testName = 'testName'; | ||
const greetingPhrase = greet(testName); | ||
|
||
expect(greetingPhrase).toEqual(`Hi ${testName}!`); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export const greet = (name: string): string => `Hi ${name}!`; | ||
|
||
console.log(greet('World')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "es2018", | ||
"module": "commonjs", | ||
"outDir": "dist", | ||
"sourceMap": true | ||
}, | ||
"include": ["src/**/*.ts"], | ||
"exclude": ["node_modules"] | ||
} |