From b51cef3b8596ef88be799c8d7160ddd9cd4b5728 Mon Sep 17 00:00:00 2001 From: Raymonzut <40148684+Raymonzut@users.noreply.github.com> Date: Fri, 17 Apr 2020 12:03:13 +0200 Subject: [PATCH 1/2] Add hardcoded remote with postData --- src/remote.js | 7 +++++++ test/remote.js | 25 +++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 src/remote.js create mode 100644 test/remote.js diff --git a/src/remote.js b/src/remote.js new file mode 100644 index 0000000..c5c78ce --- /dev/null +++ b/src/remote.js @@ -0,0 +1,7 @@ +module.exports = { + postData: [ + { title: 'A walk in the park' }, + { title: 'Down the road', author: 'Alice' }, + { title: 'On a summer day', author: 'Bob' }, + ], +} diff --git a/test/remote.js b/test/remote.js new file mode 100644 index 0000000..0fbb255 --- /dev/null +++ b/test/remote.js @@ -0,0 +1,25 @@ +const assert = require('chai').assert +const remote = require('../src/remote') + +describe('remote', () => { + const data = remote.postData + + describe('postData', () => { + it('should return an array', () => { + assert.typeOf(data, 'array') + }) + it('should not be empty', () => { + assert.isAtLeast(data.length, 1) + }) + it('should contain objects', () => { + for (obj of data) { + assert.typeOf(obj, 'object') + } + }) + it('should have objects with properties', () => { + for (obj of data) { + assert.isAtLeast(Object.keys(obj).length, 1) + } + }) + }) +}) From 59d13265e21463095a5ad202fa500f4dc0dd8989 Mon Sep 17 00:00:00 2001 From: Raymonzut <40148684+Raymonzut@users.noreply.github.com> Date: Fri, 17 Apr 2020 14:34:50 +0200 Subject: [PATCH 2/2] Move client related into client/ --- .github/workflows/nodejs.yml | 1 + babel.config.js => client/babel.config.js | 0 package-lock.json => client/package-lock.json | 0 package.json => client/package.json | 0 {src => client/src}/App.vue | 0 {src => client/src}/assets/logo.png | Bin {src => client/src}/components/aboutme.vue | 0 {src => client/src}/components/answer.vue | 0 {src => client/src}/components/qa.vue | 0 {src => client/src}/components/question.vue | 0 {src => client/src}/main.js | 0 {src => client/src}/me.js | 0 {src => client/src}/remote.js | 0 {test => client/test}/me.js | 0 {test => client/test}/remote.js | 0 docker-compose.yml | 4 ++-- docker/dev/Dockerfile | 6 +++--- 17 files changed, 6 insertions(+), 5 deletions(-) rename babel.config.js => client/babel.config.js (100%) rename package-lock.json => client/package-lock.json (100%) rename package.json => client/package.json (100%) rename {src => client/src}/App.vue (100%) rename {src => client/src}/assets/logo.png (100%) rename {src => client/src}/components/aboutme.vue (100%) rename {src => client/src}/components/answer.vue (100%) rename {src => client/src}/components/qa.vue (100%) rename {src => client/src}/components/question.vue (100%) rename {src => client/src}/main.js (100%) rename {src => client/src}/me.js (100%) rename {src => client/src}/remote.js (100%) rename {test => client/test}/me.js (100%) rename {test => client/test}/remote.js (100%) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index f819d17..dfb538c 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -21,6 +21,7 @@ jobs: uses: actions/setup-node@v1 with: node-version: ${{ matrix.node-version }} + - run: cd client/ - run: npm ci - run: npm run build --if-present - run: npm test diff --git a/babel.config.js b/client/babel.config.js similarity index 100% rename from babel.config.js rename to client/babel.config.js diff --git a/package-lock.json b/client/package-lock.json similarity index 100% rename from package-lock.json rename to client/package-lock.json diff --git a/package.json b/client/package.json similarity index 100% rename from package.json rename to client/package.json diff --git a/src/App.vue b/client/src/App.vue similarity index 100% rename from src/App.vue rename to client/src/App.vue diff --git a/src/assets/logo.png b/client/src/assets/logo.png similarity index 100% rename from src/assets/logo.png rename to client/src/assets/logo.png diff --git a/src/components/aboutme.vue b/client/src/components/aboutme.vue similarity index 100% rename from src/components/aboutme.vue rename to client/src/components/aboutme.vue diff --git a/src/components/answer.vue b/client/src/components/answer.vue similarity index 100% rename from src/components/answer.vue rename to client/src/components/answer.vue diff --git a/src/components/qa.vue b/client/src/components/qa.vue similarity index 100% rename from src/components/qa.vue rename to client/src/components/qa.vue diff --git a/src/components/question.vue b/client/src/components/question.vue similarity index 100% rename from src/components/question.vue rename to client/src/components/question.vue diff --git a/src/main.js b/client/src/main.js similarity index 100% rename from src/main.js rename to client/src/main.js diff --git a/src/me.js b/client/src/me.js similarity index 100% rename from src/me.js rename to client/src/me.js diff --git a/src/remote.js b/client/src/remote.js similarity index 100% rename from src/remote.js rename to client/src/remote.js diff --git a/test/me.js b/client/test/me.js similarity index 100% rename from test/me.js rename to client/test/me.js diff --git a/test/remote.js b/client/test/remote.js similarity index 100% rename from test/remote.js rename to client/test/remote.js diff --git a/docker-compose.yml b/docker-compose.yml index 683f3fa..36c11b4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,4 @@ -version: "3" +version: '3' services: website-dev: @@ -6,6 +6,6 @@ services: context: ./ dockerfile: docker/dev/Dockerfile volumes: - - ./src:/var/www/app + - ./client/src:/var/www/app ports: - 8080:8080 diff --git a/docker/dev/Dockerfile b/docker/dev/Dockerfile index 9eee66b..e17e22c 100644 --- a/docker/dev/Dockerfile +++ b/docker/dev/Dockerfile @@ -4,16 +4,16 @@ FROM node:lts-alpine WORKDIR /app # get the sauce -COPY /src/ /app/src/ +COPY /client/src/ /app/src/ # add `/app/node_modules/.bin` to $PATH ENV PATH /app/node_modules/.bin:$PATH # make sure the packages are the same -COPY package-lock.json /app/package.json +COPY /client/package-lock.json /app/package.json # install and cache app dependencies -COPY package.json /app/package.json +COPY /client/package.json /app/package.json RUN npm install # start app