generated from hideokamoto/my-ts-project-template
-
Notifications
You must be signed in to change notification settings - Fork 0
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 1adb667
Showing
18 changed files
with
6,583 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 @@ | ||
export CONVENTIONAL_GITHUB_RELEASER_TOKEN=xxxxxxx |
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 @@ | ||
docs/ | ||
examples/ |
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,25 @@ | ||
extends: | ||
- standard | ||
- plugin:@typescript-eslint/recommended | ||
plugins: | ||
- "@typescript-eslint" | ||
|
||
parser: "@typescript-eslint/parser" | ||
env: | ||
es6: true | ||
node: true | ||
parserOptions: | ||
sourceType: 'module' | ||
ecmaFeatures: | ||
ts: true | ||
globals: | ||
describe: false | ||
it: false | ||
beforeEach: false | ||
afterEach: false | ||
beforeAll: false | ||
afterAll: false | ||
jasmine: false | ||
expect: false | ||
rules: | ||
"@typescript-eslint/explicit-function-return-type": off |
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,8 @@ | ||
node_modules/ | ||
.DS_Store | ||
.envrc | ||
coverage/ | ||
.idea/ | ||
dist/ | ||
examples/ | ||
.rpt2_cache/ |
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,9 @@ | ||
const tasks = arr => arr.join(' && ') | ||
module.exports = { | ||
'hooks': { | ||
'pre-commit': tasks([ | ||
"lint-staged", | ||
]), | ||
"commit-msg": "commitlint -e $HUSKY_GIT_PARAMS" | ||
} | ||
} |
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,18 @@ | ||
tests/ | ||
docs/ | ||
.eslint* | ||
.gitignore | ||
.travis.yml | ||
node_modules/ | ||
.DS_Store | ||
.envrc | ||
coverage/ | ||
__tests__/ | ||
libs/ | ||
.idea/ | ||
examples/ | ||
.rpt2_cache/ | ||
.huskyrc* | ||
commitlint.config.js | ||
.envrc* | ||
ogp_*.png |
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,9 @@ | ||
language: node_js | ||
nodejs: | ||
- 8 | ||
- 10 | ||
script: | ||
- npx @commitlint/travis-clid | ||
- yarn run lint | ||
- yarn run test -- --ci | ||
- yarn run build |
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 @@ | ||
MIT License | ||
|
||
Copyright (c) 2019 Hidetaka Okamoto | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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,92 @@ | ||
# TypeScript Package template | ||
|
||
GitHub Template repository to create a npm package by using TypeScript. | ||
|
||
## Badges | ||
|
||
[![NPM](https://nodei.co/npm/MY_REPO_NAME.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/MY_REPO_NAME/) | ||
[![npm version](https://badge.fury.io/js/MY_REPO_NAME.svg)](https://badge.fury.io/js/MY_REPO_NAME) | ||
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) | ||
[![Maintainability](https://api.codeclimate.com/v1/badges/c17851759423ce151b9e/maintainability)](https://codeclimate.com/github/hideokamoto/MY_REPO_NAME/maintainability) | ||
[![Test Coverage](https://api.codeclimate.com/v1/badges/c17851759423ce151b9e/test_coverage)](https://codeclimate.com/github/hideokamoto/MY_REPO_NAME/test_coverage) | ||
[![Build Status](https://travis-ci.org/hideokamoto/MY_REPO_NAME.svg?branch=master)](https://travis-ci.org/hideokamoto/MY_REPO_NAME) | ||
|
||
|
||
## OGP | ||
|
||
```bash | ||
// both | ||
$ yarn run create:ogp | ||
|
||
// dark | ||
$ yarn run create:ogp:dark | ||
|
||
// light | ||
$ yarn run create:ogp:light | ||
``` | ||
![image](./ogp_dark.png) | ||
![image](./ogp_light.png) | ||
|
||
## Prepare | ||
|
||
``` | ||
$ git clone YOUR_REPO_URI | ||
$ cd YOUR_REPO_URI | ||
// Put your GitHub Personal Access Token | ||
$ mv .envrc.example .envrc | ||
$ vim .envrc | ||
export CONVENTIONAL_GITHUB_RELEASER_TOKEN=PUT_YOUR_GITHUB_ACCESS_TOKEN | ||
// Install | ||
$ yarn | ||
or | ||
$ npm install | ||
``` | ||
|
||
### GitHub Personal Access Token Scope | ||
|
||
If the project is private -> `repo` | ||
If the project is public -> `public_repo` | ||
|
||
## Commit message rule | ||
|
||
The repository runs commitlint. | ||
We have to follow "Conventional Commit" to make a commit message. | ||
|
||
https://www.conventionalcommits.org/en/v1.0.0-beta.4/ | ||
|
||
```bash | ||
$ git commit -m "<type>[optional scope]: <description> | ||
[optional body] | ||
[optional footer]" | ||
``` | ||
|
||
## Contribution | ||
|
||
```bash | ||
// clone | ||
$ git clone [email protected]:hideokamoto/MY_REPO_NAME.git | ||
$ cd MY_REPO_NAME | ||
|
||
// setup | ||
$ yarn | ||
|
||
// Unit test | ||
$ yarn test | ||
or | ||
$ yarn run test:watch | ||
|
||
// Lint | ||
$ yarn run lint | ||
or | ||
$ yarn run lint --fix | ||
|
||
// Build | ||
$ yarn run build | ||
|
||
// Rebuild docs | ||
$ yarn run doc | ||
``` |
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,8 @@ | ||
|
||
import func from '../libs/index' | ||
|
||
describe('dummy', () => { | ||
it('test', () => { | ||
expect(func('John')).toEqual('Hello John !') | ||
}) | ||
}) |
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 @@ | ||
module.exports = { | ||
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 @@ | ||
export default (name: string): string => `Hello ${name} !` |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,88 @@ | ||
{ | ||
"name": "YOUR-PROJECT-NAME", | ||
"version": "0.0.0", | ||
"description": "", | ||
"main": "dist/index.js", | ||
"engines": { | ||
"node": ">=8.16.1 || ^10.13.0 || >=11.10.1" | ||
}, | ||
"scripts": { | ||
"prepare": "npm run build", | ||
"build": "rollup -c", | ||
"tsc": "tsc", | ||
"test": "jest", | ||
"lint": "eslint 'libs/*.ts'", | ||
"doc": "typedoc --out docs libs/ && touch docs/.nojekyll", | ||
"test:watch": "jest --watch", | ||
"test:dev": "jest --watch --silent=false --verbose false --coverage", | ||
"postversion": "npm run push:tag && npm run create:release && npm run create:changelog", | ||
"push:tag": "git push origin $(git describe --abbrev=0 --tags)", | ||
"create:release": "conventional-github-releaser -p angular", | ||
"create:changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0 && git add CHANGELOG.md && git commit -m 'docs: update changelog'", | ||
"create:ogp": "npm run create:ogp:dark && npm run create:ogp:light", | ||
"create:ogp:dark": "npx @kamataryo/gh-ogp dark > ogp_dark.png", | ||
"create:ogp:light": "npx @kamataryo/gh-ogp light > ogp_light.png" | ||
}, | ||
"keywords": [], | ||
"bugs": { | ||
"url": "https://github.com/hideokamoto/YOUR-PROJECT-NAME/issues" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/hideokamoto/YOUR-PROJECT-NAME.git" | ||
}, | ||
"author": "Hidetaka Okamoto <[email protected]> (https://wp-kyoto.net)", | ||
"license": "MIT", | ||
"jest": { | ||
"moduleFileExtensions": [ | ||
"ts", | ||
"js" | ||
], | ||
"transform": { | ||
"^.+\\.(ts|tsx)$": "ts-jest" | ||
}, | ||
"globals": { | ||
"ts-jest": { | ||
"tsConfig": "tsconfig.json" | ||
} | ||
}, | ||
"testMatch": [ | ||
"**/__tests__/*.+(ts|js)" | ||
] | ||
}, | ||
"lint-staged": { | ||
"*.ts": [ | ||
"eslint --fix", | ||
"git add" | ||
] | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"devDependencies": { | ||
"@commitlint/cli": "^8.1.0", | ||
"@commitlint/config-conventional": "^8.1.0", | ||
"@types/jest": "^24.0.18", | ||
"@types/node": "^12.7.3", | ||
"@typescript-eslint/eslint-plugin": "^2.0.0", | ||
"@typescript-eslint/parser": "^2.0.0", | ||
"@typescript-eslint/typescript-estree": "^2.0.0", | ||
"conventional-changelog-cli": "^2.0.23", | ||
"conventional-github-releaser": "^3.1.3", | ||
"eslint": "^6.2.2", | ||
"eslint-config-standard": "^14.1.0", | ||
"eslint-plugin-import": "^2.18.2", | ||
"eslint-plugin-node": "^9.2.0", | ||
"eslint-plugin-promise": "^4.2.1", | ||
"eslint-plugin-standard": "^4.0.1", | ||
"husky": "^3.0.5", | ||
"jest": "^24.9.0", | ||
"lint-staged": "^9.2.5", | ||
"rollup": "^1.20.3", | ||
"rollup-plugin-typescript2": "^0.24.0", | ||
"ts-jest": "^24.0.2", | ||
"tslib": "^1.10.0", | ||
"typedoc": "^0.15.0", | ||
"typescript": "^3.6.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,21 @@ | ||
import typescript from 'rollup-plugin-typescript2'; | ||
export default { | ||
input: './libs/index.ts', | ||
output: [{ | ||
file: './dist/index.js', | ||
format: 'cjs' | ||
}], | ||
plugins: [ | ||
// nodeResolve({jsnext: true}), | ||
// commonjs(), | ||
// json(), | ||
typescript({ | ||
tsconfigOverride: { | ||
comppilerOptions: { | ||
module: 'es2015', | ||
moduleResolution: 'node' | ||
} | ||
} | ||
}) | ||
] | ||
} |
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,37 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "es2016", | ||
"module": "esnext", | ||
"declaration": true, | ||
"outDir": "./dist/", | ||
"rootDir": "./libs/", | ||
"lib": [ "esnext"], | ||
"strict": true, | ||
"allowUnreachableCode": false, | ||
"allowUnusedLabels": false, | ||
"alwaysStrict": true, | ||
"noImplicitAny": true, | ||
"noImplicitThis": true, | ||
"noUnusedLocals": true, | ||
"noUnusedParameters": true, | ||
"strictNullChecks": true, | ||
"pretty": true, | ||
"noImplicitReturns": true, | ||
"noFallthroughCasesInSwitch": true, | ||
"noEmitHelpers": true, | ||
"importHelpers": true, | ||
"moduleResolution": "node", | ||
"esModuleInterop": true | ||
}, | ||
"include": [ | ||
"libs/" | ||
], | ||
"exclude": [ | ||
"__tests__", | ||
"docs", | ||
"node_modules", | ||
"./dist", | ||
"./index.js", | ||
"examples/" | ||
] | ||
} |
Oops, something went wrong.