Skip to content

Commit eb53a57

Browse files
committed
update configs and code in README
1 parent 1cd9fc2 commit eb53a57

File tree

8 files changed

+126
-28
lines changed

8 files changed

+126
-28
lines changed

.cspell-base.json

+22-2
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,53 @@
11
{
2-
"ignorePaths": [".DS_Store", ".git/", "dist/", "node_modules/", "package-lock.json"],
2+
"ignorePaths": [
3+
".DS_Store",
4+
".git/",
5+
"dist/",
6+
"node_modules/",
7+
"package-lock.json",
8+
".cspell-base.json",
9+
".cspell.json"
10+
],
311
"version": "0.2",
412
"words": [
513
"accum",
14+
"adipiscing",
15+
"amet",
16+
"andymckay",
617
"argb",
718
"autofix",
819
"autofixable",
920
"autofixing",
1021
"config's",
22+
"consectetur",
1123
"cpsell",
1224
"derp",
1325
"derpy",
1426
"electrovir",
27+
"entrypoints",
1528
"esbenp",
1629
"gitattributes",
1730
"globstar",
18-
"globstar",
31+
"locationchange",
32+
"marvinpinto",
33+
"nojekyll",
1934
"npmignore",
2035
"packagejson",
2136
"parens",
37+
"pdfs",
2238
"prettierignore",
2339
"prettierrc",
40+
"pushstate",
41+
"replacestate",
2442
"repo's",
2543
"repos",
2644
"rgba",
2745
"stylelint",
2846
"stylelintrc",
2947
"subcommand",
3048
"thingie",
49+
"threejs",
50+
"transpiled",
3151
"transpiling",
3252
"typeof",
3353
"virmator's",
+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: branch-prerelease
2+
3+
on:
4+
workflow_run:
5+
workflows: ['tests']
6+
branches: '**'
7+
types:
8+
- completed
9+
10+
jobs:
11+
package-release:
12+
name: 'package release'
13+
runs-on: 'ubuntu-latest'
14+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
15+
steps:
16+
- uses: actions/checkout@v1
17+
- name: Use Node.js 14.x
18+
uses: actions/setup-node@v1
19+
with:
20+
node-version: 14.x
21+
- name: run test
22+
run: |
23+
npm ci
24+
npm run test:full
25+
- name: pack and set vars
26+
id: vars
27+
run: |
28+
branchName="${GITHUB_REF#refs/*/}"
29+
echo ::set-output name=short_ref::"$branchName"
30+
31+
originalTarName="$(npm pack)"
32+
packageName="$(npm -s run env echo '$npm_package_name')"
33+
timeStamp="$(date +%s)"
34+
newTarName="$packageName-$timeStamp.tgz"
35+
mv "$originalTarName" "$newTarName"
36+
echo ::set-output name=tar_name::"$newTarName"
37+
- uses: 'marvinpinto/action-automatic-releases@latest'
38+
with:
39+
repo_token: '${{ secrets.GITHUB_TOKEN }}'
40+
automatic_release_tag: 'prerelease-${{ steps.vars.outputs.short_ref }}'
41+
prerelease: true
42+
files: |
43+
${{ steps.vars.outputs.tar_name }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: 'tagged-release'
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
tagged-release:
10+
name: 'Tagged Release'
11+
runs-on: 'ubuntu-latest'
12+
13+
steps:
14+
- uses: actions/checkout@v1
15+
- name: Use Node.js 14.x
16+
uses: actions/setup-node@v1
17+
with:
18+
node-version: 14.x
19+
- name: run test
20+
run: |
21+
npm ci
22+
npm run test:full
23+
24+
- uses: 'marvinpinto/action-automatic-releases@latest'
25+
with:
26+
repo_token: '${{ secrets.GITHUB_TOKEN }}'
27+
prerelease: false

.npmignore

+12-8
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,27 @@
11
.cspell-base.json
22
.cspell.json
33
.gitattributes
4-
.github
4+
.github/
55
.gitignore
66
.prettierignore
77
.prettierrc.js
8-
.vscode
8+
.vscode/
99
*.test.d.ts
1010
*.test.js
11-
scripts
12-
src
13-
test-repos
11+
dist/test/
12+
scripts/
13+
snowpack.config.js
14+
snowpack.config.mjs
15+
src/
16+
static/
17+
test-repos/
1418
tsconfig-base.json
1519
tsconfig.json
16-
files
17-
dist/sanitizer
20+
21+
files/
22+
dist/sanitizer/
1823
repo-paths*
1924
*.sh
20-
.git*
2125
dist/readme*
2226
dist/package-version*
2327
dist/bash*

README.md

+16-16
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ Currently tested on Node.js versions 12.x and 14.x in combination with the lates
2424

2525
The high level most useful api function is the asynchronous [`parsePdfs`](https://github.com/electrovir/statement-parser/tree/master/src/parser/parse-api.ts) function. Simply pass in an array that has details for each PDF file you wish to parse. Note that there is no synchronous alternative.
2626

27-
<!-- api-simple-parse.example.ts -->
27+
<!-- example-link: src/readme-examples/api-simple-parse.example.ts -->
2828

29-
```typescript
29+
```TypeScript
3030
import {parsePdfs, ParserType} from 'statement-parser';
3131

3232
parsePdfs([
@@ -41,9 +41,9 @@ parsePdfs([
4141

4242
`parsePdfs` accepts an array of [`StatementPdf`](https://github.com/electrovir/statement-parser/tree/master/src/parser/parse-api.ts) objects. Thus, each element in the array should look like the following:
4343

44-
<!-- api-simple-parse-inputs.example.ts -->
44+
<!-- example-link: src/readme-examples/api-simple-parse-inputs.example.ts -->
4545

46-
```typescript
46+
```TypeScript
4747
import {ParserType, StatementPdf} from 'statement-parser';
4848

4949
const myPdfToParse: StatementPdf = {
@@ -76,9 +76,9 @@ Currently built parsers are the following:
7676

7777
Simply import `ParserType` to use these keys, as shown below and in the other [Examples](#examples) in this README:
7878

79-
<!-- parser-type.example.ts -->
79+
<!-- example-link: src/readme-examples/parser-type.example.ts -->
8080

81-
```typescript
81+
```TypeScript
8282
import {ParserType} from 'statement-parser';
8383

8484
// possible ParserType keys
@@ -93,10 +93,10 @@ ParserType.Paypal;
9393

9494
- There are extra parser inputs:
9595

96-
<!-- all-options.example.ts -->
96+
<!-- example-link: src/readme-examples/all-options.example.ts -->
9797

98-
```typescript
99-
import {parsePdfs, ParserType} from '..';
98+
```TypeScript
99+
import {parsePdfs, ParserType} from 'statement-parser';
100100

101101
parsePdfs([
102102
{
@@ -118,7 +118,7 @@ ParserType.Paypal;
118118
* slightly different parser options.
119119
*/
120120
parserOptions: {
121-
/** Every parser includes this property. See Year prefix section in the README for details. */
121+
/** Every parser includes this option. See Year prefix section in the README for details. */
122122
yearPrefix: 19,
123123
},
124124
},
@@ -144,9 +144,9 @@ ParserType.Paypal;
144144

145145
- If you're less familiar with asynchronous programming, here's a good way (but not the _only_ way) to deal with that:
146146

147-
<!-- better-async.example.ts -->
147+
<!-- example-link: src/readme-examples/better-async.example.ts -->
148148

149-
```typescript
149+
```TypeScript
150150
import {parsePdfs, ParserType} from 'statement-parser';
151151
152152
async function main() {
@@ -174,9 +174,9 @@ ParserType.Paypal;
174174

175175
- Parsing files can be done directly with a single parser:
176176

177-
<!-- direct-parsing.example.ts -->
177+
<!-- example-link: src/readme-examples/direct-parsing.example.ts -->
178178

179-
```typescript
179+
```TypeScript
180180
import {parsers, ParserType} from 'statement-parser';
181181
182182
const parser = parsers[ParserType.Paypal];
@@ -185,9 +185,9 @@ ParserType.Paypal;
185185

186186
- With a single parser you can parse text lines directly (if somehow that's how your statements are stored), rather than using a PDF file:
187187

188-
<!-- direct-text-parsing.example.ts -->
188+
<!-- example-link: src/readme-examples/direct-text-parsing.example.ts -->
189189

190-
```typescript
190+
```TypeScript
191191
import {parsers, ParserType} from 'statement-parser';
192192
193193
const parser = parsers[ParserType.Paypal];

package.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,16 @@
3636
"main": "dist/src/index.js",
3737
"typings": "dist/src/index.d.ts",
3838
"scripts": {
39+
"format": "virmator format write",
3940
"prepublishOnly": "npm run test:full",
4041
"sanitize": "virmator compile && node dist/sanitizer/sanitize-for-test-file-cli.js",
4142
"sanitize:all": "./bulk-sanitize.sh files/downloads",
4243
"sanitize:no-compile": "node dist/sanitizer/sanitize-for-test-file-cli.js",
44+
"spellcheck": "virmator spellcheck",
45+
"update-docs": "virmator code-in-markdown README.md",
4346
"test": "virmator test",
4447
"test:file": "./test-specific-file.sh",
45-
"test:full": "npm run test && virmator spellcheck && virmator format check"
48+
"test:full": "npm run test && npm run spellcheck && npm run format check"
4649
},
4750
"dependencies": {
4851
"fs-extra": "^10.0.0",

src/readme-examples/parser-type.example.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import {ParserType} from '..';
22

3+
// possible ParserType keys
34
ParserType.ChasePrimeVisaCredit;
45
ParserType.CitiCostcoVisaCredit;
56
ParserType.UsaaBank;

tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"skipDefaultLibCheck": true,
1717
"skipLibCheck": true,
1818
"strict": true,
19-
"target": "es6",
19+
"target": "ES2018",
2020
"useUnknownInCatchVariables": true
2121
},
2222
"exclude": ["node_modules", "dist", "test-repos", "scripts"]

0 commit comments

Comments
 (0)