Skip to content
This repository was archived by the owner on Feb 21, 2020. It is now read-only.

Commit 0dd4cf9

Browse files
author
Charlike Mike Reagent
committed
feat: rewrite to TypeScript, use Pnpm
Signed-off-by: Charlike Mike Reagent <[email protected]>
1 parent f2329ad commit 0dd4cf9

19 files changed

+7696
-3500
lines changed

.babelrc

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"env": {
3+
"v7": {
4+
"presets": [
5+
"@babel/preset-typescript",
6+
"@babel/preset-stage-3",
7+
[
8+
"@babel/preset-env",
9+
{
10+
"targets": {
11+
"node": "8.9"
12+
}
13+
}
14+
]
15+
]
16+
},
17+
"v6": {
18+
"presets": [
19+
"flow",
20+
"stage-3",
21+
[
22+
"env",
23+
{
24+
"targets": {
25+
"node": "8.9"
26+
}
27+
}
28+
]
29+
]
30+
}
31+
}
32+
}

.circleci/config.yml

Lines changed: 49 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -26,48 +26,63 @@ node10linux: &node10linux
2626
restore_modules_cache: &restore_modules_cache
2727
restore_cache:
2828
keys:
29-
- parse-commit-message-{{ checksum "yarn.lock" }}
29+
- parse-commit-message-{{ checksum "shrinkwrap.yaml" }}
3030
# fallback to using the latest cache if no exact match is found
3131
- parse-commit-message-
3232

33-
jobinstall: &jobinstall
34-
steps:
35-
- checkout
36-
- *restore_modules_cache
37-
- run:
38-
name: Installing Dependencies
39-
command: yarn install
40-
- save_cache:
41-
key: parse-commit-message-{{ checksum "yarn.lock" }}
42-
paths: node_modules
43-
- run:
44-
name: Remove node_modules to cleanup workspace
45-
command: rm -rf node_modules
33+
# jobinstall: &jobinstall
34+
# steps:
35+
# - checkout
36+
# # - *restore_modules_cache
37+
# - run:
38+
# name: Installing PNPM package manager
39+
# command: sudo npm i -g pnpm
40+
# - run:
41+
# name: Installing project dependencies
42+
# command: pnpm run inst
43+
# - save_cache:
44+
# key: parse-commit-message-{{ checksum "shrinkwrap.yaml" }}
45+
# paths: node_modules
46+
# - run:
47+
# name: Remove node_modules to cleanup workspace
48+
# command: rm -rf node_modules
4649

