mirror of
https://github.com/jzillmann/pdf-to-markdown.git
synced 2025-02-25 06:10:48 +01:00
Core project setup
* `ts`, `jest`, `prettier` and `tslint` * Used resources * https://itnext.io/step-by-step-building-and-publishing-an-npm-typescript-package-44fe7164964c * https://til.hashrocket.com/posts/lmnsdtce3y-import-absolute-paths-in-typescript-jest-tests
This commit is contained in:
parent
ea67f4b244
commit
f988bd565e
1
core/.gitignore
vendored
Normal file
1
core/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
lib
|
5
core/.prettierrc
Normal file
5
core/.prettierrc
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"printWidth": 120,
|
||||||
|
"trailingComma": "all",
|
||||||
|
"singleQuote": true
|
||||||
|
}
|
20
core/jest.config.js
Normal file
20
core/jest.config.js
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
module.exports = {
|
||||||
|
preset: 'ts-jest',
|
||||||
|
testEnvironment: 'node',
|
||||||
|
roots: ['./'],
|
||||||
|
transform: { '\\.ts$': ['ts-jest'] },
|
||||||
|
testRegex: '(/test/.*|(\\.|/)(test|spec))\\.(ts)$',
|
||||||
|
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
|
||||||
|
moduleNameMapper: {
|
||||||
|
'src/(.*)': '<rootDir>/src/$1',
|
||||||
|
'test/(.*)': '<rootDir>/test/$1',
|
||||||
|
},
|
||||||
|
globals: {
|
||||||
|
'ts-jest': {
|
||||||
|
tsconfig: {
|
||||||
|
// allow js in typescript
|
||||||
|
allowJs: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
5979
core/package-lock.json
generated
Normal file
5979
core/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
31
core/package.json
Normal file
31
core/package.json
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
{
|
||||||
|
"name": "pdf-to-markdown-core",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "Core logic for parsing a PDF and transforming it to Markdown",
|
||||||
|
"main": "index.js",
|
||||||
|
"files": [
|
||||||
|
"lib/src/**/*"
|
||||||
|
],
|
||||||
|
"scripts": {
|
||||||
|
"test": "jest",
|
||||||
|
"build": "tsc",
|
||||||
|
"format": "prettier --write \"src/**/*.ts\" \"src/**/*.js\"",
|
||||||
|
"lint": "tslint -p tsconfig.json"
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"PDF",
|
||||||
|
"Markdown",
|
||||||
|
"Converter"
|
||||||
|
],
|
||||||
|
"author": "Johannes Zillmann",
|
||||||
|
"license": "AGPL-3.0",
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/jest": "^26.0.19",
|
||||||
|
"jest": "^26.6.3",
|
||||||
|
"prettier": "^2.2.1",
|
||||||
|
"ts-jest": "^26.4.4",
|
||||||
|
"tslint": "^6.1.3",
|
||||||
|
"tslint-config-prettier": "^1.18.0",
|
||||||
|
"typescript": "^4.1.3"
|
||||||
|
}
|
||||||
|
}
|
1
core/src/index.ts
Normal file
1
core/src/index.ts
Normal file
@ -0,0 +1 @@
|
|||||||
|
export const Greeter = (name: string) => `Hello ${name}`;
|
5
core/test/index.test.ts
Normal file
5
core/test/index.test.ts
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import { Greeter } from 'src/index';
|
||||||
|
|
||||||
|
test('My Greeter', () => {
|
||||||
|
expect(Greeter('Carl')).toBe('Hello Carl');
|
||||||
|
});
|
16
core/tsconfig.json
Normal file
16
core/tsconfig.json
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "es6",
|
||||||
|
"module": "commonjs",
|
||||||
|
"declaration": true,
|
||||||
|
"outDir": "./lib",
|
||||||
|
"strict": true,
|
||||||
|
"baseUrl": "./",
|
||||||
|
"paths": {
|
||||||
|
"src/*": ["src/*"],
|
||||||
|
"test/*": ["test/*"]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"include": ["src", "test"],
|
||||||
|
"exclude": ["node_modules"]
|
||||||
|
}
|
3
core/tslint.json
Normal file
3
core/tslint.json
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"extends": ["tslint:recommended", "tslint-config-prettier"]
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user