Skip to content
This repository has been archived by the owner on Dec 16, 2024. It is now read-only.

Commit

Permalink
Merge pull request #126 from tsheils/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
tsheils authored Jan 24, 2024
2 parents 7031aeb + 4ee0904 commit 734e06d
Show file tree
Hide file tree
Showing 347 changed files with 14,038 additions and 14,732 deletions.
8 changes: 4 additions & 4 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"root": true,
"ignorePatterns": ["**/*"],
"plugins": ["@nrwl/nx"],
"plugins": ["@nx"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {
"@nrwl/nx/enforce-module-boundaries": [
"@nx/enforce-module-boundaries": [
"error",
{
"enforceBuildableLibDependency": true,
Expand All @@ -23,12 +23,12 @@
},
{
"files": ["*.ts", "*.tsx"],
"extends": ["plugin:@nrwl/nx/typescript"],
"extends": ["plugin:@nx/typescript"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"extends": ["plugin:@nrwl/nx/javascript"],
"extends": ["plugin:@nx/javascript"],
"rules": {}
},
{
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ yarn-error.log
testem.log
/typings

apps/ramp-client/src/environments/environment*
apps/ramp-client/src/environments/environment.ts

# System Files
.DS_Store
Thumbs.db
Expand All @@ -42,3 +45,5 @@ Thumbs.db
.Rproj.user
RaMP-Client.iml


.nx/cache
6 changes: 6 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,9 @@

/dist
/coverage
/.angular
/.idea
/node_modules
/.nx/cache

.angular
18 changes: 9 additions & 9 deletions apps/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,31 @@ These capabilities include generating applications, libraries, etc as well as th
Below are our core plugins:

- [React](https://reactjs.org)
- `npm install --save-dev @nrwl/react`
- `npm install --save-dev @nx/react`
- Web (no framework frontends)
- `npm install --save-dev @nrwl/web`
- `npm install --save-dev @nx/web`
- [Angular](https://angular.io)
- `npm install --save-dev @nrwl/angular`
- `npm install --save-dev @nx/angular`
- [Nest](https://nestjs.com)
- `npm install --save-dev @nrwl/nest`
- `npm install --save-dev @nx/nest`
- [Express](https://expressjs.com)
- `npm install --save-dev @nrwl/express`
- `npm install --save-dev @nx/express`
- [Node](https://nodejs.org)
- `npm install --save-dev @nrwl/node`
- `npm install --save-dev @nx/node`

There are also many [community plugins](https://nx.dev/community) you could add.

## Generate an application

Run `nx g @nrwl/react:app my-app` to generate an application.
Run `nx g @nx/react:app my-app` to generate an application.

> You can use any of the plugins above to generate applications as well.
When using Nx, you can create multiple applications and libraries in the same workspace.

## Generate a library

Run `nx g @nrwl/react:lib my-lib` to generate a library.
Run `nx g @nx/react:lib my-lib` to generate a library.

> You can also use any of the plugins above to generate libraries as well.
Expand All @@ -51,7 +51,7 @@ Run `nx serve my-app` for a dev server. Navigate to http://localhost:4200/. The

## Code scaffolding

Run `nx g @nrwl/react:component my-component --project=my-app` to generate a new component.
Run `nx g @nx/react:component my-component --project=my-app` to generate a new component.

## Build

Expand Down
4 changes: 2 additions & 2 deletions apps/ramp-client-e2e/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"projectType": "application",
"targets": {
"e2e": {
"executor": "@nrwl/cypress:cypress",
"executor": "@nx/cypress:cypress",
"options": {
"cypressConfig": "apps/ramp-client-e2e/cypress.json",
"devServerTarget": "ramp-client:serve:development",
Expand All @@ -18,7 +18,7 @@
}
},
"lint": {
"executor": "@nrwl/linter:eslint",
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["apps/ramp-client-e2e/**/*.{js,ts}"]
Expand Down
6 changes: 3 additions & 3 deletions apps/ramp-client-e2e/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true
"noFallthroughCasesInSwitch": true,
},
"include": ["src/**/*.ts", "src/**/*.js"],
"angularCompilerOptions": {
"strictInjectionParameters": true,
"strictInputAccessModifiers": true,
"strictTemplates": true
}
"strictTemplates": true,
},
}
4 changes: 2 additions & 2 deletions apps/ramp-client/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{
"files": ["*.ts"],
"extends": [
"plugin:@nrwl/nx/angular",
"plugin:@nx/angular",
"plugin:@angular-eslint/template/process-inline-templates"
],
"rules": {
Expand All @@ -29,7 +29,7 @@
},
{
"files": ["*.html"],
"extends": ["plugin:@nrwl/nx/angular-template"],
"extends": ["plugin:@nx/angular-template"],
"rules": {}
}
]
Expand Down
3 changes: 1 addition & 2 deletions apps/ramp-client/CLIENT_INSTRUCTIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,4 @@ To run the client application locally, please follow these steps:
4. Change directory (`cd`) to the `apps/ramp-client` directory of this repository
5. Type `ng s` or `nx run ramp-client:serve:development` and hit Enter

To build the application and run it in a container, just build and run the dockerfile in the client directory.

To build the application and run it in a container, just build and run the dockerfile in the client directory.
40 changes: 22 additions & 18 deletions apps/ramp-client/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
"name": "ramp-client",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "application",
"sourceRoot": "apps/ramp-client/src",
"prefix": "ramp-client",
"sourceRoot": "apps/ramp-client/src",
"targets": {
"build": {
"executor": "@angular-devkit/build-angular:browser",
"executor": "@angular-devkit/build-angular:application",
"outputs": ["{options.outputPath}"],
"options": {
"outputPath": "dist/ramp-client/browser",
"index": "apps/ramp-client/src/index.html",
"main": "apps/ramp-client/src/main.ts",
"browser": "apps/ramp-client/src/main.ts",
"polyfills": ["zone.js"],
"tsConfig": "apps/ramp-client/tsconfig.app.json",
"inlineStyleLanguage": "scss",
Expand All @@ -36,7 +36,12 @@
"node_modules/swagger-ui/dist/swagger-ui.css",
"apps/ramp-client/src/styles.scss"
],
"scripts": []
"scripts": [],
"server": "apps/ramp-client/src/main.server.ts",
"prerender": true,
"ssr": {
"entry": "apps/ramp-client/server.ts"
}
},
"configurations": {
"production": {
Expand All @@ -61,12 +66,9 @@
"outputHashing": "all"
},
"development": {
"buildOptimizer": false,
"optimization": false,
"vendorChunk": true,
"extractLicenses": false,
"sourceMap": true,
"namedChunks": true
"sourceMap": true
}
},
"defaultConfiguration": "production"
Expand All @@ -75,22 +77,22 @@
"executor": "@angular-devkit/build-angular:dev-server",
"configurations": {
"production": {
"browserTarget": "ramp-client:build:production"
"buildTarget": "ramp-client:build:production"
},
"development": {
"browserTarget": "ramp-client:build:development"
"buildTarget": "ramp-client:build:development"
}
},
"defaultConfiguration": "development"
},
"extract-i18n": {
"executor": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "ramp-client:build"
"buildTarget": "ramp-client:build"
}
},
"lint": {
"executor": "@nrwl/linter:eslint",
"executor": "@nx/eslint:lint",
"options": {
"lintFilePatterns": [
"apps/ramp-client/src/**/*.ts",
Expand All @@ -99,7 +101,7 @@
}
},
"test": {
"executor": "@nrwl/jest:jest",
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/apps/ramp-client"],
"options": {
"jestConfig": "apps/ramp-client/jest.config.ts",
Expand Down Expand Up @@ -128,9 +130,11 @@
]
},
"development": {
"buildOptimizer": false,
"optimization": false,
"sourceMap": true,
"extractLicenses": false
"extractLicenses": false,
"vendorChunk": true
}
},
"defaultConfiguration": "production",
Expand All @@ -150,7 +154,7 @@
}
},
"serve-ssr": {
"executor": "@nguniversal/builders:ssr-dev-server",
"executor": "@angular-devkit/build-angular:ssr-dev-server",
"configurations": {
"development": {
"browserTarget": "ramp-client:build:development",
Expand All @@ -164,10 +168,10 @@
"defaultConfiguration": "development"
},
"prerender": {
"executor": "@nguniversal/builders:prerender",
"executor": "@angular-devkit/build-angular:prerender",
"options": {
"guessRoutes": false,
"routesFile": "./apps/ramp-client/routes.txt"
"routesFile": "./apps/ramp-client/routes.txt",
"discoverRoutes": false
},
"configurations": {
"production": {
Expand Down
62 changes: 36 additions & 26 deletions apps/ramp-client/server.ts
Original file line number Diff line number Diff line change
@@ -1,39 +1,49 @@
import 'zone.js/dist/zone-node';
import 'zone.js/node';

import { ngExpressEngine } from '@nguniversal/express-engine';
import express from "express";
import { join } from 'path';

import { AppServerModule } from './src/main.server';
import { APP_BASE_HREF } from '@angular/common';
import { existsSync } from 'fs';
import { InjectionToken } from '@angular/core';
import { CommonEngine } from '@angular/ssr';
import * as express from 'express';
import { existsSync } from 'node:fs';
import { join } from 'node:path';
import bootstrap from './src/main.server';

// The Express app is exported so that it can be used by serverless Functions.
export function app(): express.Express {
const server = express();
const distFolder = join(process.cwd(), "dist/ramp-client/browser");
const indexHtml = existsSync(join(distFolder, "index.original.html")) ? "index.original.html" : "index";
const distFolder = join(process.cwd(), 'dist/rdas/browser');
const indexHtml = existsSync(join(distFolder, 'index.original.html'))
? join(distFolder, 'index.original.html')
: join(distFolder, 'index.html');

// Our Universal express-engine (found @ https://github.com/angular/universal/tree/master/modules/express-engine)
server.engine("html", ngExpressEngine({
bootstrap: AppServerModule
}));
const commonEngine = new CommonEngine();

server.set("view engine", "html");
server.set("views", distFolder);
server.set('view engine', 'html');
server.set('views', distFolder);

// Example Express Rest API endpoints
// server.get('/api/**', (req, res) => { });
// Serve static files from /browser
server.get("*.*", express.static(distFolder, {
maxAge: "1y"
}));

// All regular routes use the Universal engine
server.get("*", (
req: { baseUrl: any; }, res: { render: (arg0: string, arg1: { req: any; providers: { provide: InjectionToken<string>; useValue: any; }[]; }) => void; }) => {
res.render(indexHtml, { req, providers: [{ provide: APP_BASE_HREF, useValue: req.baseUrl }] });
server.get(
'*.*',
express.static(distFolder, {
maxAge: '1y',
}),
);

// All regular routes use the Angular engine
server.get('*', (req, res, next) => {
const { protocol, originalUrl, baseUrl, headers } = req;

commonEngine
.render({
bootstrap,
documentFilePath: indexHtml,
url: `${protocol}://${headers.host}${originalUrl}`,
publicPath: distFolder,
providers: [{ provide: APP_BASE_HREF, useValue: baseUrl }],
})
.then((html) => res.send(html))
.catch((err) => next(err));
});

return server;
Expand All @@ -54,9 +64,9 @@ function run(): void {
// The below code is to ensure that the server is run only when not requiring the bundle.
declare const __non_webpack_require__: NodeRequire;
const mainModule = __non_webpack_require__.main;
const moduleFilename = mainModule && mainModule.filename || '';
const moduleFilename = (mainModule && mainModule.filename) || '';
if (moduleFilename === __filename || moduleFilename.includes('iisnode')) {
run();
}

export * from './src/main.server';
export default bootstrap;
Loading

0 comments on commit 734e06d

Please sign in to comment.