Skip to content

Commit

Permalink
Merge pull request #562 from Fdawgs/chore/2024-01
Browse files Browse the repository at this point in the history
  • Loading branch information
Fdawgs authored Jan 24, 2024
2 parents d91f466 + 9b25cf4 commit a949a52
Show file tree
Hide file tree
Showing 19 changed files with 886 additions and 1,205 deletions.
12 changes: 2 additions & 10 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ module.exports = {
"plugin:jsdoc/recommended",
"plugin:promise/recommended",
"plugin:regexp/recommended",
"plugin:security/recommended",
"plugin:security-node/recommended",
"plugin:security/recommended-legacy",
"prettier",
],
overrides: [
Expand Down Expand Up @@ -40,14 +39,7 @@ module.exports = {
// Explicitly tell ESLint to parse JavaScript as CommonJS, as airbnb-base sets this to "modules" for ECMAScript
sourceType: "script",
},
plugins: [
"import",
"jsdoc",
"promise",
"regexp",
"security",
"security-node",
],
plugins: ["import", "jsdoc", "promise", "regexp", "security"],
root: true,
rules: {
"@eslint-community/eslint-comments/disable-enable-pair": "off",
Expand Down
1 change: 0 additions & 1 deletion .github/FUNDING.yml

This file was deleted.

79 changes: 0 additions & 79 deletions .github/ISSUE_TEMPLATE/bug_report.yml

This file was deleted.

31 changes: 0 additions & 31 deletions .github/ISSUE_TEMPLATE/feature_request.yml

This file was deleted.

15 changes: 0 additions & 15 deletions .github/PULL_REQUEST_TEMPLATE/pull_request_template.md

This file was deleted.

33 changes: 18 additions & 15 deletions .github/workflows/automerge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,26 @@ jobs:
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const { writeFile } = require("node:fs/promises");
const { owner, repo } = context.repo;
const artifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
owner,
repo,
run_id: ${{ github.event.workflow_run.id }},
});
const matchArtifact = artifacts.data.artifacts.filter((artifact) => {
return artifact.name == 'pr';
})[0];
const matchArtifact = artifacts.data.artifacts.find(
(artifact) => artifact.name == "pr"
);
const download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
owner,
repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
archive_format: "zip",
});
fs.writeFileSync('${{github.workspace}}/pr.zip', Buffer.from(download.data));
await writeFile("${{github.workspace}}/pr.zip", Buffer.from(download.data));
- name: Unzip artifact
run: unzip pr.zip
Expand All @@ -52,12 +53,14 @@ jobs:
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const fs = require('fs');
const pull_number = Number(fs.readFileSync('./NR'));
const { readFile } = require("node:fs/promises");
const { owner, repo } = context.repo;
const pull_number = Number(await readFile("./NR", "utf8"));
await github.rest.pulls.merge({
merge_method: "squash",
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: pull_number,
owner,
repo,
pull_number,
});
67 changes: 56 additions & 11 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ on:
# Allows this workflow to be run manually from the Actions tab
workflow_dispatch:

permissions:
contents: write
id-token: write
pull-requests: write

jobs:
release:
name: Create/Update Release Pull Request
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
outputs:
release_created: ${{ steps.release.outputs.release_created }}
steps:
- name: Release Please
id: release
Expand All @@ -29,26 +29,71 @@ jobs:
release-type: node
package-name: node-poppler