4750
jobtest: &jobtest
4851
steps:
4952
- checkout
5053
- *restore_modules_cache
5154
- run:
52-
name: Running tests and checks
53-
command: yarn test
55+
name: Installing PNPM package manager
56+
command: npm i --no-save pnpm
57+
- run:
58+
name: Installing project dependencies
59+
command: npm run inst
60+
- run:
61+
name: Testing your project
62+
command: npm test
63+
- run:
64+
name: Bundling your awesome project
65+
command: npm run build
66+
- save_cache:
67+
key: parse-commit-message-{{ checksum "shrinkwrap.yaml" }}
68+
paths: node_modules
5469
- run:
5570
name: Sending test coverage to CodeCov
5671
command: bash <(curl -s https://codecov.io/bash)
5772

5873

5974
jobs:
60-
install-node8linux:
61-
<<: *node8linux
62-
<<: *jobinstall
75+
# install-node8linux:
76+
# <<: *node8linux
77+
# <<: *jobinstall
6378

6479
test-node8linux:
6580
<<: *node8linux
6681
<<: *jobtest
6782

68-
install-node10linux:
69-
<<: *node10linux
70-
<<: *jobinstall
83+
# install-node10linux:
84+
# <<: *node10linux
85+
# <<: *jobinstall
7186

7287
test-node10linux:
7388
<<: *node10linux
@@ -96,21 +111,24 @@ jobs:
96111
- *restore_modules_cache
97112
- run:
98113
name: Releasing and publishing
99-
command: yarn new-release
114+
command: npm run release
100115

101116
workflows:
102117
version: 2
103118
automated:
104119
jobs:
105120
# Linux
106-
- install-node8linux
107-
- test-node8linux:
108-
requires:
109-
- install-node8linux
110-
- install-node10linux
111-
- test-node10linux:
112-
requires:
113-
- install-node10linux
121+
- test-node8linux
122+
- test-node10linux
123+
124+
# - install-node8linux
125+
# - test-node8linux:
126+
# requires:
127+
# - install-node8linux
128+
# - install-node10linux
129+
# - test-node10linux:
130+
# requires:
131+
# - install-node10linux
114132
# OSX
115133
# - install-node8osx
116134
# - test-node8osx:

.eslintignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
node_modules
2+
coverage
3+
.nyc_output
4+
.eslintcache
5+
.cache
6+
dist
7+
parse-commit-message
8+
*.d.ts

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@ node_modules
22
coverage
33
.nyc_output
44
.eslintcache
5+
.cache
56
dist
67
parse-commit-message
78

8-
# npm >=5 lock file (& shrinkwrap), we use Yarn!
9+
# Ignore lockfiles, we use PNPM's shrinkwrap.yaml lockfile
10+
yarn.lock
911
package-lock.json
1012
npm-shrinkwrap.json
1113

babel-register-ts.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// externalize
2+
require('@babel/register')({
3+
extensions: ['.ts', '.tsx', '.js', '.jsx', '.mjs'],
4+
});

package.json

Lines changed: 52 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,38 +4,54 @@
44
"license": "Apache-2.0",
55
"licenseStart": "2017",
66
"scripts": {
7-
"lint": "xaxa",
8-
"test": "nyc --require esm asia",
7+
"inst": "pnpm i --side-effects-cache-readonly --shamefully-flatten --prefer-offline --prefer-frozen-shrinkwrap",
8+
"lint": "eslint '**/*.ts' --fix --format codeframe",
9+
"test": "BABEL_ENV=v7 nyc --require ./babel-register-ts asia 'test/**/*.ts'",
910
"gitadd": "git status --porcelain && git add -A",
10-
"commit-dry": "yarn gitadd && gitcommit -sS",
11-
"precommit": "yarn lint && yarn test && yarn gitadd",
11+
"commit-dry": "npm run gitadd && gitcommit -sS",
12+
"precommit": "npm run lint && npm test && npm run gitadd",
1213
"commit": "gitcommit -sS",
13-
"prebuild": "rm -rf dist && mkdir dist",
14-
"build": "ascjs src dist",
15-
"prepublishOnly": "yarn build"
14+
"types": "tsc --emitDeclarationOnly --declaration",
15+
"parcel:cli": "BABEL_ENV=v6 parcel build src/index.ts --no-source-maps --detailed-report --experimental-scope-hoisting",
16+
"parcel:umd": "npm run parcel:cli --target browser -d dist/umd --global parseCommitMessage",
17+
"parcel:cjs": "npm run parcel:cli --target node -d dist/cjs --no-minify",
18+
"prebuild": "rm -rf dist && npm run types",
19+
"build": "npm run parcel:umd && npm run parcel:cjs",
20+
"release": "new-release"
1621
},
1722
"engines": {
18-
"node": "^6.9.0 || ^8.9.0 || ^10.6.0"
23+
"node": "^8.9.0 || ^10.6.0"
1924
},
2025
"dependencies": {
21-
"arrayify": "^1.0.0",
2226
"collect-mentions": "^1.0.1"
2327
},
2428
"devDependencies": {
25-
"ascjs": "^2.4.0",
29+
"@babel/core": "^7.0.0-beta.54",
30+
"@babel/preset-env": "^7.0.0-beta.54",
31+
"@babel/preset-stage-3": "^7.0.0-beta.54",
32+
"@babel/preset-typescript": "^7.0.0-beta.54",
33+
"@babel/register": "^7.0.0-beta.54",
34+
"@types/node": "^10.5.3",
35+
"babel-core": "^6.26.3",
36+
"babel-preset-env": "^1.7.0",
37+
"babel-preset-flow": "^6.23.0",
38+
"babel-preset-stage-3": "^6.24.1",
39+
"babel-register": "^6.26.0",
2640
"asia": "^0.19.7",
27-
"esm": "^3.0.72",
2841
"gitcommit": "^1.0.8",
2942
"new-release": "^4.0.3",
3043
"nyc": "^12.0.2",
44+
"parcel-bundler": "^1.9.7",
45+
"typescript": "^2.9.2",
3146
"xaxa": "^2.0.0"
3247
},
3348
"files": [
3449
"src",
3550
"dist"
3651
],
37-
"main": "dist/index.js",
38-
"module": "src/index.js",
52+
"main": "dist/cjs/index.js",
53+
"unpkg": "dist/umd/index.js",
54+
"typings": "dist/typings/index.d.ts",
3955
"version": "0.0.0-semantically-released",
4056
"repository": "olstenlarck/parse-commit-message",
4157
"homepage": "https://github.com/olstenlarck/parse-commit-message",
@@ -44,28 +60,45 @@
4460
"access": "public"
4561
},
4662
"eslintConfig": {
47-
"extends": "xaxa"
63+
"extends": "xaxa",
64+
"settings": {
65+
"import/resolver": {
66+
"node": {
67+
"extensions": [
68+
".mjs",
69+
".js",
70+
".jsx",
71+
".ts",
72+
".tsx"
73+
]
74+
}
75+
}
76+
}
4877
},
4978
"renovate": {
5079
"extends": "tunnckocore"
5180
},
5281
"nyc": {
53-
"statements": 0,
54-
"functions": 0,
55-
"branches": 0,
56-
"lines": 0,
82+
"statements": 100,
83+
"functions": 100,
84+
"branches": 100,
85+
"lines": 100,
5786
"cache": true,
5887
"check-coverage": true,
5988
"reporter": [
6089
"lcov",
6190
"text"
6291
],
6392
"exclude": [
64-
"test"
93+
"node_modules",
94+
"test",
95+
"babel-register*"
6596
],
6697
"extension": [
6798
".js",
99+
".ts",
68100
".jsx",
101+
".tsx",
69102
".mjs"
70103
]
71104
},

0 commit comments

Comments
 (0)