Open Document Format made easy using pure JavaScript and Node.js
npm install @greenjd/simple-odfsh
git clone https://github.com//simple-odf
`
1. Run npm install from the root of your clone of this project to install dependencies.
`sh
# navigate into the cloned repo
cd simple-odf
# install the dependencies
npm install
`
$3
To make a local build run:
`sh
npm build
npm pack
`
This generates a number of javascript files in the dist/ directory and a simple-odf- file in the project root.
To actually use the locally built lib, switch to another repository reproducing the specific issue you want to fix (or just generate a local repo). Then install the locally built package:
`sh
cd
npm install /*.tgz
`
$3
There are two different kind of tests which can be run locally:
#### Unit Tests
Each class of project should be tested isolated which is done by the unit tests. To run them, just execute npm test.
$3
There are also some tests which verify that the resulting document is correct. These cannot be run yet.
When debugging a specific test, change describe() or it() to fdescribe() and fit() to focus execution to just that one test. This will keep the output clean and speed up execution by not running irrelevant tests.
Usage
If you want to use this package in your software, add it to your project dependencies via npm or yarn.
`sh
npm
npm i simple-odf
yarn
yarn add simple-odf
`
Now you can create your first document.
`javascript
const simpleOdf = require('simple-odf');
const document = new simpleOdf.TextDocument();
const body = document.getBody();
body.addHeading('Welcome to simple-odf');
body.addParagraph('The quick, brown fox jumps over a lazy dog.');
document.saveFlat('/home/homer/Welcome.fodf');
``