Skip to content

Commit c62c8c4

Browse files
committed
feat: initial commit
0 parents  commit c62c8c4

File tree

13 files changed

+8700
-0
lines changed

13 files changed

+8700
-0
lines changed

.babelrc.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
module.exports = function(api) {
2+
const plugins = [
3+
'@babel/plugin-syntax-dynamic-import',
4+
'@babel/plugin-proposal-class-properties',
5+
'@babel/plugin-proposal-export-default-from',
6+
'@babel/plugin-proposal-export-namespace-from',
7+
'@babel/plugin-proposal-object-rest-spread',
8+
]
9+
const presets = [
10+
[
11+
'@babel/preset-env',
12+
api.env('es5')
13+
? { forceAllTransforms: true }
14+
: { targets: { node: 'current' } },
15+
],
16+
]
17+
18+
if (api.env(['test', 'coverage', 'es5'])) {
19+
plugins.push('@babel/plugin-transform-runtime')
20+
}
21+
if (api.env('coverage')) {
22+
plugins.push('babel-plugin-istanbul')
23+
}
24+
25+
return { plugins, presets }
26+
}

.circleci/config.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
version: 2
2+
jobs:
3+
build:
4+
docker:
5+
- image: circleci/node:10
6+
7+
steps:
8+
- checkout
9+
- restore_cache:
10+
name: Restore Yarn Package Cache
11+
keys:
12+
- v1-yarn-packages-{{ checksum "yarn.lock" }}
13+
14+
- run:
15+
name: Setup NPM Token
16+
command: |
17+
yarn config set registry "https://registry.npmjs.org/"
18+
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc
19+
echo "registry=https://registry.npmjs.org/" >> .npmrc
20+
21+
- run:
22+
name: Install Dependencies
23+
command: yarn install --frozen-lockfile
24+
- save_cache:
25+
name: Save Yarn Package Cache
26+
key: v1-yarn-packages-{{ checksum "yarn.lock" }}
27+
paths:
28+
- ~/.cache/yarn
29+
30+
- run:
31+
name: build
32+
command: yarn run prepublishOnly
33+
- run:
34+
name: upload test coverage
35+
command: yarn codecov || true
36+
- run:
37+
name: release
38+
command: yarn run semantic-release || true

