Skip to content

Commit

Permalink
Feat: Add Audit Form Builder BASE (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristopherPHolder authored Mar 1, 2024
2 parents 26463e1 + 6716f48 commit bcd5e62
Show file tree
Hide file tree
Showing 142 changed files with 11,488 additions and 10,534 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ jobs:
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}

- name: Build Affected
run: npx nx affected --target=build --parallel=3
run: npx nx affected -t build build-storybook --parallel=3

publish-storybook:
name: Publish Storybook
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,9 @@ dist

# DS_Store Mac
.DS_Store

# Angular Cache
.angular

# Nx Cache
.nx
5 changes: 4 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Add files here to ignore them from prettier formatting
/dist
/coverage
/coverage
.angular

/.nx/cache
10 changes: 10 additions & 0 deletions apps/audit-manager-e2e/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": ["plugin:cypress/recommended", "../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
}
]
}
6 changes: 6 additions & 0 deletions apps/audit-manager-e2e/cypress.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { defineConfig } from 'cypress';
import { nxE2EPreset } from '@nx/cypress/plugins/cypress-preset';

export default defineConfig({
e2e: nxE2EPreset(__dirname),
});
30 changes: 30 additions & 0 deletions apps/audit-manager-e2e/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "audit-manager-e2e",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "apps/audit-manager-e2e/src",
"projectType": "application",
"targets": {
"e2e": {
"executor": "@nx/cypress:cypress",
"options": {
"cypressConfig": "apps/audit-manager-e2e/cypress.config.ts",
"devServerTarget": "audit-manager:serve:development",
"testingType": "e2e"
},
"configurations": {
"production": {
"devServerTarget": "audit-manager:serve:production"
},
"ci": {
"devServerTarget": "audit-manager:serve-static"
}
}
},
"lint": {
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"]
}
},
"tags": [],
"implicitDependencies": ["audit-manager"]
}
13 changes: 13 additions & 0 deletions apps/audit-manager-e2e/src/e2e/app.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { getGreeting } from '../support/app.po';

describe('audit-manager', () => {
beforeEach(() => cy.visit('/'));

it('should display welcome message', () => {
// Custom command example, see `../support/commands.ts` file
cy.login('[email protected]', 'myPassword');

// Function helper example, see `../support/app.po.ts` file
getGreeting().contains('Welcome audit-manager');
});
});
4 changes: 4 additions & 0 deletions apps/audit-manager-e2e/src/fixtures/example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "Using fixtures to represent data",
"email": "[email protected]"
}
1 change: 1 addition & 0 deletions apps/audit-manager-e2e/src/support/app.po.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const getGreeting = () => cy.get('h1');
33 changes: 33 additions & 0 deletions apps/audit-manager-e2e/src/support/commands.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// ***********************************************
// 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
// ***********************************************

