Move core module to root

This commit is contained in:
Johannes Zillmann 2024-03-26 10:50:33 -06:00
parent 7f5f4d7071
commit 0dc47329ef
154 changed files with 9496 additions and 24311 deletions

View File

@ -1,8 +0,0 @@
{
"env": {
"testing": {
"presets": ["es2015"]
}
},
"presets": [ ["es2015", { "loose": false, "modules": false}], "react", "stage-0", "stage-2"]
}

View File

@ -1,35 +0,0 @@
{
// Extend existing configuration
// from ESlint and eslint-plugin-react defaults.
"extends": [
"eslint:recommended", "plugin:react/recommended"
],
"parser": "babel-eslint",
// Enable ES6 support. If you want to use custom Babel
// features, you will need to enable a custom parser
// as described in a section below.
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
"env": {
"browser": true,
"node": true,
"es6": true,
"jasmine": true
},
// Enable custom plugin known as eslint-plugin-react
"plugins": [
"react",
"jasmine"
],
"rules": {
// Disable `no-console` rule
"no-console": 1,
// Give a warning if identifiers contain underscores
"no-underscore-dangle": 1
}
}

2
.gitignore vendored
View File

@ -1,5 +1,7 @@
.DS_Store
node_modules/
build/
lib/
npm-debug.log
.eslintcache

View File

