Skip to content

Commit

Permalink
Refactor react tweek (#50)
Browse files Browse the repository at this point in the history
* add lerna

* added getPolicy to tweek-local-cache

* refactor withTweekKeys

* load dependencies only if needed

* add getPolicy to withTweekKeys config

* add tests

* code review

* add tweek-local-cache getPolicy tests

* bump versions

* export createProvider
  • Loading branch information
nataly87s authored Sep 17, 2017
1 parent 703488a commit fbb1c58
Show file tree
Hide file tree
Showing 31 changed files with 7,080 additions and 1,567 deletions.
27 changes: 8 additions & 19 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
NODE_ENV: development

docker:
- image: node:6.10.1
- image: node:8.5.0

steps:
- checkout
Expand All @@ -28,29 +28,18 @@ jobs:
- run:
name: run dependencies
command: |
docker login -u $DOCKER_USER -p $DOCKER_PASS
docker-compose pull
docker-compose build tests
docker-compose build dotnet_tests
docker-compose up -d tweek-api
command: docker-compose up tweek-management tweek-api
background: true

- run:
name: Prepare for tests
command: |
docker run --network=tweekclients_default node:6.10.1-slim wget --tries 20 --timeout=15 --read-timeout=20 --waitretry=30 --retry-connrefused http://tweek-api/status
- run:
name: Test tweek-client
command: docker-compose run tests /bin/bash -c "cd tweek-client && yarn test"

- run:
name: Test tweek-local-cache
command: docker-compose run tests /bin/bash -c "cd tweek-local-cache && yarn test"
docker-compose build js_tests dotnet_tests
docker run --network=tweekclients_default node:8.5.0-slim wget --tries 20 --timeout=15 --read-timeout=20 --waitretry=30 --retry-connrefused http://tweek-api/health
- run:
name: Test react-tweek
command: docker-compose run tests /bin/bash -c "cd react-tweek && yarn test"
name: Test js clients
command: docker-compose run js_tests

- run:
name: Test dotnet client
Expand Down
20 changes: 13 additions & 7 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
node_modules/
.git/
coverage-unit/
.build/
.typings/
Dockerfile
dist/
**/*
!js/
!lerna.json
!package.json
!yarn.lock
**/.build/
**/.git/
**/.idea/
**/.vscode/
**/.typings/
**/coverage-unit/
**/dist/
**/node_modules/
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*.user
*.userosscache
*.sln.docstates
dist/

# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
Expand Down
23 changes: 9 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
FROM node:6.10.1-slim
FROM node:8.5.0-slim

ADD js/react-tweek/package.json /tmp/react-tweek/package.json
RUN cd /tmp/react-tweek && yarn install
RUN mkdir -p /opt/react-tweek && cd /opt/react-tweek && ln -s /tmp/react-tweek/node_modules
COPY lerna.json package.json yarn.lock /opt/
COPY js/react-tweek/package.json js/react-tweek/yarn.lock /opt/js/react-tweek/
COPY js/tweek-client/package.json js/tweek-client/yarn.lock /opt/js/tweek-client/
COPY js/tweek-local-cache/package.json js/tweek-local-cache/yarn.lock /opt/js/tweek-local-cache/

ADD js/tweek-local-cache/package.json js/tweek-local-cache/yarn.lock /tmp/tweek-local-cache/
RUN cd /tmp/tweek-local-cache && yarn install
RUN mkdir -p /opt/tweek-local-cache && cd /opt/tweek-local-cache && ln -s /tmp/tweek-local-cache/node_modules

ADD js/tweek-client/package.json js/tweek-client/yarn.lock /tmp/tweek-client/
RUN cd /tmp/tweek-client && yarn install
RUN mkdir -p /opt/tweek-client && cd /opt/tweek-client && ln -s /tmp/tweek-client/node_modules
WORKDIR /opt
RUN yarn && yarn bootstrap

ADD ./js /opt
COPY . /opt/

WORKDIR /opt
CMD ["tail", "-f", "/dev/null"]
CMD yarn test
11 changes: 6 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ services:
- TWEEK_MANAGEMENT_URL=http://tweek-management:3000

tweek-management:
image: soluto/tweek-management
image: soluto/tweek-management:0.1.11
depends_on:
- tweek-git
volumes_from:
Expand All @@ -26,7 +26,7 @@ services:
- VALIDATION_URL=http://tweek-api/validation

tweek-api:
image: soluto/tweek-api
image: soluto/tweek-api:0.2.1
ports:
- "1111:80"
depends_on:
Expand All @@ -35,6 +35,7 @@ services:
volumes_from:
- keys
environment:
- ASPNETCORE_ENVIRONMENT=Development
- PUBLIC_KEY_PATH=/gitkeys/tweekgit_public.pfx
- Rules__Management__Url=http://tweek-management:3000
- ContextProvider=redis
Expand All @@ -46,8 +47,8 @@ services:
image: redis:alpine
expose:
- "6379"
tests:

js_tests:
build: .
depends_on:
- tweek-api
Expand All @@ -59,4 +60,4 @@ services:
depends_on:
- tweek-api
environment:
- TWEEK_TEST_URI=http://tweek-api
- TWEEK_TEST_URI=http://tweek-api
2 changes: 1 addition & 1 deletion js/react-tweek/.babelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"presets": ["es2015", "es2017", "react"]
"presets": ["env", "react", "stage-0"]
}
5 changes: 2 additions & 3 deletions js/react-tweek/.npmignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
index.js
index.test.js
/src
.babelrc
.git
node_modules
.babelrc
70 changes: 0 additions & 70 deletions js/react-tweek/index.js

This file was deleted.

Loading

0 comments on commit fbb1c58

Please # to comment.