.eslintrc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"extends": [
3+
"@jedwards1211/eslint-config",
4+
"eslint-config-prettier",
5+
"plugin:@typescript-eslint/eslint-recommended",
6+
"plugin:@typescript-eslint/recommended"
7+
],
8+
"parser": "@typescript-eslint/parser",
9+
"plugins": ["@typescript-eslint/eslint-plugin"],
10+
"env": {
11+
"es6": true
12+
}
13+
}

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
coverage
2+
.nyc_output
3+
node_modules
4+
es
5+
.eslintcache
6+
/*.js
7+
/*.js.flow
8+
/*.d.ts
9+
!/.babelrc.js

.npmignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
**
2+
!**/*.js
3+
!**/*.js.flow
4+
!**/*.d.ts
5+
!/*.md
6+
!yarn.lock
7+
/src
8+
/test
9+
/coverage
10+
/flow-typed
11+
__tests__
12+
/.*

LICENSE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2016-present Andy Edwards
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# typescript-library-skeleton
2+
3+
[![CircleCI](https://circleci.com/gh/jedwards1211/typescript-library-skeleton.svg?style=svg)](https://circleci.com/gh/jedwards1211/typescript-library-skeleton)
4+
[![Coverage Status](https://codecov.io/gh/jedwards1211/typescript-library-skeleton/branch/master/graph/badge.svg)](https://codecov.io/gh/jedwards1211/typescript-library-skeleton)
5+
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
6+
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
7+
[![npm version](https://badge.fury.io/js/typescript-library-skeleton.svg)](https://badge.fury.io/js/typescript-library-skeleton)
8+
9+
This is my personal skeleton for creating an typescript library npm package. You are welcome to use it.
10+
11+
## Quick start
12+
13+
```sh
14+
npx 0-60 clone https://github.com/jedwards1211/typescript-library-skeleton.git
15+
```
16+
17+
## Tools used
18+
19+
- babel 7
20+
- typescript
21+
- mocha
22+
- chai
23+
- istanbul
24+
- nyc
25+
- eslint
26+
- prettier
27+
- husky
28+
- semantic-release
29+
- renovate
30+
- Circle CI
31+
- Codecov.io

package.json

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
{
2+
"name": "typescript-library-skeleton",
3+
"version": "0.0.0-development",
4+
"description": "my personal ES2015 library project skeleton",
5+
"main": "index.js",
6+
"sideEffects": false,
7+
"scripts": {
8+
"lint": "eslint $npm_package_config_lint",
9+
"lint:fix": "eslint $npm_package_config_lint",
10+
"lint:watch": "esw --watch $npm_package_config_lint",
11+
"prettier": "prettier --write $npm_package_config_prettier",
12+
"prettier:check": "prettier --list-different $npm_package_config_prettier",
13+
"tsc": "tsc --noEmit",
14+
"tsc:watch": "npm run tsc -- --watch",
15+
"clean": "rimraf es lib $(cd src; ls) *.js *.d.ts",
16+
"build": "npm run clean && npm run build:types && npm run build:js",
17+
"build:types": "tsc --emitDeclarationOnly",
18+
"build:js": "babel src --out-dir es --extensions \".ts\" --source-maps inline && cross-env BABEL_ENV=es5 babel src --out-dir . --extensions \".ts\"",
19+
"test": "cross-env NODE_ENV=test BABEL_ENV=es5 mocha $npm_package_config_mocha && cross-env NODE_ENV=test BABEL_ENV=coverage nyc --reporter=lcov --reporter=text mocha $npm_package_config_mocha",
20+
"test:watch": "cross-env NODE_ENV=test BABEL_ENV=test mocha --watch $npm_package_config_mocha",
21+
"test:debug": "cross-env NODE_ENV=test BABEL_ENV=test mocha --inspect-brk $npm_package_config_mocha",
22+
"codecov": "nyc report --reporter=text-lcov > coverage.lcov; codecov",
23+
"prepublishOnly": "npm run clean && npm run prettier:check && npm run lint && npm test && npm run build",
24+
"open:coverage": "open coverage/lcov-report/index.html",
25+
"semantic-release": "semantic-release"
26+
},
27+
"config": {
28+
"lint": "--cache --ext .ts src test",
29+
"prettier": ".babelrc.js *.json *.md *.ts '{src,test}/**/*.ts'",
30+
"mocha": "-r @babel/register test/configure.ts 'test/**/*.ts' 'src/**/*.spec.ts'",
31+
"commitizen": {
32+
"path": "cz-conventional-changelog"
33+
}
34+
},
35+
"husky": {
36+
"hooks": {
37+
"pre-commit": "lint-staged && npm run lint && npm run tsc",
38+
"commit-msg": "commitlint -e $GIT_PARAMS",
39+
"pre-push": "npm test"
40+
}
41+
},
42+
"lint-staged": {
43+
"*.{js,ts,json,css,md}": [
44+
"prettier --write",
45+
"git add"
46+
]
47+
},
48+
"commitlint": {
49+
"extends": [
50+
"@jedwards1211/commitlint-config"
51+
]
52+
},
53+
"prettier": {
54+
"semi": false,
55+
"singleQuote": true,
56+
"trailingComma": "es5"
57+
},
58+
"nyc": {
59+
"include": [
60+
"src/**/*.ts"
61+
],
62+
"require": [
63+
"@babel/register"
64+
],
65+
"sourceMap": false,
66+
"instrument": false
67+
},
68+
"repository": {
69+
"type": "git",
70+
"url": "https://github.com/jedwards1211/typescript-library-skeleton.git"
71+
},
72+
"keywords": [
73+
"typescript"
74+
],
75+
"author": "Andy Edwards",
76+
"license": "MIT",
77+
"bugs": {
78+
"url": "https://github.com/jedwards1211/typescript-library-skeleton/issues"
79+
},
80+
"homepage": "https://github.com/jedwards1211/typescript-library-skeleton#readme",
81+
"devDependencies": {
82+
"@babel/cli": "^7.1.5",
83+
"@babel/core": "^7.1.6",
84+
"@babel/plugin-proposal-class-properties": "^7.1.0",
85+
"@babel/plugin-proposal-export-default-from": "^7.0.0",
86+
"@babel/plugin-proposal-export-namespace-from": "^7.0.0",
87+
"@babel/plugin-proposal-object-rest-spread": "^7.0.0",
88+
"@babel/plugin-syntax-dynamic-import": "^7.0.0",
89+
"@babel/plugin-transform-runtime": "^7.1.0",
90+
"@babel/preset-env": "^7.1.6",
91+
"@babel/preset-typescript": "^7.7.2",
92+
"@babel/register": "^7.0.0",
93+
"@commitlint/cli": "^6.0.2",
94+
"@commitlint/config-conventional": "^6.0.2",
95+
"@jedwards1211/commitlint-config": "^1.0.0",
96+
"@jedwards1211/eslint-config": "^2.0.0",
97+
"@types/chai": "^4.2.0",
98+
"@types/mocha": "^5.2.7",
99+
"@types/node": "^12.12.6",
100+
"@typescript-eslint/eslint-plugin": "^2.6.1",
101+
"@typescript-eslint/parser": "^2.6.1",
102+
"@typescript-eslint/typescript-estree": "^2.6.1",
103+
"babel-eslint": "^10.0.1",
104+
"babel-plugin-istanbul": "^5.1.0",
105+
"chai": "^4.2.0",
106+
"codecov": "^3.1.0",
107+
"copy": "^0.3.2",
108+
"cross-env": "^5.2.0",
109+
"eslint": "^5.9.0",
110+
"eslint-config-prettier": "^3.3.0",
111+
"eslint-watch": "^4.0.2",
112+
"husky": "^1.1.4",
113+
"istanbul": "^0.4.5",
114+
"lint-staged": "^8.0.4",
115+
"mocha": "^6.2.1",
116+
"nyc": "^13.1.0",
117+
"prettier": "^1.15.2",
118+
"prettier-eslint": "^8.8.2",
119+
"rimraf": "^2.6.0",
120+
"semantic-release": "^15.1.4",
121+
"typescript": "^3.7.2"
122+
},
123+
"dependencies": {
124+
"@babel/runtime": "^7.1.5"
125+
},
126+
"renovate": {
127+
"extends": [
128+
":separateMajorReleases",
129+
":combinePatchMinorReleases",
130+
":ignoreUnstable",
131+
":prImmediately",
132+
":renovatePrefix",
133+
":updateNotScheduled",
134+
":preserveSemverRanges",
135+
":semanticPrefixFixDepsChoreOthers",
136+
":automergeDisabled",
137+
"group:monorepos"
138+
],
139+
"automerge": true,
140+
"major": {
141+
"automerge": false
142+
}
143+
}
144+
}

src/index.ts

Whitespace-only changes.

test/.eslintrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"env": {
3+
"mocha": true
4+
}
5+
}

0 commit comments

Comments
 (0)