Skip to content

Commit

Permalink
Merge pull request #175 from Fdawgs/chore/ci-and-deps
Browse files Browse the repository at this point in the history
Improve workflows
  • Loading branch information
Fdawgs authored Dec 28, 2020
2 parents bbdeb60 + 73f6ccc commit f963134
Show file tree
Hide file tree
Showing 13 changed files with 480 additions and 568 deletions.
42 changes: 21 additions & 21 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
module.exports = {
env: {
es2021: true,
node: true
node: true,
},
extends: [
'airbnb-base',
'plugin:promise/recommended',
'plugin:jest/recommended',
'plugin:jsdoc/recommended',
'plugin:security/recommended',
'prettier'
"airbnb-base",
"plugin:promise/recommended",
"plugin:jest/recommended",
"plugin:jsdoc/recommended",
"plugin:security/recommended",
"prettier",
],
parserOptions: {
sourceType: 'module',
sourceType: "module",
ecmaFeatures: {
impliedStrict: true
}
impliedStrict: true,
},
},
plugins: ['import', 'jest', 'jsdoc', 'json', 'promise', 'security'],
plugins: ["import", "jest", "jsdoc", "promise", "security"],
root: true,
rules: {
'import/no-extraneous-dependencies': 'error',
'no-console': 'off',
'no-multiple-empty-lines': [
'error',
"import/no-extraneous-dependencies": "error",
"no-console": "off",
"no-multiple-empty-lines": [
"error",
{
max: 1
}
max: 1,
},
],
'prefer-destructuring': 'off',
'promise/prefer-await-to-callbacks': 'warn',
'promise/prefer-await-to-then': 'warn'
}
"prefer-destructuring": "off",
"promise/prefer-await-to-callbacks": "warn",
"promise/prefer-await-to-then": "warn",
},
};
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
title: ""
labels: bug
assignees: ''
assignees: ""
---

### Describe the bug
Expand Down
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
title: ""
labels: enhancement
assignees: ''
assignees: ""
---

**Is your feature request related to a problem? Please describe.**
Expand Down
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: 2
updates:
- package-ecosystem: npm
directory: '/'
directory: "/"
schedule:
interval: monthly
open-pull-requests-limit: 99
4 changes: 2 additions & 2 deletions .github/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ daysUntilClose: 7
exemptLabels:
- bug
- enhancement
- 'good first issue'
- 'help wanted'
- "good first issue"
- "help wanted"

# Label to use when marking an issue as stale
staleLabel: stale
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
with:
node-version: 14.x
registry-url: https://registry.npmjs.org/
- run: yarn install
- run: yarn --frozen-lockfile
- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
83 changes: 22 additions & 61 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,45 +3,52 @@ name: CI
on:
push:
paths-ignore:
- 'docs/**'
- '*.md'
- "docs/**"
- "*.md"
pull_request:
paths-ignore:
- 'docs/**'
- '*.md'
- "docs/**"
- "*.md"

jobs:
lint:
name: Lint
name: Lint Code
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 14.x
- name: Install
run: yarn --immutable
run: yarn --frozen-lockfile
- name: Run ESLint
run: yarn lint
- name: Run Prettier
run: yarn lint:prettier:ci

macos:
name: macOS Build
unittests:
name: Unit Tests
if: github.event.pull_request.draft == false
strategy:
matrix:
node-version: [10.x, 12.x, 14.x]
runs-on: macos-latest
os: [macos-latest, ubuntu-20.04, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Install
run: |
yarn --immutable
brew install poppler
run: yarn --frozen-lockfile
- name: Install macOS dependencies
if: matrix.os == 'macos-latest'
run: brew install poppler
- name: Install Ubuntu dependencies
if: matrix.os == 'ubuntu-20.04'
run: sudo apt-get -y install poppler-data poppler-utils
- name: Run Tests
run: yarn jest-coverage
- name: Coveralls Parallel
Expand All @@ -50,56 +57,10 @@ jobs:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel: true

ubuntu:
name: Ubuntu Build
strategy:
matrix:
node-version: [10.x, 12.x, 14.x]
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Install
run: |
yarn --immutable
sudo apt-get -y install poppler-data poppler-utils
- name: Run Tests
run: yarn jest-coverage
- name: Coveralls Parallel
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel: true

windows:
name: Windows Build
strategy:
matrix:
node-version: [10.x, 12.x, 14.x]
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Install
run: yarn --immutable
- name: Run Tests
run: |
yarn jest-coverage
- name: Coveralls Parallel
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel: true

coverage:
name: Aggregate Coverage Calculations
needs: [macos, ubuntu, windows]
if: github.event.pull_request.draft == false
needs: unittests
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
Expand All @@ -110,7 +71,7 @@ jobs:

automerge:
name: Automatically merge Dependabot pull requests
needs: [lint, macos, ubuntu, windows]
needs: [lint, unittests]
runs-on: ubuntu-latest
steps:
- uses: fastify/github-action-merge-dependabot@v1
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
name: 'CodeQL'
name: "CodeQL"

on:
push:
Expand All @@ -12,7 +12,7 @@ on:
# The branches below must be a subset of the branches above
branches: [master]
schedule:
- cron: '0 15 * * 3'
- cron: "0 15 * * 3"

jobs:
analyze:
Expand All @@ -24,7 +24,7 @@ jobs:
matrix:
# Override automatic language detection by changing the below list
# Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python']
language: ['javascript']
language: ["javascript"]
# Learn more...
# https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection

Expand Down
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ brew install poppler
Once they have been installed, you will need to pass the `poppler-utils` installation directory in as parameters to an instance of the Poppler class:

```js
const { Poppler } = require('node-poppler');
const poppler = new Poppler('./usr/bin');
const { Poppler } = require("node-poppler");
const poppler = new Poppler("./usr/bin");
```

## API

```js
const { Poppler } = require('node-poppler');
const { Poppler } = require("node-poppler");
```

[API Documentation can be found here](https://github.com/Fdawgs/node-poppler/blob/master/API.md)
Expand All @@ -66,14 +66,14 @@ const { Poppler } = require('node-poppler');
Example of an async await call poppler.pdfToCairo, to convert only the first and second page of a PDF file to PNG:

```js
const { Poppler } = require('node-poppler');
const { Poppler } = require("node-poppler");

const file = 'test_document.pdf';
const file = "test_document.pdf";
const poppler = new Poppler();
const options = {
firstPageToConvert: 1,
lastPageToConvert: 2,
pngFile: true
pngFile: true,
};
const outputFile = `test_document.png`;

Expand All @@ -88,13 +88,13 @@ Every field of the `options` object is optional.
Example of calling poppler.pdfToHtml with a promise:

```js
const { Poppler } = require('node-poppler');
const { Poppler } = require("node-poppler");

const file = 'test_document.pdf';
const file = "test_document.pdf";
const poppler = new Poppler();
const options = {
firstPageToConvert: 1,
lastPageToConvert: 2
lastPageToConvert: 2,
};

poppler.pdfToHtml(file, options).then((res) => {
Expand All @@ -109,13 +109,13 @@ Every field of the `options` object is entirely optional.
Example of calling poppler.pdfToText with a promise:

```js
const { Poppler } = require('node-poppler');
const { Poppler } = require("node-poppler");

const file = 'test_document.pdf';
const file = "test_document.pdf";
const poppler = new Poppler();
const options = {
firstPageToConvert: 1,
lastPageToConvert: 2
lastPageToConvert: 2,
};

poppler.pdfToText(file, options).then((res) => {
Expand Down
5 changes: 0 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,9 @@
"testTimeout": 10000
},
"prettier": {
"arrowParens": "always",
"bracketSpacing": true,
"endOfLine": "lf",
"semi": true,
"singleQuote": true,
"tabWidth": 4,
"trailingComma": "none",
"useTabs": true
},
"devDependencies": {
Expand All @@ -69,7 +65,6 @@
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jest": "^24.1.3",
"eslint-plugin-jsdoc": "^30.7.8",
"eslint-plugin-json": "^2.1.2",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-security": "^1.4.0",
"glob": "^7.1.6",
Expand Down
Loading

0 comments on commit f963134

Please sign in to comment.