publish-npm:
name: Publish to NPM
needs: release
if: needs.release.outputs.release_created == 'true'
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- name: Check out repo
if: steps.release.outputs.release_created
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Setup Node
if: steps.release.outputs.release_created
uses: actions/setup-node@v4
with:
node-version: lts/*
registry-url: https://registry.npmjs.org/
registry-url: https://registry.npmjs.org

- name: Publish to NPM
if: steps.release.outputs.release_created
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# Build docs and TS definitions and remove dev values from package.json
# Build docs and TS definitions, and remove dev values
# from package.json before publishing to reduce package size
run: |
npm i --ignore-scripts
npm run build
npm pkg delete commitlint devDependencies jest scripts
npm publish --access public --ignore-scripts --provenance
publish-ghp:
name: Publish to GitHub Packages
needs: release
if: needs.release.outputs.release_created == 'true'
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
packages: write
steps:
- name: Check out repo
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: lts/*
registry-url: https://npm.pkg.github.com
scope: "@fdawgs"

- name: Scope package
run: |
pkgName=$(npm pkg get name | tr -d '"')
npm pkg set name="@fdawgs/$pkgName"
- name: Publish to GitHub Packages
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Build docs and TS definitions, and remove dev values
# from package.json before publishing to reduce package size
run: |
npm i --ignore-scripts
npm run build
npm pkg delete commitlint devDependencies jest scripts
npm publish --ignore-scripts --provenance
npm publish --access public --ignore-scripts --provenance
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npm run lint:prettier && npm run lint:licenses && npm test
npm run lint:licenses && npm test
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ dist
package.json
API.md
CHANGELOG.md
/types/index.d.ts

# lock files
bun.lockb
Expand Down
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
},
"javascript.updateImportsOnFileMove.enabled": "always",
"npm.packageManager": "npm",
"prettier.prettierPath": "./node_modules/prettier",
"redhat.telemetry.enabled": false
}
6 changes: 3 additions & 3 deletions API.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ Lists the fonts used in a PDF file along with various information for each font.
| [options.listSubstitutes] | <code>boolean</code> | List the substitute fonts that poppler will use for non-embedded fonts. |
| [options.ownerPassword] | <code>string</code> | Owner password (for encrypted files). |
| [options.printVersionInfo] | <code>boolean</code> | Print copyright and version info. |
| [options.userPassword] | <code>string</code> | User password (for encrypted files). * |
| [options.userPassword] | <code>string</code> | User password (for encrypted files). |

<a name="Poppler+pdfImages"></a>

Expand Down Expand Up @@ -260,7 +260,7 @@ Converts a PDF file to HTML.
| [options.ownerPassword] | <code>string</code> | Owner password (for encrypted files). |
| [options.printVersionInfo] | <code>boolean</code> | Print copyright and version info. |
| [options.quiet] | <code>boolean</code> | Do not print any messages or errors. |
| [options.singlePage] | <code>boolean</code> | generate single HTML that includes all pages. |
| [options.singlePage] | <code>boolean</code> | Generate single HTML that includes all pages. |
| [options.stdout] | <code>boolean</code> | Use standard output. |
| [options.userPassword] | <code>string</code> | User password (for encrypted files). |
| [options.wordBreakThreshold] | <code>number</code> | Adjust the word break threshold percent. Default is 10. Word break occurs when distance between two adjacent characters is greater than this percent of character height. |
Expand Down Expand Up @@ -395,7 +395,7 @@ Converts a PDF file to TXT.
| [options] | <code>object</code> | Object containing options to pass to binary. |
| [options.boundingBoxXhtml] | <code>boolean</code> | Generate an XHTML file containing bounding box information for each word in the file. |
| [options.boundingBoxXhtmlLayout] | <code>boolean</code> | Generate an XHTML file containing bounding box information for each block, line, and word in the file. |
| [options.cropBox] | <code>boolean</code> | Use the crop box rather than the media box with `options.boundingBoxXhtml` and `options.boundingBoxXhtmlLayout` |
| [options.cropBox] | <code>boolean</code> | Use the crop box rather than the media box with `options.boundingBoxXhtml` and `options.boundingBoxXhtmlLayout`. |
| [options.cropHeight] | <code>number</code> | Specifies the height of crop area in pixels (image output) or points (vector output). |
| [options.cropWidth] | <code>number</code> | Specifies the width of crop area in pixels (image output) or points (vector output). |
| [options.cropXAxis] | <code>number</code> | Specifies the x-coordinate of the crop area top left corner in pixels (image output) or points (vector output). |
Expand Down
Loading

0 comments on commit a949a52

Please sign in to comment.