Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,11 @@ jobs:

- name: Publish to NPM
# Build docs/definitions, and remove dev values
# from package.json before publishing to reduce package size
# from package.json before publishing to reduce package size.
# Force install to bypass OS/CPU checks; does not impact published package
run: |
npm i -g npm@latest
npm i --ignore-scripts
npm i -f --ignore-scripts
npm run build --if-present
npm pkg delete commitlint devDependencies jest scripts
npm publish --access public --ignore-scripts
Expand Down Expand Up @@ -102,10 +103,11 @@ jobs:
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Build docs/definitions, and remove dev values
# from package.json before publishing to reduce package size
# from package.json before publishing to reduce package size.
# Force install to bypass OS/CPU checks; does not impact published package
run: |
npm i -g npm@latest
npm i --ignore-scripts
npm i -f --ignore-scripts
npm run build --if-present
npm pkg delete commitlint devDependencies jest scripts
npm publish --access public --ignore-scripts --provenance
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ jobs:
node-version-file: .nvmrc

- name: Install
run: npm i --ignore-scripts
# Force install to bypass OS/CPU checks; this job only lints
run: npm i -f --ignore-scripts

- name: Audit NPM package signatures and provenance attestations
run: npm audit signatures
Expand Down
5 changes: 5 additions & 0 deletions .licensee.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"corrections": true,
"ignore": [
{
"prefix": "node-unrtf-win32"
}
],
"licenses": {
"blueOak": "bronze",
"spdx": ["CC-BY-3.0"]
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
> **Note**
> An UnRTF v0.19.3 Windows binary is included with this module which, due to its age, has several issues,
> An UnRTF v0.19.3 binary is included as an optional dependency for Windows users via [node-unrtf-win32](https://github.com/Fdawgs/node-unrtf-win32) which, due to its age, has several issues,
> such as the [inability to convert RTF documents generated from 2007 onwards](https://github.com/Fdawgs/node-unrtf/issues/83), and a [bug in the
> `noPictures` option that still generates pictures](https://github.com/Fdawgs/node-unrtf/issues/81).
> It is recommended that whatever application is using the `node-unrtf` module is run in a Linux environment using the latest
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,8 @@
},
"dependencies": {
"semver": "^7.7.2"
},
"optionalDependencies": {
"node-unrtf-win32": "^1.0.0"
}
}
18 changes: 9 additions & 9 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function parseOptions(acceptedOptions, options, version) {
continue;
}

// @ts-ignore: keys are from options, TS cannot infer this
// @ts-ignore: Keys are from options, TS cannot infer this
const option = options[key];
const acceptedOption = acceptedOptions[key];

Expand Down Expand Up @@ -191,13 +191,13 @@ class UnRTF {
this.#unrtfPath = unrtfPath;
}
if (platform === "win32" && !unrtfPath) {
this.#unrtfPath = pathResolve(
__dirname,
"lib",
"win32",
"unrtf-0.19.3",
"bin"
);
try {
// @ts-ignore: Optional dependency
// eslint-disable-next-line n/global-require -- Conditional require
this.#unrtfPath = require("node-unrtf-win32");
} catch {
// Leave #unrtfPath empty; the generic "Unable to find ... binaries" error below will fire
}
}
}

Expand Down Expand Up @@ -273,7 +273,7 @@ class UnRTF {
);
}
} catch (err) {
// @ts-ignore: code property found in fs errors
// @ts-ignore: Code property found in fs errors
if (err instanceof Error && err.code !== "ENOENT") {
throw err;
}
Expand Down
3 changes: 2 additions & 1 deletion src/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ function getTestBinaryPath() {
let unrtfPath = /(.+)unrtf/u.exec(which)?.[1];

if (platform === "win32" && !unrtfPath) {
unrtfPath = join(__dirname, "lib", "win32", "unrtf-0.19.3", "bin");
// @ts-ignore: Optional dependency
unrtfPath = require("node-unrtf-win32");
}

if (!unrtfPath) {
Expand Down
Binary file removed src/lib/win32/unrtf-0.19.3/bin/unrtf.exe
Binary file not shown.

This file was deleted.

Loading