-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from devtobi/26-add-initial-vue-based-wrapper-…
…application 26 add initial vue based wrapper application
- Loading branch information
Showing
43 changed files
with
728 additions
and
149 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"$schema": "https://json.schemastore.org/prettierrc", | ||
"semi": false, | ||
"tabWidth": 2, | ||
"singleQuote": true, | ||
"printWidth": 100, | ||
"trailingComma": "none" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"recommendations": [ | ||
"Vue.volar", | ||
"dbaeumer.vscode-eslint", | ||
"esbenp.prettier-vscode" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"editor.codeActionsOnSave": { | ||
"source.fixAll": "explicit" | ||
}, | ||
"editor.formatOnSave": true, | ||
"editor.defaultFormatter": "esbenp.prettier-vscode" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
import eslintConfigPrettier from "eslint-config-prettier"; | ||
import js from "@eslint/js"; | ||
import globals from "globals"; | ||
import eslintConfigPrettier from 'eslint-config-prettier' | ||
import js from '@eslint/js' | ||
import globals from 'globals' | ||
|
||
export default [ | ||
js.configs.recommended, | ||
eslintConfigPrettier, | ||
{ | ||
languageOptions: { | ||
sourceType: "commonjs", | ||
sourceType: 'commonjs', | ||
globals: { | ||
...globals.node, | ||
}, | ||
...globals.node | ||
} | ||
}, | ||
ignores: ["node_modules", "eslint.config.mjs"], | ||
}, | ||
]; | ||
ignores: ['node_modules', 'eslint.config.mjs'] | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
const createDirectories = require("./helpers/createDirectories.js"); | ||
const execConcurrently = require("./helpers/execConcurrently.js"); | ||
const generateTasks = require("./helpers/generateTasks.js"); | ||
const { DATA_DIRECTORY, DIST_DIRECTORY } = require("./helpers/constants.js"); | ||
const createDirectories = require('./helpers/createDirectories.js') | ||
const execConcurrently = require('./helpers/execConcurrently.js') | ||
const generateTasks = require('./helpers/generateTasks.js') | ||
const { DATA_DIRECTORY, DIST_DIRECTORY } = require('./helpers/constants.js') | ||
|
||
const BUILD_CMD = `resumed render ${DATA_DIRECTORY}/%s.json -o ${DIST_DIRECTORY}/%s/index.html -t $THEME`; | ||
const BUILD_CMD = `resumed render ${DATA_DIRECTORY}/%s.json -o ${DIST_DIRECTORY}/%s/index.html -t $THEME` | ||
|
||
createDirectories(); | ||
const buildTasks = generateTasks("build-html", BUILD_CMD); | ||
execConcurrently(buildTasks); | ||
createDirectories() | ||
const buildTasks = generateTasks('build-html', BUILD_CMD) | ||
execConcurrently(buildTasks) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
const execConcurrently = require("./helpers/execConcurrently.js"); | ||
const generateTasks = require("./helpers/generateTasks.js"); | ||
const { DIST_DIRECTORY } = require("./helpers/constants.js"); | ||
const execConcurrently = require('./helpers/execConcurrently.js') | ||
const generateTasks = require('./helpers/generateTasks.js') | ||
const { DIST_DIRECTORY } = require('./helpers/constants.js') | ||
|
||
const GENERATE_PDF_CMD = `node scripts/helpers/generatePdf.js --input ${DIST_DIRECTORY}/%s/index.html --output ${DIST_DIRECTORY}/%s/cv.pdf`; | ||
const GENERATE_PDF_CMD = `node scripts/helpers/generatePdf.js --input ${DIST_DIRECTORY}/%s/index.html --output ${DIST_DIRECTORY}/%s/cv.pdf` | ||
|
||
const generatePdfTasks = generateTasks("build-pdf", GENERATE_PDF_CMD); | ||
execConcurrently(generatePdfTasks); | ||
const generatePdfTasks = generateTasks('build-pdf', GENERATE_PDF_CMD) | ||
execConcurrently(generatePdfTasks) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
const DATA_DIRECTORY = "../../data"; | ||
const DIST_DIRECTORY = "dist"; | ||
const DATA_DIRECTORY = '../../data' | ||
const DIST_DIRECTORY = 'dist' | ||
|
||
module.exports = { | ||
DATA_DIRECTORY, | ||
DIST_DIRECTORY, | ||
}; | ||
DIST_DIRECTORY | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
const path = require("path"); | ||
const fs = require("fs"); | ||
const getFiles = require("./getFiles.js"); | ||
const { DATA_DIRECTORY, DIST_DIRECTORY } = require("./constants.js"); | ||
const path = require('path') | ||
const fs = require('fs') | ||
const getFiles = require('./getFiles.js') | ||
const { DATA_DIRECTORY, DIST_DIRECTORY } = require('./constants.js') | ||
|
||
const createDirectories = () => { | ||
const files = getFiles(DATA_DIRECTORY); | ||
const files = getFiles(DATA_DIRECTORY) | ||
files.forEach((file) => { | ||
const dirname = `${DIST_DIRECTORY}/${path.parse(file).name}`; | ||
const dirname = `${DIST_DIRECTORY}/${path.parse(file).name}` | ||
try { | ||
fs.mkdirSync(dirname, { recursive: true }); | ||
fs.mkdirSync(dirname, { recursive: true }) | ||
} catch (err) { | ||
console.error("Error creating directory:", err); | ||
console.error('Error creating directory:', err) | ||
} | ||
}); | ||
}; | ||
}) | ||
} | ||
|
||
module.exports = createDirectories; | ||
module.exports = createDirectories |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
const concurrently = require("concurrently"); | ||
const concurrently = require('concurrently') | ||
|
||
const returnStatusCode = (result) => { | ||
result.then( | ||
() => { | ||
process.exit(0); | ||
process.exit(0) | ||
}, | ||
() => { | ||
process.exit(1); | ||
}, | ||
); | ||
}; | ||
process.exit(1) | ||
} | ||
) | ||
} | ||
|
||
const execConcurrently = (taskList) => { | ||
const { result } = concurrently(taskList, { | ||
killOthers: ["failure"], | ||
}); | ||
returnStatusCode(result); | ||
}; | ||
killOthers: ['failure'] | ||
}) | ||
returnStatusCode(result) | ||
} | ||
|
||
module.exports = execConcurrently; | ||
module.exports = execConcurrently |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,42 @@ | ||
const puppeteer = require("puppeteer"); | ||
const path = require("path"); | ||
const args = require("minimist")(process.argv.slice(2)); | ||
const puppeteer = require('puppeteer') | ||
const path = require('path') | ||
const args = require('minimist')(process.argv.slice(2)) | ||
|
||
const INPUT_ARG = "input"; | ||
const OUTPUT_ARG = "output"; | ||
const INPUT_ARG = 'input' | ||
const OUTPUT_ARG = 'output' | ||
|
||
if (!args[INPUT_ARG] || !args[OUTPUT_ARG]) { | ||
console.log( | ||
"Either input or output is missing. Use --input and --output respectively.", | ||
); | ||
process.exit(0); | ||
console.log('Either input or output is missing. Use --input and --output respectively.') | ||
process.exit(0) | ||
} | ||
|
||
const filePath = path.join(__dirname, `../../${args[INPUT_ARG]}`); | ||
const outputPath = path.join(__dirname, `../../${args[OUTPUT_ARG]}`); | ||
const filePath = path.join(__dirname, `../../${args[INPUT_ARG]}`) | ||
const outputPath = path.join(__dirname, `../../${args[OUTPUT_ARG]}`) | ||
|
||
const generateWithBrowser = async (filePath, outputPath) => { | ||
try { | ||
console.log(`Generating PDF for ${filePath}...`); | ||
console.log(`Generating PDF for ${filePath}...`) | ||
const browser = await puppeteer.launch(), | ||
page = await browser.newPage(); | ||
await page.goto(`file://${filePath}`); | ||
page = await browser.newPage() | ||
await page.goto(`file://${filePath}`) | ||
await page.pdf({ | ||
path: outputPath, | ||
format: "A4", | ||
format: 'A4', | ||
printBackground: true, | ||
displayHeaderFooter: false, | ||
margin: { | ||
top: "0mm", | ||
left: "0mm", | ||
right: "0mm", | ||
bottom: "0mm", | ||
}, | ||
}); | ||
await browser.close(); | ||
top: '0mm', | ||
left: '0mm', | ||
right: '0mm', | ||
bottom: '0mm' | ||
} | ||
}) | ||
await browser.close() | ||
} catch (error) { | ||
console.log(`Error generating PDF for ${filePath}: ${error}`); | ||
throw error; | ||
console.log(`Error generating PDF for ${filePath}: ${error}`) | ||
throw error | ||
} | ||
console.log(`Successfully generated PDF for ${filePath}`); | ||
}; | ||
console.log(`Successfully generated PDF for ${filePath}`) | ||
} | ||
|
||
generateWithBrowser(filePath, outputPath); | ||
generateWithBrowser(filePath, outputPath) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
const path = require("path"); | ||
const util = require("util"); | ||
const path = require('path') | ||
const util = require('util') | ||
|
||
const getFiles = require("./getFiles.js"); | ||
const { DATA_DIRECTORY } = require("./constants.js"); | ||
const getFiles = require('./getFiles.js') | ||
const { DATA_DIRECTORY } = require('./constants.js') | ||
|
||
const generateTasks = (taskName, commandString) => { | ||
const files = getFiles(`${DATA_DIRECTORY}`); | ||
const files = getFiles(`${DATA_DIRECTORY}`) | ||
return files.map((file) => { | ||
const dirname = path.parse(file).name; | ||
const dirname = path.parse(file).name | ||
return { | ||
command: util.format(commandString, dirname, dirname), | ||
name: taskName, | ||
}; | ||
}); | ||
}; | ||
name: taskName | ||
} | ||
}) | ||
} | ||
|
||
module.exports = generateTasks; | ||
module.exports = generateTasks |
Oops, something went wrong.