@ -1,36 +1,36 @@
# PDF-To-Markdown Converter
Javascript tool to parse PDF files and convert them into Markdown format. Online version at http://pdf2md.morethan.io!
Javascript library to convert PDF files into Markdown text. Online at http://pdf2md.morethan.io.
## Major Changes
- **Apr 2017** - 0.1: Initial Release
## Use
//TBD
## Contribute
Use the [issue tracker](https://github.com/jzillmann/pdf-to-markdown/issues) and/or open [pull requests](https://github.com/jzillmann/pdf-to-markdown/pulls)!
#### Useful Build Commands
### Useful Build Commands
- ```npm install``` Download all necessary npm packages
- ```npm run lint``` Lint the javascript files
- ```npm run test``` Run tests
- ```npm run check``` Lint & Test
- ```npm run build``` Build the dev version
- ```npm run start``` Run the app on an server (useful for loading of worker.js and cmaps)
- ```npm run watch``` Continuously build the project
- ```open build/index.html``` Open the build project in your default browser
- ```npm run release``` Build production version
- ```npm run deploy``` Build production version & move it to the github pages fodler
- `npm install` Download all necessary npm packages
- `npm test` Run the tests
- `npm run test-write` Run the tests and persist possibly new changes on the example file results
- `npm run lint` Lint the javascript files
- `npm run format` Run the prettier formatter
- `npm run build` Compile the typescript files to the `lib` folder
#### Release
- Increase version in package.json
- ```npm run deploy```
- commit & push
- tag with
- _git tag -a $releaseVersion -m "$releaseVersion release"_
- _git push --tags_
## Release
//TBD
### Test Release locally and use in other projects
- `npm link` in the core project
- `npm link pdf-to-markdown-core` in the target project
## Credits

1
core/.gitignore vendored
View File

@ -1 +0,0 @@
lib

View File

@ -1,33 +0,0 @@
# PDF-To-Markdown Converter Core
Javascript library to parse PDF files and convert them into Markdown format. Ui version online version at http://pdf2md.morethan.io!
## Use
//TBD
## Contribute
Use the [issue tracker](https://github.com/jzillmann/pdf-to-markdown/issues) and/or open [pull requests](https://github.com/jzillmann/pdf-to-markdown/pulls)!
## Build
- `npm install` Download all necessary npm packages
- `npm test` Run the tests
- `npm run test-write` Run the tests and persist possibly new changes on the example file results
- `npm run lint` Lint the javascript files
- `npm run format` Run the prettier formatter
- `npm run build` Compile the typescript files to the `lib` folder
### Test Release locally and use in other projects
- `npm link` in the core project
- `npm link pdf-to-markdown-core` in the target project
## Release
//TBD
## Credits
[pdf.js](https://mozilla.github.io/pdf.js/) - Mozilla's PDF parsing & rendering platform which is used as a raw parser

10154
core/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,53 +0,0 @@
{
"name": "pdf-to-markdown-core",
"version": "0.5.0",
"description": "Core logic for parsing a PDF and transforming it to Markdown",
"keywords": [
"PDF",
"Markdown",
"Converter"
],
"author": "Johannes Zillmann",
"license": "AGPL-3.0",
"repository": {
"type": "git",
"url": "https://github.com/jzillmann/pdf-to-markdown"
},
"main": "lib/src/index.js",
"types": "lib/src/index.d.ts",
"files": [
"lib/src/**/*"
],
"scripts": {
"postinstall": "patch-package",
"test": "jest",
"test-write": "jest --updateSnapshot test/Files.test.ts",
"build": "tsc",
"format": "prettier --write \"src/**/*.ts\"",
"lint": "eslint --ext .js,.ts src/** test/**",
"prepare": "npm run build",
"prepublishOnly": "npm test && npm run lint",
"preversion": "npm run lint",
"version": "npm run format && git add -A src",
"postversion": "git push && git push --tags"
},
"devDependencies": {
"@types/jest": "^29.5.12",
"@typescript-eslint/eslint-plugin": "^7.3.1",
"@typescript-eslint/parser": "^7.3.1",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"jest": "^29.7.0",
"jest-file-snapshot": "^0.5.0",
"patch-package": "^6.4.7",
"pdfjs-dist": "^2.5.207",
"prettier": "^2.2.1",
"ts-jest": "^29.1.2",
"typescript": "^5.4.2"
},
"dependencies": {
"@types/string-similarity": "^4.0.0",
"simple-statistics": "^7.7.0",
"string-similarity": "^4.0.4"
}
}

21864
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,18 +1,7 @@
{
"name": "pdf-to-markdown",
"version": "0.1.1",
"description": "A PDF to Markdown Converter",
"main": "main.js",
"scripts": {
"watch": "webpack -d --watch",
"build": "webpack",
"start": "webpack-dev-server",
"lint": "eslint src --ext .js --ext .jsx --cache",
"test": "NODE_ENV=testing mocha --compilers js:babel-core/register test --recursive",
"check": "npm run lint && npm run test",
"release": "npm run lint && rm -rf build/* && NODE_ENV=production webpack -p",
"deploy": "npm run release && cp -r build/* docs/"
},
"name": "pdf-to-markdown-core",
"version": "0.5.0",
"description": "Core logic for parsing a PDF and transforming it to Markdown",
"keywords": [
"PDF",
"Markdown",
@ -24,43 +13,42 @@
"type": "git",
"url": "https://github.com/jzillmann/pdf-to-markdown"
},
"dependencies": {
"bootstrap": "^3.3.7",
"enumify": "^1.0.4",
"pdfjs-dist": "^2.0.489",
"rc-progress": "^2.0.6",
"react": "^15.4.2",
"react-bootstrap": "^0.30.7",
"react-dom": "^15.4.2",
"react-dropzone": "^3.9.2",
"react-icons": "^2.2.3",
"react-overlays": "^0.6.12",
"remarkable": "^1.7.1"
"main": "lib/src/index.js",
"types": "lib/src/index.d.ts",
"files": [
"lib/src/**/*"
],
"scripts": {
"postinstall": "patch-package",
"test": "jest",
"test-write": "jest --updateSnapshot test/Files.test.ts",
"build": "tsc",
"format": "prettier --write \"src/**/*.ts\"",
"lint": "eslint --ext .js,.ts src/** test/**",
"prepare": "npm run build",
"prepublishOnly": "npm test && npm run lint",
"preversion": "npm run lint",
"version": "npm run format && git add -A src",
"postversion": "git push && git push --tags"
},
"devDependencies": {
"babel-core": "^6.22.1",
"babel-eslint": "^7.1.1",
"babel-loader": "^7.1.1",
"babel-plugin-transform-runtime": "^6.22.0",
"babel-preset-es2015": "^6.22.0",
"babel-preset-react": "^6.22.0",
"babel-preset-stage-0": "^6.22.0",
"babel-preset-stage-2": "^6.24.1",
"chai": "^3.5.0",
"copy-webpack-plugin": "^4.0.1",
"css-loader": "^0.26.1",
"esformatter-jsx": "^7.4.1",
"eslint": "^4.18.2",
"eslint-plugin-jasmine": "^2.2.0",
"eslint-plugin-react": "^6.9.0",
"extract-text-webpack-plugin": "^3.0.2",
"file-loader": "^0.10.0",
"html-webpack-plugin": "^2.22.0",
"mocha": "^3.2.0",
"style-loader": "^0.13.1",
"url-loader": "^0.5.7",
"webpack": "^3.11.0",
"webpack-cli": "^2.0.15",
"webpack-dev-server": "^2.11.1"
"@types/jest": "^29.5.12",
"@typescript-eslint/eslint-plugin": "^7.3.1",
"@typescript-eslint/parser": "^7.3.1",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"jest": "^29.7.0",
"jest-file-snapshot": "^0.5.0",
"patch-package": "^6.4.7",
"pdfjs-dist": "^2.5.207",
"prettier": "^2.2.1",
"ts-jest": "^29.1.2",
"typescript": "^5.4.2"
},
"dependencies": {
"@types/string-similarity": "^4.0.0",
"simple-statistics": "^7.7.0",
"string-similarity": "^4.0.4",
"uuid": "^9.0.1"
}
}

View File

@ -1,21 +0,0 @@
a {
cursor: pointer;
}
.disabled {
pointer-events: none;
cursor: default;
opacity: 0.6;
}
.btn-round {
border-radius: 24px;
}
body {
color: #212121;
font-family: "Helvetica Neue", "Calibri Light", Roboto, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
letter-spacing: 0.02em;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 318 B

View File

@ -1,56 +0,0 @@
import React from 'react';
import Grid from 'react-bootstrap/lib/Grid'
import TopBar from './TopBar.jsx';
import FooterBar from './FooterBar.jsx'
import { View } from '../models/AppState.jsx';
import UploadView from './UploadView.jsx';
import LoadingView from './LoadingView.jsx';
import ResultView from './ResultView.jsx';
import DebugView from './DebugView.jsx';
export default class App extends React.Component {
static propTypes = {
appState: React.PropTypes.object.isRequired,
};
render() {
// console.debug(this.props.appState);
const appState = this.props.appState;
var mainView;
switch (this.props.appState.mainView) {
case View.UPLOAD:
mainView = <UploadView uploadPdfFunction={ appState.storeFileBuffer } />
break;
case View.LOADING:
mainView = <LoadingView fileBuffer={ appState.fileBuffer } storePdfPagesFunction={ appState.storePdfPages } />
break;
case View.RESULT:
mainView = <ResultView pages={ appState.pages } transformations={ appState.transformations } />
break;
case View.DEBUG:
mainView = <DebugView pages={ appState.pages } transformations={ appState.transformations } />
break;
default:
throw `View ${this.props.appState.mainView} not supported!`;
}
const title = appState.metadata && appState.metadata.title ? appState.metadata.title : '';
return (
<div>
<TopBar mainView={ appState.mainView } switchMainViewFunction={ appState.switchMainView } title={ title } />
<Grid>
<div>
{ mainView }
</div>
</Grid>
<FooterBar/>
</div>
);
}
}

View File

@ -1,28 +0,0 @@
import React from 'react';
import FaFilePdfO from 'react-icons/lib/fa/file-pdf-o'
export default class AppLogo extends React.Component {
static propTypes = {
onClick: React.PropTypes.func,
};
constructor(props, context) {
super(props, context);
this.handleClick = this.handleClick.bind(this);
}
handleClick(e) {
e.preventDefault();
this.props.onClick(e);
}
render() {
return (
<a href="" onClick={ this.handleClick }>
<FaFilePdfO/> PDF To Markdown Converter</a>
);
}
}

Some files were not shown because too many files have changed in this diff Show More