page2pdf_server 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.babelrc CHANGED
@@ -1,3 +1,3 @@
1
- {
2
- "presets": ["@babel/preset-env", "@babel/preset-typescript"]
3
- }
1
+ {
2
+ "presets": ["@babel/preset-env", "@babel/preset-typescript"]
3
+ }
package/.eslintrc CHANGED
@@ -1,33 +1,33 @@
1
- {
2
- "root": true,
3
- "parser": "@typescript-eslint/parser",
4
- "parserOptions": {
5
- "ecmaVersion": "latest",
6
- "sourceType": "module",
7
- "project": "./tsconfig.json"
8
- },
9
- "plugins": ["import", "prettier"],
10
- "ignorePatterns": ["node_modules/*", "dist/*", ".*", "jest*", "ecosystem*" ],
11
- "extends": [
12
- "plugin:@typescript-eslint/recommended",
13
- "prettier"
14
- ],
15
- "rules": {
16
- "@typescript-eslint/explicit-module-boundary-types": "off",
17
- "@typescript-eslint/no-empty-interface": "off",
18
- "@typescript-eslint/ban-types": "off",
19
- "@typescript-eslint/ban-ts-comment": "off",
20
- "@typescript-eslint/no-non-null-assertion": "off",
21
- "@typescript-eslint/no-explicit-any": "off",
22
- "@typescript-eslint/no-unused-vars": ["error", {
23
- "argsIgnorePattern": "^_"
24
- }],
25
- "import/order": ["error"],
26
- "prettier/prettier": [
27
- "error",
28
- {
29
- "endOfLine": "auto"
30
- }
31
- ]
32
- }
1
+ {
2
+ "root": true,
3
+ "parser": "@typescript-eslint/parser",
4
+ "parserOptions": {
5
+ "ecmaVersion": "latest",
6
+ "sourceType": "module",
7
+ "project": "./tsconfig.json"
8
+ },
9
+ "plugins": ["import", "prettier"],
10
+ "ignorePatterns": ["node_modules/*", "dist/*", ".*", "jest*", "ecosystem*" ],
11
+ "extends": [
12
+ "plugin:@typescript-eslint/recommended",
13
+ "prettier"
14
+ ],
15
+ "rules": {
16
+ "@typescript-eslint/explicit-module-boundary-types": "off",
17
+ "@typescript-eslint/no-empty-interface": "off",
18
+ "@typescript-eslint/ban-types": "off",
19
+ "@typescript-eslint/ban-ts-comment": "off",
20
+ "@typescript-eslint/no-non-null-assertion": "off",
21
+ "@typescript-eslint/no-explicit-any": "off",
22
+ "@typescript-eslint/no-unused-vars": ["error", {
23
+ "argsIgnorePattern": "^_"
24
+ }],
25
+ "import/order": ["error"],
26
+ "prettier/prettier": [
27
+ "error",
28
+ {
29
+ "endOfLine": "auto"
30
+ }
31
+ ]
32
+ }
33
33
  }
@@ -1,28 +1,28 @@
1
- ---
2
- name: Bug report
3
- about: Create a report to help us improve
4
- title: ""
5
- labels: "bug"
6
- assignees: ""
7
- ---
8
-
9
- # Description
10
-
11
- _A clear and concise description of what the bug is._
12
-
13
- # Reproduction
14
-
15
- _Steps to reproduce the behavior:_
16
-
17
- _1. Go to '...'_
18
- _2. Click on '....'_
19
- _3. Scroll down to '....'_
20
- _4. See error_
21
-
22
- # Expected
23
-
24
- _A clear and concise description of what you expected to happen._
25
-
26
- # Screenshots
27
-
28
- _If applicable, add screenshots to help explain your problem._
1
+ ---
2
+ name: Bug report
3
+ about: Create a report to help us improve
4
+ title: ""
5
+ labels: "bug"
6
+ assignees: ""
7
+ ---
8
+
9
+ # Description
10
+
11
+ _A clear and concise description of what the bug is._
12
+
13
+ # Reproduction
14
+
15
+ _Steps to reproduce the behavior:_
16
+
17
+ _1. Go to '...'_
18
+ _2. Click on '....'_
19
+ _3. Scroll down to '....'_
20
+ _4. See error_
21
+
22
+ # Expected
23
+
24
+ _A clear and concise description of what you expected to happen._
25
+
26
+ # Screenshots
27
+
28
+ _If applicable, add screenshots to help explain your problem._
@@ -1,15 +1,15 @@
1
- ---
2
- name: Feature request
3
- about: Suggest an idea for this project
4
- title: ""
5
- labels: "implementation"
6
- assignees: ""
7
- ---
8
-
9
- # Request
10
-
11
- _A clear and concise description of what the problem is._
12
-
13
- # Suggestion
14
-
15
- _A clear and concise description of what you want to happen._
1
+ ---
2
+ name: Feature request
3
+ about: Suggest an idea for this project
4
+ title: ""
5
+ labels: "implementation"
6
+ assignees: ""
7
+ ---
8
+
9
+ # Request
10
+
11
+ _A clear and concise description of what the problem is._
12
+
13
+ # Suggestion
14
+
15
+ _A clear and concise description of what you want to happen._
@@ -1,15 +1,15 @@
1
- ---
2
- name: Refactoring
3
- about: Add content to be refactored
4
- title: ""
5
- labels: "refactoring"
6
- assignees: ""
7
- ---
8
-
9
- # Refactor description
10
-
11
- _A clear and concise description of the related Content._
12
-
13
- # Refactor suggestion
14
-
15
- _A clear and concise description of any alternative solutions or features you've considered._
1
+ ---
2
+ name: Refactoring
3
+ about: Add content to be refactored
4
+ title: ""
5
+ labels: "refactoring"
6
+ assignees: ""
7
+ ---
8
+
9
+ # Refactor description
10
+
11
+ _A clear and concise description of the related Content._
12
+
13
+ # Refactor suggestion
14
+
15
+ _A clear and concise description of any alternative solutions or features you've considered._
@@ -1,18 +1,18 @@
1
- # Description
2
-
3
- _Explain briefly about the purpose & context of this PR_
4
-
5
- # Screenshots
6
-
7
- _If possible add a screenshot and/or gif_
8
-
9
- # Example | Usage
10
-
11
- _Please share examples and how to reproduce_
12
-
13
- ---
14
-
15
- # Related Issues | Pr
16
-
17
- _`close`|`resolve` <ISSUE> (ex. `resolve #20`)_
18
- _link issues to close automatically_
1
+ # Description
2
+
3
+ _Explain briefly about the purpose & context of this PR_
4
+
5
+ # Screenshots
6
+
7
+ _If possible add a screenshot and/or gif_
8
+
9
+ # Example | Usage
10
+
11
+ _Please share examples and how to reproduce_
12
+
13
+ ---
14
+
15
+ # Related Issues | Pr
16
+
17
+ _`close`|`resolve` <ISSUE> (ex. `resolve #20`)_
18
+ _link issues to close automatically_
package/.github/stale.yml CHANGED
@@ -1,17 +1,17 @@
1
- # Number of days of inactivity before an issue becomes stale
2
- daysUntilStale: 100
3
- # Number of days of inactivity before a stale issue is closed
4
- daysUntilClose: 7
5
- # Issues with these labels will never be considered stale
6
- exemptLabels:
7
- - pinned
8
- - security
9
- # Label to use when marking an issue as stale
10
- staleLabel: wontfix
11
- # Comment to post when marking an issue as stale. Set to `false` to disable
12
- markComment: >
13
- This issue has been automatically marked as stale because it has not had
14
- recent activity. It will be closed if no further activity occurs. Thank you
15
- for your contributions.
16
- # Comment to post when closing a stale issue. Set to `false` to disable
17
- closeComment: false
1
+ # Number of days of inactivity before an issue becomes stale
2
+ daysUntilStale: 100
3
+ # Number of days of inactivity before a stale issue is closed
4
+ daysUntilClose: 7
5
+ # Issues with these labels will never be considered stale
6
+ exemptLabels:
7
+ - pinned
8
+ - security
9
+ # Label to use when marking an issue as stale
10
+ staleLabel: wontfix
11
+ # Comment to post when marking an issue as stale. Set to `false` to disable
12
+ markComment: >
13
+ This issue has been automatically marked as stale because it has not had
14
+ recent activity. It will be closed if no further activity occurs. Thank you
15
+ for your contributions.
16
+ # Comment to post when closing a stale issue. Set to `false` to disable
17
+ closeComment: false
@@ -1,75 +1,75 @@
1
- name: CD
2
-
3
- on:
4
- push:
5
- branches: [ main, develop ]
6
-
7
- jobs:
8
- test:
9
- runs-on: ubuntu-latest
10
- steps:
11
- - name: Checkout repository
12
- uses: actions/checkout@v2.3.4
13
-
14
- - name: Set up Node.js
15
- uses: actions/setup-node@v2.4.1
16
- with:
17
- node-version: 16
18
-
19
- - name: Install Dependencies
20
- run: yarn
21
-
22
- - name: Run Lint
23
- run: yarn lint
24
-
25
- - name: Build module
26
- run: yarn build
27
-
28
- - name: Run Test code
29
- run: yarn test
30
-
31
- # ↓↓↓↓ Please edit below according your environment ↓↓↓↓
32
- # deploy:
33
- # runs-on: ubuntu-latest
34
- # needs: test
35
- # steps:
36
- # - name: Checkout repository
37
- # uses: actions/checkout@v2.3.4
38
-
39
- # - name: Deploy DEVELOPMENT
40
- # uses: appleboy/ssh-action@v0.1.4
41
- # if: github.ref == 'refs/heads/develop'
42
- # with:
43
- # key: ${{ secrets.DEV_PEM_KEY }}
44
- # host: ${{ secrets.DEV_HOST }}
45
- # username: ubuntu
46
- # script: |
47
- # cd /home/ubuntu/source
48
- # git checkout develop
49
- # git fetch --all
50
- # git reset --hard origin/develop
51
- # git pull origin develop
52
- # yarn
53
- # yarn build
54
- # export NODE_ENV=development && pm2 startOrReload ecosystem.config.js
55
- # pm2 set pm2:autodump true
56
- # pm2 save
57
-
58
- # - name: Deploy PRODUCTION
59
- # uses: appleboy/ssh-action@v0.1.4
60
- # if: github.ref == 'refs/heads/main'
61
- # with:
62
- # key: ${{ secrets.PROD_PEM_KEY }}
63
- # host: ${{ secrets.PROD_HOST }}
64
- # username: ubuntu
65
- # script: |
66
- # cd /home/ubuntu/source
67
- # git checkout main
68
- # git fetch --all
69
- # git reset --hard origin/main
70
- # git pull origin main
71
- # yarn
72
- # yarn build
73
- # export NODE_ENV=production && pm2 startOrReload ecosystem.config.js
74
- # pm2 set pm2:autodump true
75
- # pm2 save
1
+ name: CD
2
+
3
+ on:
4
+ push:
5
+ branches: [ main, develop ]
6
+
7
+ jobs:
8
+ test:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - name: Checkout repository
12
+ uses: actions/checkout@v2.3.4
13
+
14
+ - name: Set up Node.js
15
+ uses: actions/setup-node@v2.4.1
16
+ with:
17
+ node-version: 16
18
+
19
+ - name: Install Dependencies
20
+ run: yarn
21
+
22
+ - name: Run Lint
23
+ run: yarn lint
24
+
25
+ - name: Build module
26
+ run: yarn build
27
+
28
+ - name: Run Test code
29
+ run: yarn test
30
+
31
+ # ↓↓↓↓ Please edit below according your environment ↓↓↓↓
32
+ # deploy:
33
+ # runs-on: ubuntu-latest
34
+ # needs: test
35
+ # steps:
36
+ # - name: Checkout repository
37
+ # uses: actions/checkout@v2.3.4
38
+
39
+ # - name: Deploy DEVELOPMENT
40
+ # uses: appleboy/ssh-action@v0.1.4
41
+ # if: github.ref == 'refs/heads/develop'
42
+ # with:
43
+ # key: ${{ secrets.DEV_PEM_KEY }}
44
+ # host: ${{ secrets.DEV_HOST }}
45
+ # username: ubuntu
46
+ # script: |
47
+ # cd /home/ubuntu/source
48
+ # git checkout develop
49
+ # git fetch --all
50
+ # git reset --hard origin/develop
51
+ # git pull origin develop
52
+ # yarn
53
+ # yarn build
54
+ # export NODE_ENV=development && pm2 startOrReload ecosystem.config.js
55
+ # pm2 set pm2:autodump true
56
+ # pm2 save
57
+
58
+ # - name: Deploy PRODUCTION
59
+ # uses: appleboy/ssh-action@v0.1.4
60
+ # if: github.ref == 'refs/heads/main'
61
+ # with:
62
+ # key: ${{ secrets.PROD_PEM_KEY }}
63
+ # host: ${{ secrets.PROD_HOST }}
64
+ # username: ubuntu
65
+ # script: |
66
+ # cd /home/ubuntu/source
67
+ # git checkout main
68
+ # git fetch --all
69
+ # git reset --hard origin/main
70
+ # git pull origin main
71
+ # yarn
72
+ # yarn build
73
+ # export NODE_ENV=production && pm2 startOrReload ecosystem.config.js
74
+ # pm2 set pm2:autodump true
75
+ # pm2 save
@@ -1,36 +1,36 @@
1
- name: CI
2
-
3
- on:
4
- pull_request:
5
- types: [ opened, synchronize, reopened ]
6
-
7
- jobs:
8
- test:
9
- runs-on: ubuntu-latest
10
-
11
- strategy:
12
- matrix:
13
- node-version: [ '16' ]
14
-
15
- steps:
16
- - name: Checkout repository
17
- uses: actions/checkout@v2.3.4
18
-
19
- - name: Set up Node.js ${{ matrix.node-version }}
20
- uses: actions/setup-node@v2.4.1
21
- with:
22
- node-version: ${{ matrix.node-version }}
23
-
24
- - name: Install Dependencies
25
- run: yarn
26
-
27
- - name: Run Lint
28
- run: yarn lint
29
-
30
- - name: Run Test code
31
- run: yarn test
32
-
33
- - name: Build module
34
- run: yarn build
35
-
36
-
1
+ name: CI
2
+
3
+ on:
4
+ pull_request:
5
+ types: [ opened, synchronize, reopened ]
6
+
7
+ jobs:
8
+ test:
9
+ runs-on: ubuntu-latest
10
+
11
+ strategy:
12
+ matrix:
13
+ node-version: [ '16' ]
14
+
15
+ steps:
16
+ - name: Checkout repository
17
+ uses: actions/checkout@v2.3.4
18
+
19
+ - name: Set up Node.js ${{ matrix.node-version }}
20
+ uses: actions/setup-node@v2.4.1
21
+ with:
22
+ node-version: ${{ matrix.node-version }}
23
+
24
+ - name: Install Dependencies
25
+ run: yarn
26
+
27
+ - name: Run Lint
28
+ run: yarn lint
29
+
30
+ - name: Run Test code
31
+ run: yarn test
32
+
33
+ - name: Build module
34
+ run: yarn build
35
+
36
+
package/.husky/pre-commit CHANGED
@@ -1,6 +1,6 @@
1
- #!/bin/sh
2
- . "$(dirname "$0")/_/husky.sh"
3
-
4
- yarn prettify
5
- yarn lint:fix
6
- git add
1
+ #!/bin/sh
2
+ . "$(dirname "$0")/_/husky.sh"
3
+
4
+ yarn prettify
5
+ yarn lint:fix
6
+ git add
package/.husky/pre-push CHANGED
@@ -1,4 +1,4 @@
1
- #!/bin/sh
2
- . "$(dirname "$0")/_/husky.sh"
3
-
4
- yarn build
1
+ #!/bin/sh
2
+ . "$(dirname "$0")/_/husky.sh"
3
+
4
+ yarn build
@@ -1,7 +1,7 @@
1
- <component name="InspectionProjectProfileManager">
2
- <profile version="1.0">
3
- <option name="myName" value="Project Default" />
4
- <inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
5
- <inspection_tool class="TsLint" enabled="true" level="WARNING" enabled_by_default="true" />
6
- </profile>
1
+ <component name="InspectionProjectProfileManager">
2
+ <profile version="1.0">
3
+ <option name="myName" value="Project Default" />
4
+ <inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
5
+ <inspection_tool class="TsLint" enabled="true" level="WARNING" enabled_by_default="true" />
6
+ </profile>
7
7
  </component>
package/.prettierrc CHANGED
@@ -1,8 +1,8 @@
1
- {
2
- "parser": "typescript",
3
- "semi": true,
4
- "singleQuote": false,
5
- "tabWidth": 2,
6
- "trailingComma": "all",
7
- "printWidth": 80
8
- }
1
+ {
2
+ "parser": "typescript",
3
+ "semi": true,
4
+ "singleQuote": false,
5
+ "tabWidth": 2,
6
+ "trailingComma": "all",
7
+ "printWidth": 80
8
+ }
@@ -1,3 +1,3 @@
1
- {
2
- "editor.stickyScroll.enabled": true
3
- }
1
+ {
2
+ "editor.stickyScroll.enabled": true
3
+ }
package/LICENSE CHANGED
@@ -1,18 +1,18 @@
1
- Copyright (c) 2021, Filoscoder
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining a copy of
4
- this software and associated documentation files (the "Software"), to deal in
5
- the Software without restriction, including without limitation the rights to
6
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
7
- the Software, and to permit persons to whom the Software is furnished to do so,
8
- subject to the following conditions:
9
-
10
- The above copyright notice and this permission notice shall be included in all
11
- copies or substantial portions of the Software.
12
-
13
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15
- FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16
- COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17
- IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
1
+ Copyright (c) 2021, Filoscoder
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
4
+ this software and associated documentation files (the "Software"), to deal in
5
+ the Software without restriction, including without limitation the rights to
6
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
7
+ the Software, and to permit persons to whom the Software is furnished to do so,
8
+ subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18
18
  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,5 +1,5 @@
1
1
  {
2
- "base_path": "E:\\临时\\web打印\\pdfs",
2
+ "base_path": "C:\\page2pdf-server\\pdfs",
3
3
  "default_file": "合并后的文档",
4
4
  "server_port": 9389,
5
5
  "chrome_port": 9872,
@@ -1,41 +1,41 @@
1
- module.exports = {
2
- apps: [
3
- {
4
- name: '<app-name>',
5
- script: 'dist/src/index.js',
6
- // Options reference: https://pm2.keymetrics.io/docs/usage/application-declaration/
7
- exec_mode: 'cluster',
8
- instances: 2,
9
- kill_timeout: 5000,
10
- autorestart: true,
11
- max_restarts: 10,
12
- watch: true,
13
- watch_options: {
14
- followSymlinks: false,
15
- },
16
- max_memory_restart: '1G',
17
- env: {
18
- NODE_ENV: 'development',
19
- },
20
- env_production: {
21
- NODE_ENV: 'production',
22
- port: 8080,
23
- },
24
- merge_logs: true,
25
- log_date_format: 'YYYY-MM-DDTHH:mm:ss.sssZ',
26
- },
27
- ],
28
- // https://pm2.keymetrics.io/docs/usage/deployment/
29
- deploy: {
30
- production: {
31
- key: process.env.EC2_PEM_PATH,
32
- host: process.env.EC2_HOST,
33
- user: 'ubuntu',
34
- ref: 'origin/main',
35
- repo: 'git@github.com:<username>/<repo-name>.git',
36
- path: '/home/ubuntu',
37
- 'post-deploy':
38
- 'yarn && yarn clean && yarn build && pm2 startOrRestart ecosystem.config.js --env production && pm2 set pm2:autodump true && pm2 save',
39
- },
40
- },
41
- };
1
+ module.exports = {
2
+ apps: [
3
+ {
4
+ name: '<app-name>',
5
+ script: 'dist/src/index.js',
6
+ // Options reference: https://pm2.keymetrics.io/docs/usage/application-declaration/
7
+ exec_mode: 'cluster',
8
+ instances: 2,
9
+ kill_timeout: 5000,
10
+ autorestart: true,
11
+ max_restarts: 10,
12
+ watch: true,
13
+ watch_options: {
14
+ followSymlinks: false,
15
+ },
16
+ max_memory_restart: '1G',
17
+ env: {
18
+ NODE_ENV: 'development',
19
+ },
20
+ env_production: {
21
+ NODE_ENV: 'production',
22
+ port: 8080,
23
+ },
24
+ merge_logs: true,
25
+ log_date_format: 'YYYY-MM-DDTHH:mm:ss.sssZ',
26
+ },
27
+ ],
28
+ // https://pm2.keymetrics.io/docs/usage/deployment/
29
+ deploy: {
30
+ production: {
31
+ key: process.env.EC2_PEM_PATH,
32
+ host: process.env.EC2_HOST,
33
+ user: 'ubuntu',
34
+ ref: 'origin/main',
35
+ repo: 'git@github.com:<username>/<repo-name>.git',
36
+ path: '/home/ubuntu',
37
+ 'post-deploy':
38
+ 'yarn && yarn clean && yarn build && pm2 startOrRestart ecosystem.config.js --env production && pm2 set pm2:autodump true && pm2 save',
39
+ },
40
+ },
41
+ };
package/jest.config.js CHANGED
@@ -1,35 +1,35 @@
1
- const { defaults: tsjPreset } = require("ts-jest/presets");
2
-
3
- module.exports = {
4
- preset: "ts-jest",
5
- moduleFileExtensions: ["ts", "js", "json"],
6
- transform: {
7
- "^.+\\.(ts|tsx)$": [
8
- "ts-jest",
9
- {
10
- tsconfig: "tsconfig.json",
11
- diagnostics: false,
12
- },
13
- ],
14
- ...tsjPreset.transform,
15
- },
16
- testPathIgnorePatterns: ["dist"],
17
- testMatch: ["**/__tests__/**/*.test.(ts|js)"],
18
- testEnvironment: "node",
19
- moduleNameMapper: {
20
- "@/(.*)": "<rootDir>/src/$1",
21
- },
22
- watchPlugins: [
23
- "jest-watch-typeahead/filename",
24
- "jest-watch-typeahead/testname",
25
- ],
26
- coverageThreshold: {
27
- global: {
28
- branches: 1,
29
- functions: 1,
30
- lines: 1,
31
- statements: 1,
32
- },
33
- },
34
- coverageReporters: ["json", "lcov", "text", "clover"],
35
- };
1
+ const { defaults: tsjPreset } = require("ts-jest/presets");
2
+
3
+ module.exports = {
4
+ preset: "ts-jest",
5
+ moduleFileExtensions: ["ts", "js", "json"],
6
+ transform: {
7
+ "^.+\\.(ts|tsx)$": [
8
+ "ts-jest",
9
+ {
10
+ tsconfig: "tsconfig.json",
11
+ diagnostics: false,
12
+ },
13
+ ],
14
+ ...tsjPreset.transform,
15
+ },
16
+ testPathIgnorePatterns: ["dist"],
17
+ testMatch: ["**/__tests__/**/*.test.(ts|js)"],
18
+ testEnvironment: "node",
19
+ moduleNameMapper: {
20
+ "@/(.*)": "<rootDir>/src/$1",
21
+ },
22
+ watchPlugins: [
23
+ "jest-watch-typeahead/filename",
24
+ "jest-watch-typeahead/testname",
25
+ ],
26
+ coverageThreshold: {
27
+ global: {
28
+ branches: 1,
29
+ functions: 1,
30
+ lines: 1,
31
+ statements: 1,
32
+ },
33
+ },
34
+ coverageReporters: ["json", "lcov", "text", "clover"],
35
+ };
package/nodemon.json CHANGED
@@ -1,6 +1,6 @@
1
- {
2
- "watch": ["src/**/*.ts", ".env"],
3
- "ext": "ts,js,.env",
4
- "verbose": false,
5
- "exec": "ts-node -r tsconfig-paths/register --files src/index.ts"
6
- }
1
+ {
2
+ "watch": ["src/**/*.ts", ".env"],
3
+ "ext": "ts,js,.env",
4
+ "verbose": false,
5
+ "exec": "ts-node -r tsconfig-paths/register --files src/index.ts"
6
+ }
package/package.json CHANGED
@@ -1,105 +1,104 @@
1
- {
2
- "name": "page2pdf_server",
3
- "version": "1.0.1",
4
- "description": "文书打印转换器",
5
- "private": false,
6
- "authors": "herzhang",
7
- "repository": "https://gitee.com/heerzhang/page2pdf-server",
8
- "license": "MIT",
9
- "scripts": {
10
- "yarn": "yarn",
11
- "yarn命令行": "yarn add nodemon -D",
12
- "注意2": "运行prettify来修复代码,免去到处是标记红色的,太严格了",
13
- "prettify": "prettier --write \"src/**/*.{ts,js,json}\" \"__tests__/**/*.{ts,js,json}\"",
14
- "start": "NODE_ENV=development run-s prettify lint & nodemon",
15
- "build": "cross-env NODE_ENV=production run-s prettify clean transpile",
16
- "lint": "eslint 'src/**/*.{ts,js}' '__tests__/**/*.{ts,js}'",
17
- "lint:fix": "eslint --fix 'src/**/*.{ts,js}' '__tests__/**/*.{ts,js}' --quiet",
18
- "有些隐藏错误": "需要运行watch才发现",
19
- "watch": "tsc --watch",
20
- "clean": "rimraf dist",
21
- "test": "cross-env NODE_ENV=test jest --coverage --runInBand --detectOpenHandles",
22
- "单步调试": "不必运行test,直接到__test__目录文件直接挑选修改测试项并调试",
23
- "test:watchAll": "cross-env NODE_ENV=test jest --watchAll --runInBand --detectOpenHandles",
24
- "transpile": "tsc",
25
- "service:start": "pm2 start ecosystem.config.js",
26
- "service:reload": "pm2 reload ecosystem.config.js",
27
- "service:startup": "pm2 startup",
28
- "service:stop": "pm2 stop ecosystem.config.js",
29
- "service:list": "pm2 list ecosystem.config.js",
30
- "service:delete": "pm2 delete ecosystem.config.js",
31
- "service:logs": "pm2 logs",
32
- "hook主动运行": "操作系统缘故,将单引号改成双引号,加转义符,提交代码会自动执行;git提交给它勾掉吧,yarn会自动运行prepare",
33
- "prepare": "husky install"
34
- },
35
- "keywords": [
36
- "dynamic page pdf generator",
37
- "html to pdf",
38
- "app url to pdf",
39
- "pdf generation",
40
- "node.js",
41
- "express",
42
- "print",
43
- "server"
44
- ],
45
- "dependencies": {
46
- "bcrypt": "^5.1.0",
47
- "chrome-remote-interface": "^0.32.2",
48
- "config": "^3.3.9",
49
- "connect-timeout": "^1.9.0",
50
- "cors": "^2.8.5",
51
- "cross-env": "^7.0.3",
52
- "dotenv": "^16.3.1",
53
- "express": "^4.18.2",
54
- "express-pino-logger": "^7.0.0",
55
- "express-validator": "^7.0.1",
56
- "helmet": "^7.0.0",
57
- "http-status": "^1.6.2",
58
- "jsonwebtoken": "^9.0.0",
59
- "lodash-es": "^4.17.21",
60
- "morgan": "^1.10.0",
61
- "pdf-lib": "^1.17.1",
62
- "pino-http": "^8.3.3",
63
- "pino-pretty": "^10.0.0",
64
- "rimraf": "^5.0.1",
65
- "save-dev": "^0.0.1-security"
66
- },
67
- "devDependencies": {
68
- "@babel/preset-env": "^7.22.5",
69
- "@babel/preset-typescript": "^7.22.5",
70
- "@types/bcrypt": "^5.0.0",
71
- "@types/connect-timeout": "^0.0.37",
72
- "@types/cors": "^2.8.13",
73
- "@types/express": "^4.17.17",
74
- "@types/express-pino-logger": "^4.0.3",
75
- "@types/jest": "^29.5.2",
76
- "@types/jsonwebtoken": "^9.0.2",
77
- "@types/lodash-es": "^4.17.7",
78
- "@types/module-alias": "^2.0.1",
79
- "@types/morgan": "^1.9.4",
80
- "@types/node": "^20.3.1",
81
- "@types/supertest": "^2.0.12",
82
- "@typescript-eslint/eslint-plugin": "^5.59.11",
83
- "@typescript-eslint/parser": "^5.59.11",
84
- "eslint": "^8.43.0",
85
- "eslint-config-prettier": "^8.8.0",
86
- "eslint-plugin-import": "^2.27.5",
87
- "eslint-plugin-prettier": "^4.2.1",
88
- "husky": "^8.0.3",
89
- "jest": "^29.5.0",
90
- "jest-watch-typeahead": "^2.2.2",
91
- "module-alias": "^2.2.3",
92
- "nodemon": "^3.0.1",
93
- "npm-run-all": "^4.1.5",
94
- "pm2": "^5.3.0",
95
- "prettier": "^2.8.8",
96
- "supertest": "^6.3.3",
97
- "ts-jest": "^29.1.0",
98
- "ts-node": "^10.9.1",
99
- "tsconfig-paths": "^4.2.0",
100
- "typescript": "^5.1.6"
101
- },
102
- "engines": {
103
- "node": ">= 18.0.0"
104
- }
105
- }
1
+ {
2
+ "name": "page2pdf_server",
3
+ "version": "1.0.2",
4
+ "description": "文书打印转换器",
5
+ "private": false,
6
+ "authors": "herzhang",
7
+ "repository": "https://gitee.com/heerzhang/page2pdf-server",
8
+ "license": "MIT",
9
+ "scripts": {
10
+ "yarn": "yarn",
11
+ "yarn命令行": "yarn add nodemon -D",
12
+ "注意2": "运行prettify来修复代码,免去到处是标记红色的,太严格了",
13
+ "prettify": "prettier --write \"src/**/*.{ts,js,json}\" \"__tests__/**/*.{ts,js,json}\"",
14
+ "start": "NODE_ENV=development run-s prettify lint & nodemon",
15
+ "build": "cross-env NODE_ENV=production run-s prettify clean transpile",
16
+ "lint": "eslint 'src/**/*.{ts,js}' '__tests__/**/*.{ts,js}'",
17
+ "lint:fix": "eslint --fix 'src/**/*.{ts,js}' '__tests__/**/*.{ts,js}' --quiet",
18
+ "有些隐藏错误": "需要运行watch才发现",
19
+ "watch": "tsc --watch",
20
+ "clean": "rimraf dist",
21
+ "test": "cross-env NODE_ENV=test jest --coverage --runInBand --detectOpenHandles",
22
+ "单步调试": "不必运行test,直接到__test__目录文件直接挑选修改测试项并调试",
23
+ "test:watchAll": "cross-env NODE_ENV=test jest --watchAll --runInBand --detectOpenHandles",
24
+ "transpile": "tsc",
25
+ "service:start": "pm2 start ecosystem.config.js",
26
+ "service:reload": "pm2 reload ecosystem.config.js",
27
+ "service:startup": "pm2 startup",
28
+ "service:stop": "pm2 stop ecosystem.config.js",
29
+ "service:list": "pm2 list ecosystem.config.js",
30
+ "service:delete": "pm2 delete ecosystem.config.js",
31
+ "service:logs": "pm2 logs",
32
+ "hook主动运行": "操作系统缘故,将单引号改成双引号,加转义符,提交代码会自动执行;git提交给它勾掉吧,yarn会自动运行prepare",
33
+ "prepare": "husky install"
34
+ },
35
+ "keywords": [
36
+ "dynamic page pdf generator",
37
+ "html to pdf",
38
+ "app url to pdf",
39
+ "pdf generation",
40
+ "node.js",
41
+ "express",
42
+ "print",
43
+ "server"
44
+ ],
45
+ "dependencies": {
46
+ "chrome-remote-interface": "^0.32.2",
47
+ "config": "^3.3.9",
48
+ "connect-timeout": "^1.9.0",
49
+ "cors": "^2.8.5",
50
+ "cross-env": "^7.0.3",
51
+ "dotenv": "^16.3.1",
52
+ "express": "^4.18.2",
53
+ "express-pino-logger": "^7.0.0",
54
+ "express-validator": "^7.0.1",
55
+ "helmet": "^7.0.0",
56
+ "http-status": "^1.6.2",
57
+ "jsonwebtoken": "^9.0.0",
58
+ "lodash-es": "^4.17.21",
59
+ "morgan": "^1.10.0",
60
+ "pdf-lib": "^1.17.1",
61
+ "pino-http": "^8.3.3",
62
+ "pino-pretty": "^10.0.0",
63
+ "rimraf": "^5.0.1",
64
+ "save-dev": "^0.0.1-security"
65
+ },
66
+ "devDependencies": {
67
+ "@babel/preset-env": "^7.22.5",
68
+ "@babel/preset-typescript": "^7.22.5",
69
+ "@types/bcrypt": "^5.0.0",
70
+ "@types/connect-timeout": "^0.0.37",
71
+ "@types/cors": "^2.8.13",
72
+ "@types/express": "^4.17.17",
73
+ "@types/express-pino-logger": "^4.0.3",
74
+ "@types/jest": "^29.5.2",
75
+ "@types/jsonwebtoken": "^9.0.2",
76
+ "@types/lodash-es": "^4.17.7",
77
+ "@types/module-alias": "^2.0.1",
78
+ "@types/morgan": "^1.9.4",
79
+ "@types/node": "^20.3.1",
80
+ "@types/supertest": "^2.0.12",
81
+ "@typescript-eslint/eslint-plugin": "^5.59.11",
82
+ "@typescript-eslint/parser": "^5.59.11",
83
+ "eslint": "^8.43.0",
84
+ "eslint-config-prettier": "^8.8.0",
85
+ "eslint-plugin-import": "^2.27.5",
86
+ "eslint-plugin-prettier": "^4.2.1",
87
+ "husky": "^8.0.3",
88
+ "jest": "^29.5.0",
89
+ "jest-watch-typeahead": "^2.2.2",
90
+ "module-alias": "^2.2.3",
91
+ "nodemon": "^3.0.1",
92
+ "npm-run-all": "^4.1.5",
93
+ "pm2": "^5.3.0",
94
+ "prettier": "^2.8.8",
95
+ "supertest": "^6.3.3",
96
+ "ts-jest": "^29.1.0",
97
+ "ts-node": "^10.9.1",
98
+ "tsconfig-paths": "^4.2.0",
99
+ "typescript": "^5.1.6"
100
+ },
101
+ "engines": {
102
+ "node": ">= 18.0.0"
103
+ }
104
+ }
@@ -1,16 +1,15 @@
1
- import bcrypt from "bcrypt";
2
- import CONFIG from "@/configEnv";
1
+ // import bcrypt from "bcrypt";
3
2
 
4
3
  /**
5
4
  * @description Create a bcrypt hash for a string.
6
5
  * @param {string} value
7
6
  * @returns {Promise<any>}
8
7
  */
9
- export const hash = async (value: string): Promise<any> => {
10
- const saltRounds = parseInt(CONFIG.AUTH.SALT_ROUNDS, 10);
11
-
12
- return bcrypt.hash(value, saltRounds);
13
- };
8
+ // export const hash = async (value: string): Promise<any> => {
9
+ // const saltRounds = parseInt(CONFIG.AUTH.SALT_ROUNDS, 10);
10
+ //
11
+ // return bcrypt.hash(value, saltRounds);
12
+ // };
14
13
 
15
14
  /**
16
15
  * @description Compare a string with the hash.
@@ -18,9 +17,9 @@ export const hash = async (value: string): Promise<any> => {
18
17
  * @param {string} hashedValue
19
18
  * @returns {Promise<boolean>}
20
19
  */
21
- export const compare = async (
22
- value: string,
23
- hashedValue: string,
24
- ): Promise<boolean> => {
25
- return bcrypt.compare(value, hashedValue);
26
- };
20
+ // export const compare = async (
21
+ // value: string,
22
+ // hashedValue: string,
23
+ // ): Promise<boolean> => {
24
+ // return bcrypt.compare(value, hashedValue);
25
+ // };
@@ -239,4 +239,6 @@ package.json:: start 又能使用单步调试模式运行了,奇怪,为何
239
239
  "canAccessOpener": false,
240
240
  "browserContextId": "6462BDF4C120FD15A2C462621D55535F"
241
241
  }
242
- BD1CE5AD1D724197A177AC4E50DDB4A6
242
+ BD1CE5AD1D724197A177AC4E50DDB4A6
243
+
244
+ 去掉bcrypt包 @mapbox/node-pre-gyp node-gyp 依賴python啊
package/tsconfig.json CHANGED
@@ -1,41 +1,41 @@
1
- {
2
- "compilerOptions": {
3
- /* Basic Options */
4
- "incremental": true,
5
- "target": "ESNext",
6
- "module": "commonjs",
7
- "outDir": "dist",
8
- "pretty": true,
9
- "removeComments": true,
10
-
11
- /* Strict Type-Checking Options */
12
- "strict": true,
13
- "noImplicitAny": true,
14
- "strictNullChecks": true,
15
- "strictFunctionTypes": true,
16
- "strictBindCallApply": true,
17
- "strictPropertyInitialization": true,
18
- "noImplicitThis": false,
19
- "alwaysStrict": true,
20
-
21
- /* Additional Checks */
22
- "noUnusedLocals": true,
23
- "noUnusedParameters": true,
24
- "noImplicitReturns": true,
25
- "noFallthroughCasesInSwitch": true,
26
-
27
- /* Module Resolution Options */
28
- "moduleResolution": "node",
29
- "esModuleInterop": true,
30
- "resolveJsonModule": true,
31
- "sourceMap": true,
32
- "forceConsistentCasingInFileNames": true,
33
- "types": ["jest", "node"],
34
- "baseUrl": "src",
35
- "paths": {
36
- "@/*": ["./*"]
37
- },
38
- },
39
- "include": ["src/**/*", "**/__tests__/**/*"],
40
- "exclude": ["node_modules"]
41
- }
1
+ {
2
+ "compilerOptions": {
3
+ /* Basic Options */
4
+ "incremental": true,
5
+ "target": "ESNext",
6
+ "module": "commonjs",
7
+ "outDir": "dist",
8
+ "pretty": true,
9
+ "removeComments": true,
10
+
11
+ /* Strict Type-Checking Options */
12
+ "strict": true,
13
+ "noImplicitAny": true,
14
+ "strictNullChecks": true,
15
+ "strictFunctionTypes": true,
16
+ "strictBindCallApply": true,
17
+ "strictPropertyInitialization": true,
18
+ "noImplicitThis": false,
19
+ "alwaysStrict": true,
20
+
21
+ /* Additional Checks */
22
+ "noUnusedLocals": true,
23
+ "noUnusedParameters": true,
24
+ "noImplicitReturns": true,
25
+ "noFallthroughCasesInSwitch": true,
26
+
27
+ /* Module Resolution Options */
28
+ "moduleResolution": "node",
29
+ "esModuleInterop": true,
30
+ "resolveJsonModule": true,
31
+ "sourceMap": true,
32
+ "forceConsistentCasingInFileNames": true,
33
+ "types": ["jest", "node"],
34
+ "baseUrl": "src",
35
+ "paths": {
36
+ "@/*": ["./*"]
37
+ },
38
+ },
39
+ "include": ["src/**/*", "**/__tests__/**/*"],
40
+ "exclude": ["node_modules"]
41
+ }
package/tslint.json CHANGED
@@ -1,22 +1,22 @@
1
- {
2
- "defaultSeverity": "error",
3
- "extends": ["tslint:recommended"],
4
- "jsRules": {
5
- "object-literal-sort-keys": false
6
- },
7
- "rules": {
8
- "ordered-imports": false,
9
- "object-literal-sort-keys": false,
10
- "quotemark": [true, "single"],
11
- "trailing-comma": [
12
- true,
13
- {
14
- "multiline": "never",
15
- "singleline": "never"
16
- }
17
- ],
18
- "arrow-parens": [true, "ban-single-arg-parens"],
19
- "interface-name": [true, "never-prefix"]
20
- },
21
- "rulesDirectory": []
22
- }
1
+ {
2
+ "defaultSeverity": "error",
3
+ "extends": ["tslint:recommended"],
4
+ "jsRules": {
5
+ "object-literal-sort-keys": false
6
+ },
7
+ "rules": {
8
+ "ordered-imports": false,
9
+ "object-literal-sort-keys": false,
10
+ "quotemark": [true, "single"],
11
+ "trailing-comma": [
12
+ true,
13
+ {
14
+ "multiline": "never",
15
+ "singleline": "never"
16
+ }
17
+ ],
18
+ "arrow-parens": [true, "ban-single-arg-parens"],
19
+ "interface-name": [true, "never-prefix"]
20
+ },
21
+ "rulesDirectory": []
22
+ }