Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
pagedjs-cli
Manage
Activity
Members
Labels
Plan
Issues
62
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pagedjs
pagedjs-cli
Commits
79227e1c
Commit
79227e1c
authored
3 years ago
by
Fred Chasen
Browse files
Options
Downloads
Plain Diff
Merge branch 'stavnycha/pagedjs-cli-master'
parents
f6b3b46a
ee732289
No related branches found
No related tags found
No related merge requests found
Pipeline
#30167
passed with stages
in 1 minute and 16 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
bin/paged
+2
-1
2 additions, 1 deletion
bin/paged
src/printer.js
+11
-6
11 additions, 6 deletions
src/printer.js
with
13 additions
and
7 deletions
bin/paged
+
2
−
1
View file @
79227e1c
...
@@ -39,7 +39,7 @@ program
...
@@ -39,7 +39,7 @@ program
"
added to the HTML document before rendering. This is useful for
"
+
"
added to the HTML document before rendering. This is useful for
"
+
"
adding custom pagedjs handlers. The option can be repeated.
"
,
"
adding custom pagedjs handlers. The option can be repeated.
"
,
collect
,
[])
collect
,
[])
.
option
(
"
--browserEndpoint
"
,
"
Use a remote Chrome server with browserWSEndpoint
"
)
.
option
(
"
--browserEndpoint
<browserEndpoint>
"
,
"
Use a remote Chrome server with browserWSEndpoint
"
)
.
parse
(
process
.
argv
);
.
parse
(
process
.
argv
);
function
collect
(
value
,
previous
)
{
function
collect
(
value
,
previous
)
{
...
@@ -115,6 +115,7 @@ if (typeof input === "string") {
...
@@ -115,6 +115,7 @@ if (typeof input === "string") {
allowedPaths
:
program
.
allowedPaths
,
allowedPaths
:
program
.
allowedPaths
,
allowedDomains
:
program
.
allowedDomains
,
allowedDomains
:
program
.
allowedDomains
,
additionalScripts
:
program
.
additionalScript
,
additionalScripts
:
program
.
additionalScript
,
browserEndpoint
:
program
.
browserEndpoint
,
timeout
:
program
.
timeout
,
timeout
:
program
.
timeout
,
};
};
...
...
This diff is collapsed.
Click to expand it.
src/printer.js
+
11
−
6
View file @
79227e1c
...
@@ -3,6 +3,7 @@ const puppeteer = require("puppeteer");
...
@@ -3,6 +3,7 @@ const puppeteer = require("puppeteer");
const
fetch
=
require
(
"
node-fetch
"
);
const
fetch
=
require
(
"
node-fetch
"
);
const
path
=
require
(
"
path
"
);
const
path
=
require
(
"
path
"
);
const
fs
=
require
(
"
fs
"
);
let
dir
=
process
.
cwd
();
let
dir
=
process
.
cwd
();
...
@@ -44,13 +45,12 @@ class Printer extends EventEmitter {
...
@@ -44,13 +45,12 @@ class Printer extends EventEmitter {
if
(
this
.
browserWSEndpoint
)
{
if
(
this
.
browserWSEndpoint
)
{
puppeteerOptions
.
browserWSEndpoint
=
this
.
browserWSEndpoint
;
puppeteerOptions
.
browserWSEndpoint
=
this
.
browserWSEndpoint
;
this
.
browser
=
await
puppeteer
.
connect
(
puppeteerOptions
);
}
else
{
this
.
browser
=
await
puppeteer
.
launch
(
puppeteerOptions
);
}
}
const
browser
=
await
puppeteer
.
launch
(
puppeteerOptions
);
return
this
.
browser
;
this
.
browser
=
browser
;
return
browser
;
}
}
async
render
(
input
)
{
async
render
(
input
)
{
...
@@ -79,7 +79,12 @@ class Printer extends EventEmitter {
...
@@ -79,7 +79,12 @@ class Printer extends EventEmitter {
url
=
input
;
url
=
input
;
}
catch
(
error
)
{
}
catch
(
error
)
{
relativePath
=
path
.
resolve
(
dir
,
input
);
relativePath
=
path
.
resolve
(
dir
,
input
);
url
=
"
file://
"
+
relativePath
;
if
(
this
.
browserWSEndpoint
)
{
html
=
fs
.
readFileSync
(
relativePath
,
'
utf-8
'
)
}
else
{
url
=
"
file://
"
+
relativePath
;
}
}
}
}
else
{
}
else
{
url
=
input
.
url
;
url
=
input
.
url
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment