Skip to content

Commit 7cd2010

Browse files
author
Archimedes Trajano
committed
Builds in docker
1 parent 5237436 commit 7cd2010

17 files changed

+13726
-23567
lines changed

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
FROM chromedp/headless-shell as chrome
2-
FROM node:latest as build-stage
2+
FROM node:12 as build-stage
33
WORKDIR /app
44
COPY package*.json ./
55
RUN npm ci

package-lock.json

+13,676-23,520
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
"test:unit": "vue-cli-service test:unit",
1010
"test:e2e": "vue-cli-service test:e2e",
1111
"lint": "vue-cli-service lint",
12-
"fix": "eslint --ext .js,.vue --fix src",
13-
"test": "jest --coverage",
12+
"fmt": "vue-cli-service lint --fix",
13+
"test": "vue-cli-service lint",
1414
"unit": "jest --coverage --watch",
1515
"x-build": "webpack --mode=production"
1616
},

src/components/App.spec.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import Vuex from "vuex";
22
import { shallowMount, createLocalVue } from "@vue/test-utils";
33

4-
import App from "@/components/App";
4+
import App from "@/components/App.vue";
55
import "@/icons";
66

77
const localVue = createLocalVue();
88
localVue.use(Vuex);
99

1010
describe("App.vue", () => {
1111
it("should not crash when prerendering", () => {
12-
global.__PRERENDER_INJECTED = {};
12+
(window as any).__PRERENDER_INJECTED = {};
1313

1414
const wrapper = shallowMount(App, {
1515
mocks: {
@@ -22,6 +22,6 @@ describe("App.vue", () => {
2222
wrapper.html();
2323
});
2424
afterEach(() => {
25-
delete global.__PRERENDER_INJECTED;
25+
delete (window as any).__PRERENDER_INJECTED;
2626
});
2727
});

src/components/DImg.spec.ts

+8-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import Vue from "vue";
2-
import DImg from "@/components/DImg";
2+
import DImg from "@/components/DImg.vue";
3+
import { expect } from "chai";
34

45
describe("DImg.vue", () => {
56
it("should change to the src url after the next tick", () => {
@@ -9,33 +10,33 @@ describe("DImg.vue", () => {
910
src: "https://trajano.net/"
1011
}
1112
}).$mount();
12-
expect(vm.$el.src).toEqual(
13+
expect((vm.$el as HTMLImageElement).src).eq(
1314
"data:image/png;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs="
1415
);
1516
vm.$nextTick(() => {
16-
expect(vm.$el.src).toEqual("https://trajano.net/");
17+
expect((vm.$el as HTMLImageElement).src).eq("https://trajano.net/");
1718
});
1819
});
1920

2021
it("should not change to the src url after the next tick when prerendering", () => {
21-
global.__PRERENDER_INJECTED = {};
22+
(window as any).__PRERENDER_INJECTED = {};
2223
const Constructor = Vue.extend(DImg);
2324
const vm = new Constructor({
2425
propsData: {
2526
src: "https://trajano.net/"
2627
}
2728
}).$mount();
28-
expect(vm.$el.src).toEqual(
29+
expect((vm.$el as HTMLImageElement).src).eq(
2930
"data:image/png;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs="
3031
);
3132
vm.$nextTick(() => {
32-
expect(vm.$el.src).toEqual(
33+
expect((vm.$el as HTMLImageElement).src).eq(
3334
"data:image/png;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs="
3435
);
3536
});
3637
});
3738

3839
afterEach(() => {
39-
delete global.__PRERENDER_INJECTED;
40+
// delete global.__PRERENDER_INJECTED;
4041
});
4142
});

src/components/DImg.vue

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ export default {
2424
};
2525
},
2626
mounted() {
27-
if (!global.__PRERENDER_INJECTED) {
28-
this.dataSrc = this.src;
29-
}
27+
//if (!global.__PRERENDER_INJECTED) {
28+
this.dataSrc = this.src;
29+
//}
3030
}
3131
};
3232
</script>

src/components/MyFeature.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import Vue from "vue";
2-
import MyFeature from "@/components/MyFeature";
2+
import MyFeature from "@/components/MyFeature.vue";
33
import "@/icons";
44

55
describe("MyFeature.vue", () => {

src/components/PortfolioFooter.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Vuex from "vuex";
22
import { shallowMount, createLocalVue } from "@vue/test-utils";
3-
import PortfolioFooter from "@/components/PortfolioFooter";
3+
import PortfolioFooter from "@/components/PortfolioFooter.vue";
44
import "@/icons";
55

66
const localVue = createLocalVue();
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import Vue from "vue";
2-
import RecruiterAndResumeBlock from "@/components/RecruiterAndResumeBlock";
2+
import RecruiterAndResumeBlock from "@/components/RecruiterAndResumeBlock.vue";
33
import "@/icons";
4+
import { expect } from "chai";
45

56
describe("RecruiterAndResumeBlock.vue", () => {
67
it("should show the proper rate", () => {
78
const Constructor = Vue.extend(RecruiterAndResumeBlock);
8-
const vm = new Constructor({
9+
const vm = (new Constructor({
910
propsData: {}
10-
}).$mount();
11-
expect(vm.rate).toEqual(125);
11+
}).$mount() as unknown) as { rate: number };
12+
expect(vm.rate).eq(125);
1213
});
1314
});

src/components/RecruiterAndResumeBlock.vue

+7-9
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,11 @@
3737
</div>
3838
</div>
3939
</template>
40-
<script>
41-
export default {
42-
name: "RecruiterAndResumeBlock",
43-
data() {
44-
return {
45-
rate: 125
46-
};
47-
}
48-
};
40+
<script lang="ts">
41+
import Vue from "vue";
42+
import Component from "vue-class-component";
43+
@Component
44+
export default class RecruiterAndResumeBlock extends Vue {
45+
rate = 125;
46+
}
4947
</script>

src/directives/deobfuscate.ts

+9-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Vue from "vue";
22

3-
function deobfuscate(e) {
3+
function deobfuscate(e: string) {
44
return e
55
.replace("...", "@")
66
.replace(/\.\.\./g, ".")
@@ -18,10 +18,14 @@ function deobfuscate(e) {
1818

1919
Vue.directive("deobfuscate", {
2020
inserted(el) {
21-
if (!global.__PRERENDER_INJECTED) {
22-
/* Deobfuscate mailto and tel links */
23-
el.innerHTML = deobfuscate(el.innerHTML);
24-
el.href = deobfuscate(el.href);
21+
// if (!global.__PRERENDER_INJECTED) {
22+
/* Deobfuscate mailto and tel links */
23+
el.innerHTML = deobfuscate(el.innerHTML);
24+
if (el.hasAttribute("href")) {
25+
(el as HTMLAnchorElement).href = deobfuscate(
26+
(el as HTMLAnchorElement).href
27+
);
2528
}
29+
// }
2630
}
2731
});

src/directives/scrollSpy.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import Vue from "vue";
22
import store from "../store";
33
Vue.directive("scroll-spy", {
44
inserted(el) {
5-
if (!global.__PRERENDER_INJECTED) {
6-
store.dispatch("ScrollSpy/addScrollSpy", { el });
7-
}
5+
//if (!global.__PRERENDER_INJECTED) {
6+
store.dispatch("ScrollSpy/addScrollSpy", { el });
7+
//}
88
}
99
});

src/icons.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { faExclamationCircle } from "@fortawesome/free-solid-svg-icons/faExclama
1818
import { faGraduationCap } from "@fortawesome/free-solid-svg-icons/faGraduationCap";
1919
import { faMobileAlt } from "@fortawesome/free-solid-svg-icons/faMobileAlt";
2020
import { faUsers } from "@fortawesome/free-solid-svg-icons/faUsers";
21-
import FontAwesomeIcon from "./components/FontAwesomeIcon";
21+
import FontAwesomeIcon from "./components/FontAwesomeIcon.vue";
2222

2323
library.add(
2424
faGithub,

src/ld-json.ts

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import Handlebars from "handlebars";
22

3-
module.exports = function(data) {
4-
return new Handlebars.SafeString(
5-
"<script type='application/ld+json'>" + JSON.stringify(data) + "</script>"
3+
export default (data: object) =>
4+
new Handlebars.SafeString(
5+
`<script type='application/ld+json'>${JSON.stringify(data)}</script>`
66
);
7-
};

src/main.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import "./app.scss";
44
import "materialize-css";
55
import "./icons";
66
import "./directives";
7-
import App from "./components/App";
7+
import App from "@/components/App.vue";
88
import store from "./store";
99

1010
/* eslint-disable no-new */

src/store/scrollSpy.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ActionContext, Module } from "vuex";
1+
import { Module } from "vuex";
22

33
interface ScrollSpyState {
44
scrollElements: HTMLElement[];
@@ -14,7 +14,7 @@ export const ScrollSpy: Module<ScrollSpyState, ScrollSpyState> = {
1414
}
1515
},
1616
actions: {
17-
addScrollSpy({ commit }, payload) {
17+
addScrollSpy({ commit }, payload: { el: HTMLElement }) {
1818
commit("addScrollSpy", { el: payload.el });
1919
}
2020
}
File renamed without changes.

0 commit comments

Comments
 (0)