This commit is contained in:
salomonelli 2017-10-19 21:59:49 +02:00
parent 9347fa3ce5
commit 01eb7836be
11 changed files with 110 additions and 112 deletions

View File

@ -2,7 +2,6 @@ const puppeteer = require('puppeteer');
const fs = require('fs');
const path = require('path');
const Rx = require('rxjs/Rx');
const isRoot = require('is-root');
const http = require('http');
const fetchResponse = () => {
@ -37,17 +36,13 @@ const timedOut = timeout => {
};
const convert = async() => {
if(isRoot()) {
console.log('ERROR: Please run this without root (admin) permissions.');
return;
}
await waitForServerReachable().first().toPromise();
console.log('Connected to server ...');
console.log('Exporting ...');
try {
const directories = getResumesFromDirectories();
directories.forEach(async(dir) => {
const browser = await puppeteer.launch();
const browser = await puppeteer.launch({args: ['--no-sandbox']});
const page = await browser.newPage();
await page.goto('http://localhost:8080/#/resume/' + dir.name, {waitUntil: 'networkidle'});
await page.pdf({path: path.join(__dirname, '../pdf/' + dir.name + '.pdf'), format: 'A4'});
@ -74,7 +69,7 @@ const getResumesFromDirectories = () => {
const getDirectories = () => {
const srcpath = path.join(__dirname, '../src/resumes');
return fs.readdirSync(srcpath)
.filter(file => file !== 'resumes.js' && file !== 'template.vue');
.filter(file => file !== 'resumes.js' && file !== 'template.vue' && file !== 'options.js');
};
convert();

View File

@ -19,80 +19,84 @@
"lint": "eslint --ext .js,.vue src test/unit/specs test/e2e/specs"
},
"dependencies": {
"font-awesome": "4.7.0",
"material-design-icons": "3.0.1",
"material-icons": "0.1.0",
"npm-font-open-sans": "1.0.3",
"npm-font-open-sans-condensed": "1.0.3",
"raleway-webfont": "3.0.1",
"roboto-fontface": "0.7.0",
"source-sans-pro": "2.0.10",
"vue": "2.4.2",
"vue-router": "2.7.0"
"font-awesome": "^4.7.0",
"material-design-icons": "^3.0.1",
"material-icons": "^0.1.0",
"npm-font-open-sans": "^1.0.3",
"npm-font-open-sans-condensed": "^1.0.3",
"raleway-webfont": "^3.0.1",
"roboto-fontface": "^0.7.0",
"source-sans-pro": "^2.0.10",
"vue": "^2.4.2",
"vue-router": "^2.7.0"
},
"devDependencies": {
"autoprefixer": "7.1.4",
"babel-cli": "6.26.0",
"babel-core": "6.26.0",
"babel-eslint": "7.1.1",
"babel-loader": "7.1.2",
"babel-plugin-transform-runtime": "6.22.0",
"babel-preset-env": "1.6.0",
"babel-preset-stage-2": "6.22.0",
"babel-register": "6.26.0",
"chalk": "1.1.3",
"check-node-version": "2.1.0",
"concurrently": "3.5.0",
"connect-history-api-fallback": "1.3.0",
"copy-webpack-plugin": "4.0.1",
"cpx": "1.5.0",
"css-loader": "0.28.0",
"eslint": "4.6.1",
"eslint-config-standard": "10.2.1",
"eslint-friendly-formatter": "3.0.0",
"eslint-loader": "1.9.0",
"eslint-plugin-html": "3.2.1",
"eslint-plugin-import": "2.7.0",
"eslint-plugin-node": "5.1.1",
"eslint-plugin-promise": "3.4.0",
"eslint-plugin-standard": "3.0.1",
"eventsource-polyfill": "0.9.6",
"express": "4.15.4",
"extract-text-webpack-plugin": "2.1.2",
"file-loader": "0.11.1",
"friendly-errors-webpack-plugin": "1.1.3",
"html-webpack-plugin": "2.30.1",
"autoprefixer": "^7.1.4",
"babel-cli": "^6.26.0",
"babel-core": "^6.26.0",
"babel-eslint": "^7.1.1",
"babel-loader": "^7.1.2",
"babel-plugin-transform-runtime": "^6.22.0",
"babel-preset-env": "^1.6.0",
"babel-preset-stage-2": "^6.22.0",
"babel-register": "^6.26.0",
"chalk": "^1.1.3",
"check-node-version": "^2.1.0",
"concurrently": "^3.5.0",
"connect-history-api-fallback": "^1.3.0",
"copy-webpack-plugin": "^4.0.1",
"cpx": "^1.5.0",
"css-loader": "^0.28.0",
"escope": "^3.6.0",
"eslint": "^4.6.1",
"eslint-config-standard": "^10.2.1",
"eslint-friendly-formatter": "^3.0.0",
"eslint-loader": "^1.9.0",
"eslint-plugin-html": "^3.2.1",
"eslint-plugin-import": "^2.7.0",
"eslint-plugin-node": "^5.1.1",
"eslint-plugin-promise": "^3.4.0",
"eslint-plugin-standard": "^3.0.1",
"eventsource-polyfill": "^0.9.6",
"express": "^4.15.4",
"extract-text-webpack-plugin": "^2.1.2",
"file-loader": "^0.11.1",
"friendly-errors-webpack-plugin": "^1.1.3",
"html-webpack-plugin": "^2.30.1",
"http": "0.0.0",
"http-proxy-middleware": "0.17.3",
"is-root": "1.0.0",
"less": "2.7.2",
"less-loader": "4.0.5",
"lolex": "1.5.2",
"mv": "2.1.1",
"opn": "5.1.0",
"optimize-css-assets-webpack-plugin": "2.0.0",
"ora": "1.3.0",
"pdf-image": "1.1.0",
"postcss": "6.0.11",
"postcss-cssnext": "2.11.0",
"puppeteer": "0.12.0",
"rename": "1.0.4",
"request": "2.81.0",
"request-promise": "4.2.1",
"rimraf": "2.6.0",
"rx": "4.1.0",
"rxjs": "5.4.3",
"semver": "5.4.1",
"shelljs": "0.7.6",
"url-exists": "1.0.3",
"url-loader": "0.5.9",
"vue-loader": "12.2.1",
"vue-style-loader": "3.0.1",
"vue-template-compiler": "2.4.2",
"webpack": "2.3.3",
"webpack-bundle-analyzer": "2.9.0",
"webpack-dev-middleware": "1.12.0",
"webpack-hot-middleware": "2.19.1",
"webpack-merge": "4.1.0"
"http-proxy-middleware": "^0.17.3",
"less": "^2.7.2",
"less-loader": "^4.0.5",
"lolex": "^1.5.2",
"mv": "^2.1.1",
"opn": "^5.1.0",
"optimize-css-assets-webpack-plugin": "^2.0.0",
"ora": "^1.3.0",
"pdf-image": "^1.1.0",
"postcss": "^6.0.11",
"postcss-cssnext": "^2.11.0",
"puppeteer": "^0.12.0",
"rename": "^1.0.4",
"request": "^2.81.0",
"request-promise": "^4.2.1",
"rimraf": "^2.6.0",
"rx": "^4.1.0",
"rxjs": "^5.4.3",
"semver": "^5.4.1",
"shelljs": "^0.7.6",
"url-exists": "^1.0.3",
"url-loader": "^0.5.9",
"vue-loader": "^12.2.1",
"vue-style-loader": "^3.0.1",
"vue-template-compiler": "^2.4.2",
"webpack": "^2.3.3",
"webpack-bundle-analyzer": "^2.9.0",
"webpack-dev-middleware": "^1.12.0",
"webpack-hot-middleware": "^2.19.1",
"webpack-merge": "^4.1.0"
},
"engines": {
"node": ">= 8.5.0",
"npm": ">= 5.0.0"
}
}

View File

@ -71,7 +71,7 @@
<script>
import Vue from 'vue';
import { getVueOptions } from './resumes';
import { getVueOptions } from './options';
let name = 'left-right';
export default Vue.component(name, getVueOptions(name));

View File

@ -124,9 +124,9 @@
<script>
import Vue from 'vue';
import { getVueOptions } from './resumes';
import { getVueOptions } from './options';
let name = 'material-dark';
export default Vue.component(name, getVueOptions(name));
</script>
@ -447,4 +447,4 @@ h4 {
width:25px;
padding-left:17px;
}
</style>
</style>

View File

@ -74,7 +74,7 @@
<script>
import Vue from 'vue';
import { getVueOptions } from './resumes';
import { getVueOptions } from './options';
let name = 'oblique';
export default Vue.component(name, getVueOptions(name));

23
src/resumes/options.js Normal file
View File

@ -0,0 +1,23 @@
import { PERSON } from '../person';
import { terms } from '../terms';
// Called by templates to decrease redundancy
function getVueOptions (name) {
let opt = {
name: name,
data () {
return {
person: PERSON,
terms: terms
};
},
computed: {
lang () {
return this.terms[this.person.lang];
}
}
};
return opt;
}
export { getVueOptions };

View File

@ -65,7 +65,7 @@
<script>
import Vue from 'vue';
import { getVueOptions } from './resumes';
import { getVueOptions } from './options';
export default Vue.component('purple', getVueOptions(name));
</script>

View File

@ -5,27 +5,3 @@ import './oblique.vue';
import './side-bar.vue';
import './purple.vue';
import './side-bar-rtl.vue';
import { PERSON } from '../person';
import { terms } from '../terms';
// Called by templates to decrease redundancy
function getVueOptions (name) {
let opt = {
name: name,
data () {
return {
person: PERSON,
terms: terms
};
},
computed: {
lang () {
return this.terms[this.person.lang];
}
}
};
return opt;
}
export { getVueOptions };

View File

@ -89,7 +89,7 @@
<script>
import Vue from 'vue';
import { getVueOptions } from './resumes';
import { getVueOptions } from './options';
let name = 'side-bar-rtl';
export default Vue.component(name, getVueOptions(name));

View File

@ -89,7 +89,7 @@
<script>
import Vue from 'vue';
import { getVueOptions } from './resumes';
import { getVueOptions } from './options';
let name = 'side-bar';
export default Vue.component(name, getVueOptions(name));

View File

@ -6,7 +6,7 @@
<script>
import Vue from 'vue';
import { getVueOptions } from './resumes';
import { getVueOptions } from './options';
let name = 'TEMPLATE-NAME'; // TODO change name
export default Vue.component(name, getVueOptions(name));