Skip to content

Commit

Permalink
copying assets and styles
Browse files Browse the repository at this point in the history
  • Loading branch information
Panduss committed Feb 8, 2023
1 parent c8a07f4 commit 7fc6616
Show file tree
Hide file tree
Showing 23 changed files with 73 additions and 19 deletions.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
18 changes: 9 additions & 9 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -116180,14 +116180,14 @@ async function generatePdf() {
shortVersion: await getVersion('short'),
releaseDate: await getCurrentDate(),
previousFiles: mapped,
manufacturer: readFileSync('../assets/manufacturer.png').toString('base64'),
dateManufacturer: readFileSync('../assets/dateManufacturer.png').toString('base64'),
ref: readFileSync('../assets/ref.png').toString('base64'),
lot: readFileSync('../assets/lot.png').toString('base64'),
udi: readFileSync('../assets/udi.png').toString('base64'),
ukca: readFileSync('../assets/ukca.png').toString('base64'),
caution: readFileSync('../assets/caution.png').toString('base64'),
eifu: readFileSync('../assets/eifu.png').toString('base64')
manufacturer: readFileSync('assets/manufacturer.png').toString('base64'),
dateManufacturer: readFileSync('assets/dateManufacturer.png').toString('base64'),
ref: readFileSync('assets/ref.png').toString('base64'),
lot: readFileSync('assets/lot.png').toString('base64'),
udi: readFileSync('assets/udi.png').toString('base64'),
ukca: readFileSync('assets/ukca.png').toString('base64'),
caution: readFileSync('assets/caution.png').toString('base64'),
eifu: readFileSync('assets/eifu.png').toString('base64')
});

/**
Expand All @@ -116197,7 +116197,7 @@ async function generatePdf() {
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.setContent(html, {waitUntil: ['load', 'domcontentloaded', 'networkidle0']})
await page.addStyleTag({path: '../styles/pdf.css'});
await page.addStyleTag({path: './styles/pdf.css'});
const pdf = await page.pdf({
format: 'A4',
printBackground: true,
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "publish-pdf-version-action",
"main": "src/index.js",
"scripts": {
"build": "ncc build src/"
"build": "ncc build src/index.js && npx cpx \"src/**/*.{png,css}\" dist"
},
"repository": {
"type": "git",
Expand Down
Binary file added src/assets/caution.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/dateManufacturer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/eifu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/lot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/manufacturer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/ref.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/udi.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/ukca.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 9 additions & 9 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,14 +158,14 @@ async function generatePdf() {
shortVersion: await getVersion('short'),
releaseDate: await getCurrentDate(),
previousFiles: mapped,
manufacturer: readFileSync('../assets/manufacturer.png').toString('base64'),
dateManufacturer: readFileSync('../assets/dateManufacturer.png').toString('base64'),
ref: readFileSync('../assets/ref.png').toString('base64'),
lot: readFileSync('../assets/lot.png').toString('base64'),
udi: readFileSync('../assets/udi.png').toString('base64'),
ukca: readFileSync('../assets/ukca.png').toString('base64'),
caution: readFileSync('../assets/caution.png').toString('base64'),
eifu: readFileSync('../assets/eifu.png').toString('base64')
manufacturer: readFileSync('assets/manufacturer.png').toString('base64'),
dateManufacturer: readFileSync('assets/dateManufacturer.png').toString('base64'),
ref: readFileSync('assets/ref.png').toString('base64'),
lot: readFileSync('assets/lot.png').toString('base64'),
udi: readFileSync('assets/udi.png').toString('base64'),
ukca: readFileSync('assets/ukca.png').toString('base64'),
caution: readFileSync('assets/caution.png').toString('base64'),
eifu: readFileSync('assets/eifu.png').toString('base64')
});

/**
Expand All @@ -175,7 +175,7 @@ async function generatePdf() {
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.setContent(html, {waitUntil: ['load', 'domcontentloaded', 'networkidle0']})
await page.addStyleTag({path: '../styles/pdf.css'});
await page.addStyleTag({path: './styles/pdf.css'});
const pdf = await page.pdf({
format: 'A4',
printBackground: true,
Expand Down
54 changes: 54 additions & 0 deletions src/styles/pdf.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
body {
font-family: "Helvetica Neue", sans-serif;
padding: 20px;
}

h1 {
font-weight: 400;
}

table {
font-family: "Helvetica Neue", sans-serif;
border-collapse: collapse;
}

td, th {
border: 2px solid black;
text-align: left;
}

th {
background: #FF7B99;
color: white;
font-weight: normal;
padding: 10px;
}

h1 {
margin-top: 0;
}

td {
padding: 8px;
}

.paragraph {
margin: 30px 0 20px;
}

.box {
padding: 10px 0 0 0;
}

.label-container {
display: flex;
flex-direction: row;
align-items: center;
margin: 20px 20px 0 0;
}

img {
width: 50px;
height: 50px;
margin: 0 20px 0 0;
}

0 comments on commit 7fc6616

Please sign in to comment.