Use @pika/pack for packaging

This commit is contained in:
yumauri
2019-10-23 11:29:08 +03:00
parent 6d4812c117
commit b8eaf459d9
12 changed files with 2423 additions and 78 deletions
+8 -4
View File
@@ -14,7 +14,8 @@ jobs:
steps:
- uses: actions/checkout@master
- name: Setup Node
- name: Setup Node ${{ matrix.node }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}
@@ -22,13 +23,16 @@ jobs:
- name: Install dependencies
run: yarn
- name: Lint
- name: Linting and check spelling
run: yarn lint
- name: Test
- name: Test and collect coverage
run: yarn test
- name: Coveralls
- name: Build package
run: yarn build
- name: Push coverage to Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.github_token }}
+1
View File
@@ -1,6 +1,7 @@
/node_modules/
/coverage/
/lib/
/pkg/
yarn-error.log
.DS_Store
.project
+20 -17
View File
@@ -13,16 +13,23 @@
"scripts": {
"dev": "ts-node src/index.ts",
"test": "jest --config jestconfig.json",
"build": "npm run clean && tsc",
"clean": "rimraf lib",
"build": "pika build",
"format": "prettier --write \"src/**/*.ts\"",
"lint": "tslint -p tsconfig.json && npm run spell",
"spell": "yaspeller .",
"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"
"lint": "tslint -p tsconfig.json && yarn spell",
"spell": "yaspeller ."
},
"@pika/pack": {
"pipeline": [
[
"@pika/plugin-ts-standard-pkg"
],
[
"@pika/plugin-build-node",
{
"minNodeVersion": "10"
}
]
]
},
"repository": {
"type": "git",
@@ -32,27 +39,23 @@
"url": "https://github.com/yumauri/gotenberg-js-client/issues"
},
"homepage": "https://github.com/yumauri/gotenberg-js-client#readme",
"files": [
"lib/**/*"
],
"main": "lib/index.js",
"types": "lib/index.d.ts",
"sideEffects": false,
"dependencies": {
"@types/node": "^10.9.0",
"form-data": "^2.5.1"
},
"devDependencies": {
"@pika/pack": "^0.5.0",
"@pika/plugin-build-node": "^0.7.0",
"@pika/plugin-ts-standard-pkg": "^0.7.0",
"@types/jest": "^24.0.19",
"jest": "^24.9.0",
"prettier": "^1.18.2",
"rimraf": "^3.0.0",
"ts-jest": "^24.1.0",
"ts-node": "^8.4.1",
"tslint": "^5.20.0",
"tslint-config-prettier": "^1.18.0",
"tslint-config-security": "^1.16.0",
"tslint-config-standard-plus": "^2.2.0",
"tslint-config-standard-plus": "^2.3.0",
"typescript": "^3.6.4",
"yaspeller": "^6.0.2"
},
+1 -1
View File
@@ -1,4 +1,4 @@
import * as FormData from 'form-data'
import FormData from 'form-data'
////////////////////////////////////////////////////////////////////////////////
/// gotenberg client ///////////////////////////////////////////////////////////
+3 -3
View File
@@ -1,6 +1,6 @@
import * as http from 'http'
import * as https from 'https'
import * as FormData from 'form-data'
import http from 'http'
import https from 'https'
import FormData from 'form-data'
import { GotenbergClientFunction } from './'
/**
+3
View File
@@ -20,3 +20,6 @@ export * from './page'
// export pipe helper
export { default as pipe } from './_pipe'
// export types
export * from './_types'
+1 -1
View File
@@ -1,4 +1,4 @@
import * as FormData from 'form-data'
import FormData from 'form-data'
import {
PingRequest,
RequestFields,
Binary file not shown.
+20
View File
@@ -0,0 +1,20 @@
const { createWriteStream } = require('fs')
const { a4, convert, gotenberg, html, pipe, please, to } = require('../pkg')
// need to run Gotenberg like this
// docker run --rm -p 3500:3000 thecodingmachine/gotenberg:6
pipe(
gotenberg('http://localhost:3500'),
convert,
html,
to(a4, {
top: 0,
right: 0.2, // ~5mm
bottom: 0,
left: 0.2, // ~5mm
}),
please
)(`file://${__dirname}/statement.html`)
.then(pdf => pdf.pipe(createWriteStream(`${__dirname}/statement.pdf`)))
.catch(console.error)
+2 -1
View File
@@ -1,7 +1,8 @@
import { createWriteStream } from 'fs'
import { a4, convert, gotenberg, html, pipe, please, to } from '../src'
//
// need to run Gotenberg like this
// docker run --rm -p 3500:3000 thecodingmachine/gotenberg:6
pipe(
gotenberg('http://localhost:3500'),
+6 -5
View File
@@ -1,15 +1,16 @@
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"declaration": true,
"target": "es2019",
"module": "esnext",
// "lib": [], // there is problem with URL, when empty :( https://github.com/DefinitelyTyped/DefinitelyTyped/issues/34960
"moduleResolution": "node",
"esModuleInterop": true,
"strict": true,
"noImplicitAny": false,
"noUnusedLocals": true,
"noUnusedParameters": true,
"removeComments": true,
"allowSyntheticDefaultImports": true,
"outDir": "./lib",
"declaration": true,
"baseUrl": "./src"
},
"include": ["src/**/*"],
+2358 -46
View File
File diff suppressed because it is too large Load Diff