Skip to content

Commit

Permalink
Converts to a monorepo (yarn workspace), with packages creating separ…
Browse files Browse the repository at this point in the history
…ation between the API segments and server implementation, with utilities and dev utilities also isolated.

- The TypeScript project is now optimised with test code moved out of source
  • Loading branch information
rhyslbw committed Jun 30, 2020
1 parent ae62007 commit fdb764f
Show file tree
Hide file tree
Showing 205 changed files with 7,945 additions and 10,498 deletions.
6 changes: 4 additions & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
src/graphql_types.ts
src/generated_packages/TypeScript/index.ts
.eslintrc.js
*.d.ts
graphql_types.ts
*jest.config.js
17 changes: 17 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module.exports = {
"parser": "@typescript-eslint/parser",
"extends": [
"standard"
],
"plugins": [
"@typescript-eslint"
],
"rules": {
"no-unused-vars": 0,
"linebreak-style": [
2,
"unix"
],
"no-unused-expressions": 0
}
}
32 changes: 0 additions & 32 deletions .eslintrc.json

This file was deleted.

17 changes: 8 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
.idea
.npmrc
.nyc_output
coverage
dist
generated_packages/TypeScript/index.ts
node_modules
*.npmrc
*.nyc_output
*coverage
*d.ts
*dist/
lerna-debug.log
*node_modules/
result*
src/graphql_types.ts
tsconfig.tsbuildinfo
yarn-error.log
*yarn-error.log
31 changes: 25 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,39 @@ RUN apk add --update python make g++ yarn
RUN mkdir /application
COPY package.json yarn.lock /application/
WORKDIR /application
RUN yarn
COPY . /application
RUN yarn build
RUN mkdir /application/packages
COPY tsconfig.json /application/
COPY packages/api-cardano-db-hasura /application/packages/api-cardano-db-hasura
COPY packages/server /application/packages/server
COPY packages/util /application/packages/util
COPY packages/util-dev /application/packages/util-dev
RUN yarn --pure-lockfile --non-interactive
RUN yarn workspaces run build

FROM node:10.15.3-alpine as production_deps
RUN mkdir /application
RUN mkdir -p application/packages
COPY package.json yarn.lock /application/
WORKDIR /application/packages
RUN mkdir api-cardano-db-hasura util server
COPY packages/api-cardano-db-hasura/package.json api-cardano-db-hasura/
COPY packages/server/package.json server/
COPY packages/util/package.json util/
WORKDIR /application
RUN yarn --production
RUN yarn --production --pure-lockfile --non-interactive

FROM node:10.15.3-alpine as server
RUN mkdir /application
COPY --from=builder /application/dist /application
COPY --from=builder /application/packages/api-cardano-db-hasura/dist /application/packages/api-cardano-db-hasura/dist
COPY --from=builder /application/packages/api-cardano-db-hasura/package.json /application/packages/api-cardano-db-hasura/package.json
COPY --from=builder /application/packages/api-cardano-db-hasura/schema.graphql /application/packages/api-cardano-db-hasura/schema.graphql
COPY --from=builder /application/packages/server/dist /application/packages/server/dist
COPY --from=builder /application/packages/server/package.json /application/packages/server/package.json
COPY --from=builder /application/packages/util/dist /application/packages/util/dist
COPY --from=builder /application/packages/util/package.json /application/packages/util/package.json
COPY --from=production_deps /application/node_modules /application/node_modules
WORKDIR /application
COPY --from=production_deps /application/packages/api-cardano-db-hasura/node_modules /application/packages/api-cardano-db-hasura/node_modules
COPY --from=production_deps /application/packages/server/node_modules /application/packages/server/node_modules
WORKDIR /application/packages/server/dist
EXPOSE 3100
CMD ["node", "index.js"]
9 changes: 3 additions & 6 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,19 @@ pipeline {
stages {
stage('Install') {
steps {
sh 'yarn && yarn build'
sh 'yarn --cwd ./cli && yarn --cwd ./cli build'
sh 'yarn --cwd ./generated_packages/TypeScript'
sh 'yarn --pure-lockfile'
sh 'yarn build'
}
}
stage('Validate Code Style') {
steps {
sh 'yarn lint'
sh 'yarn --cwd ./cli lint'
}
}
stage('Test') {
steps {
sh 'docker-compose -p cardano-graphql -f ./test/docker-compose-ci.yml up --build --force-recreate -d'
sh 'NODE_ENV=test TEST_MODE=e2e npx jest suite --ci'
sh 'yarn jest Server --ci'
sh 'TEST_MODE=e2e yarn test --ci'
}
post {
always {
Expand Down
1 change: 0 additions & 1 deletion cli/.gitignore

This file was deleted.

7 changes: 0 additions & 7 deletions cli/jest.config.js

This file was deleted.

28 changes: 0 additions & 28 deletions cli/tsconfig.json

This file was deleted.

Loading

0 comments on commit fdb764f

Please sign in to comment.