// eslint-disable-next-line @typescript-eslint/no-namespace
declare namespace Cypress {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
interface Chainable<Subject> {
login(email: string, password: string): void;
}
}
//
// -- This is a parent command --
Cypress.Commands.add('login', (email, password) => {
console.log('Custom command example: 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) => { ... })
17 changes: 17 additions & 0 deletions apps/audit-manager-e2e/src/support/e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// ***********************************************************
// This example support/index.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';
16 changes: 16 additions & 0 deletions apps/audit-manager-e2e/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"sourceMap": false,
"outDir": "../../dist/out-tsc",
"allowJs": true,
"types": ["cypress", "node"],
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true
},
"include": ["src/**/*.ts", "src/**/*.js", "cypress.config.ts"]
}
33 changes: 33 additions & 0 deletions apps/audit-manager/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"extends": ["../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts"],
"extends": ["plugin:@nx/angular", "plugin:@angular-eslint/template/process-inline-templates"],
"rules": {
"@angular-eslint/directive-selector": [
"error",
{
"type": "attribute",
"prefix": "app",
"style": "camelCase"
}
],
"@angular-eslint/component-selector": [
"error",
{
"type": "element",
"prefix": "app",
"style": "kebab-case"
}
]
}
},
{
"files": ["*.html"],
"extends": ["plugin:@nx/angular-template"],
"rules": {}
}
]
}
22 changes: 22 additions & 0 deletions apps/audit-manager/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/* eslint-disable */
export default {
displayName: 'audit-manager',
preset: '../../jest.preset.js',
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
coverageDirectory: '../../coverage/apps/audit-manager',
transform: {
'^.+\\.(ts|mjs|js|html)$': [
'jest-preset-angular',
{
tsconfig: '<rootDir>/tsconfig.spec.json',
stringifyContentPathRegex: '\\.(html|svg)$',
},
],
},
transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'],
snapshotSerializers: [
'jest-preset-angular/build/serializers/no-ng-attributes',
'jest-preset-angular/build/serializers/ng-snapshot',
'jest-preset-angular/build/serializers/html-comment',
],
};
101 changes: 101 additions & 0 deletions apps/audit-manager/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
{
"name": "audit-manager",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "application",
"prefix": "app",
"sourceRoot": "apps/audit-manager/src",
"tags": [],
"targets": {
"build": {
"executor": "@angular-devkit/build-angular:browser",
"outputs": ["{options.outputPath}"],
"options": {
"outputPath": "dist/apps/audit-manager",
"index": "apps/audit-manager/src/index.html",
"main": "apps/audit-manager/src/main.ts",
"polyfills": ["zone.js"],
"tsConfig": "apps/audit-manager/tsconfig.app.json",
"assets": ["apps/audit-manager/src/favicon.ico", "apps/audit-manager/src/assets"],
"styles": ["@angular/material/prebuilt-themes/indigo-pink.css", "apps/audit-manager/src/styles.scss"],
"scripts": []
},
"configurations": {
"production": {
"budgets": [
{
"type": "initial",
"maximumWarning": "500kb",
"maximumError": "1mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "2kb",
"maximumError": "4kb"
}
],
"outputHashing": "all"
},
"development": {
"buildOptimizer": false,
"optimization": false,
"vendorChunk": true,
"extractLicenses": false,
"sourceMap": true,
"namedChunks": true
}
},
"defaultConfiguration": "production"
},
"serve": {
"executor": "@angular-devkit/build-angular:dev-server",
"configurations": {
"production": {
"buildTarget": "audit-manager:build:production"
},
"development": {
"buildTarget": "audit-manager:build:development"
}
},
"defaultConfiguration": "development"
},
"extract-i18n": {
"executor": "@angular-devkit/build-angular:extract-i18n",
"options": {
"buildTarget": "audit-manager:build"
}
},
"lint": {
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"]
},
"test": {
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "apps/audit-manager/jest.config.ts"
}
},
"serve-static": {
"executor": "@nx/web:file-server",
"options": {
"buildTarget": "audit-manager:build"
}
},
"deploy": {
"executor": "@app-speed/aws-deploy:s3-upload",
"dependsOn": ["build"],
"options": {
"upload": "dist/apps/audit-manager"
},
"configurations": {
"production": {
"bucket": "s3://appspeed.dev"
},
"development": {
"bucket": "s3://dev.appspeed.dev"
}
},
"defaultConfiguration": "development"
}
}
}
24 changes: 24 additions & 0 deletions apps/audit-manager/src/app/app.component.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { TestBed } from '@angular/core/testing';
import { AppComponent } from './app.component';
import { RouterTestingModule } from '@angular/router/testing';

describe('AppComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [AppComponent, RouterTestingModule],
}).compileComponents();
});

it('should render title', () => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.nativeElement as HTMLElement;
expect(compiled.querySelector('h1')?.textContent).toContain('Welcome audit-manager');
});

it(`should have as title 'audit-manager'`, () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app.title).toEqual('audit-manager');
});
});
22 changes: 22 additions & 0 deletions apps/audit-manager/src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { ChangeDetectionStrategy, Component, ViewEncapsulation } from '@angular/core';
import { RouterModule } from '@angular/router';
import { ShellComponent } from 'ui/shell';

@Component({
standalone: true,
imports: [ShellComponent, RouterModule],
selector: 'app-root',
template: `<ui-shell [navItems]='navItems'><router-outlet/></ui-shell>`,
styles: [''],
encapsulation: ViewEncapsulation.None,
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class AppComponent {
title = 'audit-manager';

public readonly navItems = [
'Link 1',
'Link 2',
'Link 3'
]
}
15 changes: 15 additions & 0 deletions apps/audit-manager/src/app/app.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { ApplicationConfig } from '@angular/core';
import { provideRouter, withComponentInputBinding, withEnabledBlockingInitialNavigation } from '@angular/router';
import { appRoutes } from './app.routes';
import { provideAnimations } from '@angular/platform-browser/animations';

export const appConfig: ApplicationConfig = {
providers: [
provideRouter(
appRoutes,
withComponentInputBinding(),
withEnabledBlockingInitialNavigation(),
),
provideAnimations(),
],
};
6 changes: 6 additions & 0 deletions apps/audit-manager/src/app/app.routes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { Route } from '@angular/router';
import { auditBuilderRoutes } from '@app-speed/feature/audit-builder';

export const appRoutes: Route[] = [
...auditBuilderRoutes
];
Empty file.
Loading

0 comments on commit bcd5e62

Please sign in to comment.