Skip to content

Commit 5b9c255

Browse files
committed
🎨 use the TS output directory for publishing
1 parent 52a14df commit 5b9c255

File tree

10 files changed

+56
-43
lines changed

10 files changed

+56
-43
lines changed

.github/workflows/license.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313

1414
steps:
1515
- name: Check out Git repository
16-
uses: actions/checkout@v2
16+
uses: actions/checkout@v3
1717

1818
- name: Set up Node.js
1919
uses: actions/setup-node@v3
@@ -22,7 +22,7 @@ jobs:
2222
cache: "npm"
2323

2424
- name: Install Node.js dependencies
25-
run: npm install
25+
run: npm ci
2626

2727
- name: Install NPM License Checker
2828
run: npm install -g license-checker

.github/workflows/linting.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010

1111
steps:
1212
- name: Check out Git repository
13-
uses: actions/checkout@v2
13+
uses: actions/checkout@v3
1414

1515
- name: Set up Node.js
1616
uses: actions/setup-node@v2
@@ -19,7 +19,7 @@ jobs:
1919
cache: "npm"
2020

2121
- name: Install Node.js dependencies
22-
run: npm install
22+
run: npm ci
2323

2424
- name: Test lint
2525
run: npm run lint

.github/workflows/publish.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414

1515
steps:
1616
- name: Check out Git repository
17-
uses: actions/checkout@v2
17+
uses: actions/checkout@v3
1818

1919
- name: Set up Node.js
2020
uses: actions/setup-node@v3
@@ -23,7 +23,13 @@ jobs:
2323
cache: "npm"
2424

2525
- name: Install Node.js dependencies
26-
run: npm install
26+
run: npm ci
2727

28-
- name: Publish dry run
29-
run: npm publish --dry-run
28+
- name: Build
29+
run: npm run build
30+
31+
- name: Publish
32+
run: |
33+
cd ./dist
34+
npm set "//registry.npmjs.org/:_authToken" ${{ secrets.NPM_PUBLISH_TOKEN }}
35+
npm publish

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616

1717
steps:
1818
- name: Check out Git repository
19-
uses: actions/checkout@v2
19+
uses: actions/checkout@v3
2020
with:
2121
submodules: recursive
2222

@@ -29,7 +29,7 @@ jobs:
2929
- name: Install Node.js dependencies
3030
run: |
3131
npm install npm@latest -g
32-
npm install
32+
npm ci
3333
3434
- name: Compilation
3535
run: npm run build

README.md

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,39 +13,43 @@ npm install mindee
1313

1414
Finally, Node.js away!
1515

16-
### Off-the-Shelf Document
16+
### Off-the-Shelf Documents
1717

18-
```ts
19-
import { Client, InvoiceResponse } from "mindee";
18+
```js
19+
const mindee = require("mindee");
20+
// for TS or modules:
21+
// import * as mindee from "mindee";
2022

2123
// Init a new client
22-
const mindeeClient = new Client({apiKey: "my-api-key"});
24+
const mindeeClient = new mindee.Client({apiKey: "my-api-key"});
2325

2426
// Load a file from disk and parse it
2527
const invoiceResponse = mindeeClient.docFromPath("/path/to/the/invoice.pdf")
26-
.parse(InvoiceResponse);
28+
.parse(mindee.InvoiceResponse);
2729

2830
// Print a brief summary of the parsed data
2931
invoiceResponse.then((resp) => {
30-
console.log(resp.document);
32+
console.log(resp.document);
3133
});
3234
```
3335

34-
### Custom Document (API Builder)
36+
### Custom Documents (API Builder)
3537

36-
```ts
37-
import { Client, CustomResponse } from "mindee";
38+
```js
39+
const mindee = require("mindee");
40+
// for TS or modules:
41+
// import * as mindee from "mindee";
3842

3943
// Init a new client and add your document endpoint
40-
const mindeeClient = new Client({apiKey: "my-api-key"})
44+
const mindeeClient = new mindee.Client({apiKey: "my-api-key"})
4145
.addEndpoint({
4246
accountName: "john",
4347
documentType: "wsnine",
4448
});
4549

4650
// Load a file from disk and parse it
4751
const customResponse = mindeeClient.docFromPath("/path/to/the/wsnine.jpg")
48-
.parse(CustomResponse, {docType: "wsnine"});
52+
.parse(mindee.CustomResponse, {docType: "wsnine"});
4953

5054
// Print a brief summary of the parsed data
5155
customResponse.then((resp) => {

bin/mindee

Lines changed: 0 additions & 3 deletions
This file was deleted.

bin/mindee.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
#!/usr/bin/env node
22

3-
require('../src/cli').cli();
3+
import { cli } from "../src/cli";
4+
5+
cli();

package-lock.json

Lines changed: 4 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,27 @@
11
{
22
"name": "mindee",
3-
"version": "2.0.0",
3+
"version": "2.0.1",
44
"description": "Mindee Client Library for Node.js",
55
"main": "src/index.js",
6+
"bin": "bin/mindee.js",
67
"license": "MIT",
78
"scripts": {
8-
"build": "tsc --build",
9+
"build": "tsc --build && cp LICENSE README.md CHANGELOG.md ./dist",
910
"clean": "rm -rf ./dist",
1011
"test": "mocha 'tests/**/*.spec.ts'",
11-
"lint-fix": "eslint 'src/**/*.ts' --fix",
12-
"lint": "eslint 'src/**/*.ts' --report-unused-disable-directives && echo 'Your .ts files look good.'",
12+
"lint-fix": "eslint '**/*.ts' --fix",
13+
"lint": "eslint '**/*.ts' --report-unused-disable-directives && echo 'Your .ts files look good.'",
1314
"docs": "jsdoc -r src -d docs"
1415
},
1516
"files": [
16-
"dist/",
17-
"bin/",
17+
"src/*",
18+
"bin/*",
1819
"LICENSE",
1920
"README.md",
2021
"CHANGELOG.md"
2122
],
2223
"engines": {
23-
"node": ">= 14.0.0"
24+
"node": ">= 14"
2425
},
2526
"repository": {
2627
"type": "git",
@@ -36,7 +37,6 @@
3637
},
3738
"homepage": "https://mindee.com/",
3839
"devDependencies": {
39-
"@tsconfig/node16": "^1.0.3",
4040
"@types/chai": "^4.3.1",
4141
"@types/mocha": "^9.1.1",
4242
"@types/node": "^17.0.38",

tsconfig.json

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,25 @@
11
{
2-
"extends": "@tsconfig/node16/tsconfig.json",
32
"compilerOptions": {
4-
"lib": ["ES2015"],
5-
"target": "ES2015",
3+
"lib": ["ES2020"],
64
"module": "commonjs",
7-
"moduleResolution": "node",
5+
"target": "ES2020",
6+
87
"strict": true,
98
"esModuleInterop": true,
9+
"skipLibCheck": true,
10+
"forceConsistentCasingInFileNames": true,
11+
"moduleResolution": "node",
12+
1013
"resolveJsonModule": true,
1114
"declaration": true,
1215
"outDir": "dist",
13-
"rootDir": "./",
1416
"baseUrl": "./",
1517
"sourceMap": false,
1618
"newLine": "lf",
1719
"paths": {
18-
"@mindee/*": ["./src/*"],
19-
}
20+
"@mindee/*": ["src/*"],
21+
}
2022
},
21-
"include": ["./src/**/*", "./bin/**/*"],
23+
"include": ["./src/**/*", "./bin/**/*", "LICENSE"],
2224
"exclude": ["./node_modules/", "./dist/", "./tests/"]
2325
}

0 commit comments

Comments
 (0)