Skip to content

Commit

Permalink
Move frontend from src/web to src/web/app
Browse files Browse the repository at this point in the history
  • Loading branch information
menghif committed Mar 22, 2022
1 parent 1f041b6 commit 1ed330c
Show file tree
Hide file tree
Showing 150 changed files with 25 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docker-build-and-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ jobs:
# image: docs
- context: src/api/feed-discovery
image: feed-discovery
- context: src/web
- context: src/web/app
image: nginx
build-args: |
WEB_URL=${{ inputs.web_url }}
Expand Down
4 changes: 2 additions & 2 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ pnpm-lock.yaml

# We don't maintain these files
src/api/status/public/assets
src/web/public/sw*
src/web/public/workbox*
src/web/app/public/sw*
src/web/app/public/workbox*
src/api/status/src/views

# Ignore these directories for the docusaurus docs website
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Telescope <img align="left" width="130" height="130" src=https://github.com/Seneca-CDOT/telescope/blob/master/src/web/public/logo.svg>
# Telescope <img align="left" width="130" height="130" src=https://github.com/Seneca-CDOT/telescope/blob/master/src/web/app/public/logo.svg>

[![js-airbnb/prettier-style](https://img.shields.io/badge/code%20style-airbnb%2Fprettier-blue)](https://github.com/airbnb/javascript)
[![renovatebot - enabled](https://img.shields.io/badge/renovatebot-enabled-2ea44f?logo=renovatebot)](https://renovatebot.com)
Expand Down
2 changes: 1 addition & 1 deletion docker/development.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ services:
# API Gateway
nginx:
build:
context: ../src/web
context: ../src/web/app
cache_from:
- docker.cdot.systems/nginx:buildcache
# next.js needs build-time access to a number of API URL values, forward as ARGs
Expand Down
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module.exports = {
...baseConfig,
projects: [
// Our front-end
'<rootDir>/src/web/jest.config.js',
'<rootDir>/src/web/app/jest.config.js',
// Our legacy backend tests, slowly being migrated to microservices
'<rootDir>/test/jest.config.js',
// Satellite
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
"scripts": {
"build": "pnpm turbo run build",
"dev": "pnpm dev --prefix src/web --",
"dev": "pnpm dev --prefix src/web/app --",
"develop": "pnpm dev",
"eslint": "TIMING=1 eslint --config .eslintrc.js --ignore-path .gitignore \"./src/backend/**/*.js\" \"./test/**/*.js\"",
"eslint-fix": "eslint --config .eslintrc.js --ignore-path .gitignore \"./src/backend/**/*.js\" \"./test/**/*.js\" --fix",
Expand Down
11 changes: 6 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ packages:
# docusaurus web app
- 'src/docs'
# web front-end
- 'src/web'
- 'src/web/app'
# microservices
- 'src/api/*'
# satellite
Expand Down
6 changes: 3 additions & 3 deletions src/docs/docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ On Windows and macOS, Docker Desktop must be running before you can call these s

### Front-end Web App

The front-end web app is written in TypeScript and uses next.js and Material UI for routing, component system, etc. The code lives in `src/web`.
The front-end web app is written in TypeScript and uses next.js and Material UI for routing, component system, etc. The code lives in `src/web/app`.

The web app accesses many of the microservices at runtime, and we depend on a build step to export and include the necessary runtime variables. In the front-end app, they are available at runtime via `src/web/src/config.ts`. These are populated via the `src/web/next.config.js` during build time. See [Environment Setup](../docs/getting-started/environment-setup.md) for details on how to populate these with different values for local, CI, staging, or production environments. See also [Front End](../docs/tools-and-technologies/nextjs.md) for more details about the front-end.
The web app accesses many of the microservices at runtime, and we depend on a build step to export and include the necessary runtime variables. In the front-end app, they are available at runtime via `src/web/app/src/config.ts`. These are populated via the `src/web/app/next.config.js` during build time. See [Environment Setup](../docs/getting-started/environment-setup.md) for details on how to populate these with different values for local, CI, staging, or production environments. See also [Front End](../docs/tools-and-technologies/nextjs.md) for more details about the front-end.

The front-end is run via its own container, and hosted statically by nginx. The container is defined in `src/web/Dockerfile`. Locally, it is available at <http://localhost:8000>, on staging at <https://dev.telescope.cdot.systems/>, and on production at <https://telescope.cdot.systems/>.
The front-end is run via its own container, and hosted statically by nginx. The container is defined in `src/web/app/Dockerfile`. Locally, it is available at <http://localhost:8000>, on staging at <https://dev.telescope.cdot.systems/>, and on production at <https://telescope.cdot.systems/>.

### SAML2-based authentication and authorization

Expand Down
2 changes: 1 addition & 1 deletion src/docs/docs/tools-and-technologies/nextjs.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ Here is the colour palette that we use to make our web site looks pretty and up-

# Theming Palette

Here is how we construct our Theme with MUI ([frontend/src/web/src/theme/index.ts](https://github.com/Seneca-CDOT/telescope/blob/master/src/web/src/theme/index.ts))
Here is how we construct our Theme with MUI ([frontend/src/web/app/src/theme/index.ts](https://github.com/Seneca-CDOT/telescope/blob/master/src/web/app/src/theme/index.ts))

```ts
export const lightTheme: Theme = createMuiTheme({
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 5 additions & 5 deletions src/web/jest.config.js → src/web/app/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const nextJest = require('next/jest');

const baseConfig = require('../../jest.config.base');
const baseConfig = require('../../../jest.config.base');

// Providing the path to your Next.js app which will enable loading next.config.js and .env files
const createJestConfig = nextJest({ dir: '.' });
Expand All @@ -9,17 +9,17 @@ module.exports = createJestConfig({
...baseConfig,
preset: 'ts-jest',
testEnvironment: 'jsdom',
rootDir: '../..',
testMatch: ['<rootDir>/src/web/src/**/*.test.{ts,tsx}'],
testPathIgnorePatterns: ['<rootDir>/src/web/.next', '<rootDir>/src/web/out'],
rootDir: '../../..',
testMatch: ['<rootDir>/src/web/app/src/**/*.test.{ts,tsx}'],
testPathIgnorePatterns: ['<rootDir>/src/web/app/.next', '<rootDir>/src/web/app/out'],
collectCoverageFrom: ['<rootDir>/src/**/*{ts,tsx}'],
transform: {
'^.+\\.(ts)$': 'ts-jest',
'^.+\\.(tsx)$': ['<rootDir>/node_modules/babel-jest', { presets: ['next/babel'] }],
},
globals: {
'ts-jest': {
tsconfig: '<rootDir>/src/web/tsconfig.jest.json',
tsconfig: '<rootDir>/src/web/app/tsconfig.jest.json',
},
},
});
File renamed without changes.
4 changes: 2 additions & 2 deletions src/web/next.config.js → src/web/app/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ const forwardToNext = (envVar) => {
};

// Try using .env in the root (legacy Telescope 1.0)
const legacyEnvPath = path.join(__dirname, '../..', '.env');
const legacyEnvPath = path.join(__dirname, '../../..', '.env');
console.info(`Trying to load missing ENV variables from ${legacyEnvPath}`);
loadApiUrlFromEnv(legacyEnvPath);

// Try using the env.development file in config/ (Telescope 2.0)
const envDevelopmentPath = path.join(__dirname, '../..', 'config/env.development');
const envDevelopmentPath = path.join(__dirname, '../../..', 'config/env.development');
console.info(`Trying to load missing ENV variables from ${envDevelopmentPath}`);
loadApiUrlFromEnv(envDevelopmentPath);

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 1ed330c

Please sign in to comment.