Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,6 @@ HASURA_GRAPHQL_DATABASE_URL=postgres://$TSDB_POSTGRES_USER:$TSDB_POSTGRES_PASSWO
# use actual IP address instead
REACT_APP_ENKETO_URL=https://8065-tushar5526-workflow-0qffaj3egws.ws-us93.gitpod.io
REACT_APP_FORM_MANAGER_URL=https://3006-tushar5526-workflow-0qffaj3egws.ws-us93.gitpod.io
REACT_APP_HASURA_URL=https://8080-tushar5526-workflow-0qffaj3egws.ws-us93.gitpod.io
REACT_APP_HASURA_URL=https://8080-tushar5526-workflow-0qffaj3egws.ws-us93.gitpod.io
NEXT_PUBLIC_USER_SERVICE_URL=https://user.dst.samagra.io/api/
NEXT_PUBLIC_APPLICATION_ID=4c57cf9d-82eb-4ec5-b0ac-49302a79e848
1 change: 0 additions & 1 deletion apps/wrapper/.dockerignore

This file was deleted.

33 changes: 32 additions & 1 deletion apps/wrapper/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# Previous rules
.env

# dependencies
/node_modules
Expand All @@ -21,3 +22,33 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*

.env
scripts/form_submission_upload.py

# Next.js
.next/
out/

# Node.js
node_modules/
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Environment variables
.env.local
.env.development.local
.env.test.local
.env.production.local

# Build artifacts
/.next/
/coverage/
/build/

# Miscellaneous
.DS_Store

# Custom files or directories to ignore
scripts/form_submission_upload.py
39 changes: 7 additions & 32 deletions apps/wrapper/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,36 +1,11 @@
#get the latest alpine image from node registry
FROM node:16-alpine AS build-stage
RUN npm i -g pnpm
#set the working directory
WORKDIR /app
FROM node:18-alpine

#copy the package and package lock files
#from local to container work directory /app
COPY package.json /app/
COPY pnpm-lock.yaml /app/
WORKDIR /app

#Run command npm install to install packages
RUN pnpm install
# Install dependencies based on the preferred package manager
COPY package.json yarn.lock* ./
RUN yarn install

#copy all the folder contents from local to container
COPY . .

#specify env variables at runtime
ARG REACT_APP_ENKETO_URL
ARG REACT_APP_FORM_MANAGER_URL
ARG REACT_APP_HASURA_URL

ENV REACT_APP_ENKETO_URL $REACT_APP_ENKETO_URL
ENV REACT_APP_FORM_MANAGER_URL $REACT_APP_FORM_MANAGER_URL
ENV REACT_APP_HASURA_URL $REACT_APP_HASURA_URL


#create a react production build
RUN npm run build

#get the latest alpine image from nginx registry
FROM nginx:alpine

#we copy the output from first stage that is our react build
#into nginx html directory where it will serve our index file
COPY --from=build-stage /app/build/ /usr/share/nginx/html
EXPOSE 3000
CMD yarn dev
76 changes: 20 additions & 56 deletions apps/wrapper/README.md
Original file line number Diff line number Diff line change
@@ -1,70 +1,34 @@
# Getting Started with Create React App
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).

This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
## Getting Started

## Available Scripts
First, run the development server:

In the project directory, you can run:
```bash
npm run dev
# or
yarn dev
# or
pnpm dev
```

### `npm start`
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.

Runs the app in the development mode.\
Open [http://localhost:3000](http://localhost:3000) to view it in your browser.
You can start editing the page by modifying `app/page.js`. The page auto-updates as you edit the file.

The page will reload when you make changes.\
You may also see any lint errors in the console.

### `npm test`

Launches the test runner in the interactive watch mode.\
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.

### `npm run build`

Builds the app for production to the `build` folder.\
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.\
Your app is ready to be deployed!

See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.

### `npm run eject`

**Note: this is a one-way operation. Once you `eject`, you can't go back!**

If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.

You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.
This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.

## Learn More

You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).

To learn React, check out the [React documentation](https://reactjs.org/).

### Code Splitting

This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)

### Analyzing the Bundle Size

This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)

### Making a Progressive Web App

This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)

### Advanced Configuration
To learn more about Next.js, take a look at the following resources:

This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.

### Deployment
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!

This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
## Deploy on Vercel

### `npm run build` fails to minify
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.

This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
18 changes: 18 additions & 0 deletions apps/wrapper/cypress.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
const { defineConfig } = require("cypress");

module.exports = defineConfig({
projectId: "k2eqd2",

component: {
devServer: {
framework: "next",
bundler: "webpack",
},
},

e2e: {
setupNodeEvents(on, config) {
// implement node event listeners here
},
},
});
5 changes: 5 additions & 0 deletions apps/wrapper/cypress/e2e/spec.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
describe('e2e testing', () => {
it('passes', () => {
cy.visit('http://localhost:3000/')
})
})
5 changes: 5 additions & 0 deletions apps/wrapper/cypress/fixtures/example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "Using fixtures to represent data",
"email": "hello@cypress.io",
"body": "Fixtures are a great way to mock data for responses to routes"
}
25 changes: 25 additions & 0 deletions apps/wrapper/cypress/support/commands.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// ***********************************************
// This example commands.js shows you how to
// create various custom commands and overwrite
// existing commands.
//
// For more comprehensive examples of custom
// commands please read more here:
// https://on.cypress.io/custom-commands
// ***********************************************
//
//
// -- This is a parent command --
// Cypress.Commands.add('login', (email, password) => { ... })
//
//
// -- This is a child command --
// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
//
//
// -- This is a dual command --
// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
//
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
14 changes: 14 additions & 0 deletions apps/wrapper/cypress/support/component-index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>Components App</title>
<!-- Used by Next.js to inject CSS. -->
<div id="__next_css__DO_NOT_USE__"></div>
</head>
<body>
<div data-cy-root></div>
</body>
</html>
30 changes: 30 additions & 0 deletions apps/wrapper/cypress/support/component.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// ***********************************************************
// This example support/component.js is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************

// Import commands.js using ES2015 syntax:
import './commands'

// Alternatively you can use CommonJS syntax:
// require('./commands')

import { mount } from 'cypress/react18'

Cypress.Commands.add('mount', mount)
Cypress.on('uncaught:exception', (err, runnable) => {
// returning false here prevents Cypress from failing the test
return false
})
// Example use:
// cy.mount(<MyComponent />)
20 changes: 20 additions & 0 deletions apps/wrapper/cypress/support/e2e.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// ***********************************************************
// This example support/e2e.js is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************

// Import commands.js using ES2015 syntax:
import './commands'

// Alternatively you can use CommonJS syntax:
// require('./commands')
7 changes: 7 additions & 0 deletions apps/wrapper/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: "3"

services:
portal:
build: .
ports:
- "3000:3000"
8 changes: 8 additions & 0 deletions apps/wrapper/jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/components/*": ["components/*"]
}
}
}
4 changes: 4 additions & 0 deletions apps/wrapper/next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/** @type {import('next').NextConfig} */
const nextConfig = {}

module.exports = nextConfig
Loading