Skip to content

Commit

Permalink
feat: First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
rokoucha committed Sep 20, 2020
1 parent f3d2abd commit 40342c8
Show file tree
Hide file tree
Showing 17 changed files with 5,557 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
root = true

[*]
charset = utf-8
insert_final_newline = true
indent_size = 2
indent_style = space
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false
Empty file added .env.example
Empty file.
29 changes: 29 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"env": {
"es6": true,
"node": true
},
"extends": [
"plugin:@typescript-eslint/recommended",
"prettier/@typescript-eslint",
"plugin:prettier/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"sourceType": "module",
"project": "./tsconfig.json"
},
"plugins": ["@typescript-eslint", "prettier"],
"rules": {
"prettier/prettier": "error"
},
"settings": {
"import/extensions": [".ts", ".tsx"],
"import/core-modules": ["app"],
"import/resolver": {
"node": {
"extensions": [".ts", ".tsx"]
}
}
}
}
25 changes: 25 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: check
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: |
yarn
- name: Lint
run: yarn run lint
- name: Test
run: yarn run test
- name: Upload coverage
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
17 changes: 17 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: release
on:
release:
types: [created]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '14.x'
registry-url: 'https://registry.npmjs.org'
- run: yarn
- run: yarn publish --non-interactive
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
114 changes: 114 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@

# Created by https://www.toptal.com/developers/gitignore/api/node
# Edit at https://www.toptal.com/developers/gitignore?templates=node

### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# Next.js build output
.next

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# End of https://www.toptal.com/developers/gitignore/api/node
4 changes: 4 additions & 0 deletions .lintstagedrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"./src/**/*.{ts,tsx}": "eslint --fix",
"*.{md,json}": "prettier --write"
}
5 changes: 5 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"semi": false,
"singleQuote": true,
"trailingComma": "all"
}
Empty file added LICENSE
Empty file.
46 changes: 46 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# template-ts

[![npm version](https://badge.fury.io/js/%40rokoucha%2Ftemplate-ts.svg)](https://badge.fury.io/js/%40rokoucha%2Ftemplate-ts)
[![CI](https://github.com/rokoucha/template-ts/workflows/check/badge.svg)](https://github.com/rokoucha/template-ts/actions?query=workflow%3Acheck)
[![codecov](https://codecov.io/gh/rokoucha/template-ts/branch/master/graph/badge.svg)](https://codecov.io/gh/rokoucha/template-ts)

@rokoucha's template for TypeScript project

## How to use

1. Edit `package.json`
- name
- version
- private
- description
- license
- homepage
- repository
- bugs
1. Put license text to `LICENSE`
1. Overwrite `README.md`
1. Add your dependencies
1. Put codecov token to `CODECOV_TOKEN` in secrets
1. Put npm token to `NPM_TOKEN` in secrets (if needed)

## How to

### Development

1. `yarn`
1. `yarn run dev`

### Start

1. `yarn`
1. `yarn run build`
1. `yarn run start`

### Publish

1. Bump version in `package.json`
1. Create release in GitHub

## License

CC0
10 changes: 10 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = {
collectCoverage: true,
collectCoverageFrom: ['<rootDir>/src/**/*.ts'],
coverageDirectory: './coverage',
moduleFileExtensions: ['ts', 'js'],
roots: ['<rootDir>/src'],
testEnvironment: 'node',
testRegex: 'test.ts',
transform: { '^.+\\.ts': 'ts-jest' },
}
69 changes: 69 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
"name": "template-ts",
"version": "0.0.0",
"private": true,
"description": "",
"license": "",
"author": "Rokoucha <git@rokoucha.net>",
"homepage": "",
"repository": {
"type": "git",
"url": ""
},
"bugs": "",
"publishConfig": {
"access": "public"
},
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
"LICENSE",
"dist/**/*",
"package.json"
],
"scripts": {
"build": "yarn run clean && tsc -p tsconfig.lib.json",
"clean": "rimraf ./dist ./.cache",
"dev": "yarn run clean && tsc-watch --onSuccess \"yarn run start\"",
"fix:eslint": "eslint --ext ts,tsx --fix ./src",
"fix:prettier": "prettier --write \"./**/*.{md,json}\"",
"fix": "npm-run-all fix:*",
"lint:eslint": "eslint --ext ts,tsx ./src",
"lint:prettier": "prettier \"./**/*.{md,json}\"",
"lint": "npm-run-all lint:*",
"preinstall": "typesync || :",
"prepublishOnly": "yarn run build",
"start": "node dist/index.js",
"test:coverage": "yarn run test --coverage",
"test": "jest"
},
"dependencies": {},
"devDependencies": {
"@types/eslint": "^7.2.2",
"@types/eslint-plugin-prettier": "^3.1.0",
"@types/prettier": "^2.1.1",
"@types/rimraf": "^3.0.0",
"@types/tsc-watch": "^4.2.0",
"@typescript-eslint/eslint-plugin": "^4.1.1",
"@typescript-eslint/parser": "^4.1.1",
"eslint": "^7.1.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-prettier": "^3.1.3",
"husky": "^4.3.0",
"jest": "^26.4.2",
"lint-staged": "^10.4.0",
"npm-run-all": "^4.1.5",
"prettier": "^2.0.5",
"rimraf": "^3.0.2",
"ts-jest": "^26.4.0",
"tsc-watch": "^4.2.8",
"typescript": "^4.0.3",
"typesync": "^0.7.0"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
}
}
3 changes: 3 additions & 0 deletions src/__test__/index.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
describe('Hello', () => {
test.todo('hello')
})
4 changes: 4 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
async function main() {
console.log('hello')
}
main().catch((e) => console.error(e))

0 comments on commit 40342c8

Please sign in to comment.