Skip to content
This repository has been archived by the owner on Mar 27, 2021. It is now read-only.

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
BerniWittmann committed Mar 20, 2021
0 parents commit e358ed7
Show file tree
Hide file tree
Showing 15 changed files with 832 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .commitlintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
extends:
- '@commitlint/config-conventional'
6 changes: 6 additions & 0 deletions .eslintrc
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": {}
}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/dist
/node_modules
/coverage
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v12.14.1
7 changes: 7 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"semi": true,
"trailingComma": "all",
"singleQuote": true,
"printWidth": 120,
"tabWidth": 2
}
6 changes: 6 additions & 0 deletions .releaserc.yml
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'
24 changes: 24 additions & 0 deletions .travis.yml
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
674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions README.md
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 added git_deploy_key.enc
Binary file not shown.
14 changes: 14 additions & 0 deletions jest.config.js
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,
},
},
};
49 changes: 49 additions & 0 deletions package.json
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"
}
12 changes: 12 additions & 0 deletions src/index.test.ts
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}!`);
});
});
});
3 changes: 3 additions & 0 deletions src/index.ts
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'));
10 changes: 10 additions & 0 deletions tsconfig.json
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"]
}

0 comments on commit e358ed7

Please sign in to comment.