generated from nhcarrigan/template
feat: new site #1
@@ -37,11 +37,11 @@ jobs:
|
|||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
run: pnpm install
|
run: pnpm install
|
||||||
|
|
||||||
# - name: Lint Source Files
|
- name: Lint Source Files
|
||||||
# run: pnpm run lint
|
run: pnpm run lint
|
||||||
|
|
||||||
# - name: Verify Build
|
- name: Verify Build
|
||||||
# run: pnpm run build
|
run: pnpm run build
|
||||||
|
|
||||||
- name: Run Tests
|
- name: Run Tests
|
||||||
run: pnpm run test
|
run: pnpm run test
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
import NaomisConfig from "@nhcarrigan/eslint-config";
|
|
||||||
|
|
||||||
export default [
|
|
||||||
...NaomisConfig,
|
|
||||||
]
|
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
import NaomisConfig from "@nhcarrigan/eslint-config";
|
||||||
|
|
||||||
|
const srcRules = NaomisConfig.find((rule) => rule.files?.includes("src/**/*.ts"));
|
||||||
|
const testRules = NaomisConfig.find((rule) => rule.files?.includes("test/**/*.spec.ts"));
|
||||||
|
|
||||||
|
export default [
|
||||||
|
...NaomisConfig,
|
||||||
|
{
|
||||||
|
files: ["src/**/*.ts"],
|
||||||
|
languageOptions: {
|
||||||
|
parserOptions: {
|
||||||
|
project: "./tsconfig.app.json"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
plugins: {
|
||||||
|
...srcRules?.plugins,
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
...srcRules?.rules,
|
||||||
|
"new-cap": "off",
|
||||||
|
// This causes a circular fix error?
|
||||||
|
"stylistic/no-multi-spaces": "off",
|
||||||
|
// This must be off because this is not a module.
|
||||||
|
"import/extensions": "off",
|
||||||
|
// This is a web app
|
||||||
|
"no-console": "off",
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
files: ["src/**/*.spec.ts"],
|
||||||
|
languageOptions: {
|
||||||
|
parserOptions: {
|
||||||
|
project: "./tsconfig.spec.json"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
plugins: {
|
||||||
|
...testRules?.plugins,
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
...testRules?.rules,
|
||||||
|
// This must be off because this is not a module.
|
||||||
|
"import/extensions": "off",
|
||||||
|
// We turn this off because the test bed has weak types.
|
||||||
|
"@typescript-eslint/consistent-type-assertions": "off",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
+12
-8
@@ -1,11 +1,15 @@
|
|||||||
import { ApplicationConfig, provideBrowserGlobalErrorListeners } from '@angular/core';
|
/**
|
||||||
import { provideRouter } from '@angular/router';
|
* @copyright NHCarrigan
|
||||||
|
* @license Naomi's Public License
|
||||||
import { routes } from './app.routes';
|
* @author Naomi Carrigan
|
||||||
|
*/
|
||||||
|
import {
|
||||||
|
type ApplicationConfig,
|
||||||
|
provideBrowserGlobalErrorListeners,
|
||||||
|
} from "@angular/core";
|
||||||
|
import { provideRouter } from "@angular/router";
|
||||||
|
import { routes } from "./app.routes";
|
||||||
|
|
||||||
export const appConfig: ApplicationConfig = {
|
export const appConfig: ApplicationConfig = {
|
||||||
providers: [
|
providers: [ provideBrowserGlobalErrorListeners(), provideRouter(routes) ],
|
||||||
provideBrowserGlobalErrorListeners(),
|
|
||||||
provideRouter(routes)
|
|
||||||
]
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,3 +1,8 @@
|
|||||||
import { Routes } from '@angular/router';
|
/**
|
||||||
|
* @copyright NHCarrigan
|
||||||
|
* @license Naomi's Public License
|
||||||
|
* @author Naomi Carrigan
|
||||||
|
*/
|
||||||
|
import type { Routes } from "@angular/router";
|
||||||
|
|
||||||
export const routes: Routes = [];
|
export const routes: Routes = [];
|
||||||
|
|||||||
+22
-9
@@ -1,23 +1,36 @@
|
|||||||
import { TestBed } from '@angular/core/testing';
|
/**
|
||||||
import { App } from './app';
|
* @copyright NHCarrigan
|
||||||
|
* @license Naomi's Public License
|
||||||
|
* @author Naomi Carrigan
|
||||||
|
*/
|
||||||
|
import { TestBed } from "@angular/core/testing";
|
||||||
|
import { describe, beforeEach, it, expect } from "vitest";
|
||||||
|
import { App } from "./app";
|
||||||
|
|
||||||
describe('App', () => {
|
describe("app", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async() => {
|
||||||
await TestBed.configureTestingModule({
|
await TestBed.configureTestingModule({
|
||||||
imports: [App],
|
imports: [ App ],
|
||||||
}).compileComponents();
|
}).compileComponents();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should create the app', () => {
|
it("should create the app", () => {
|
||||||
|
expect.assertions(1);
|
||||||
const fixture = TestBed.createComponent(App);
|
const fixture = TestBed.createComponent(App);
|
||||||
const app = fixture.componentInstance;
|
const app = fixture.componentInstance;
|
||||||
expect(app).toBeTruthy();
|
expect(app, "did not compile").toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should render title', async () => {
|
it("should render title", async() => {
|
||||||
|
expect.assertions(1);
|
||||||
const fixture = TestBed.createComponent(App);
|
const fixture = TestBed.createComponent(App);
|
||||||
await fixture.whenStable();
|
await fixture.whenStable();
|
||||||
const compiled = fixture.nativeElement as HTMLElement;
|
const compiled = fixture.nativeElement as HTMLElement;
|
||||||
expect(compiled.querySelector('h1')?.textContent).toContain('Hello, lore');
|
expect(
|
||||||
|
compiled.querySelector("h1")?.textContent,
|
||||||
|
"did not render title",
|
||||||
|
).toContain(
|
||||||
|
"Hello, lore",
|
||||||
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
+15
-7
@@ -1,12 +1,20 @@
|
|||||||
import { Component, signal } from '@angular/core';
|
/**
|
||||||
import { RouterOutlet } from '@angular/router';
|
* @copyright NHCarrigan
|
||||||
|
* @license Naomi's Public License
|
||||||
|
* @author Naomi Carrigan
|
||||||
|
*/
|
||||||
|
import { Component, signal } from "@angular/core";
|
||||||
|
import { RouterOutlet } from "@angular/router";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The root component for the application.
|
||||||
|
*/
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-root',
|
imports: [ RouterOutlet ],
|
||||||
imports: [RouterOutlet],
|
selector: "app-root",
|
||||||
templateUrl: './app.html',
|
styleUrl: "./app.css",
|
||||||
styleUrl: './app.css'
|
templateUrl: "./app.html",
|
||||||
})
|
})
|
||||||
export class App {
|
export class App {
|
||||||
protected readonly title = signal('lore');
|
protected readonly title = signal("lore");
|
||||||
}
|
}
|
||||||
|
|||||||
+13
-5
@@ -1,6 +1,14 @@
|
|||||||
import { bootstrapApplication } from '@angular/platform-browser';
|
/**
|
||||||
import { appConfig } from './app/app.config';
|
* @copyright NHCarrigan
|
||||||
import { App } from './app/app';
|
* @license Naomi's Public License
|
||||||
|
* @author Naomi Carrigan
|
||||||
|
*/
|
||||||
|
import { bootstrapApplication } from "@angular/platform-browser";
|
||||||
|
import { App } from "./app/app";
|
||||||
|
import { appConfig } from "./app/app.config";
|
||||||
|
|
||||||
bootstrapApplication(App, appConfig)
|
bootstrapApplication(App, appConfig).
|
||||||
.catch((err) => console.error(err));
|
// eslint-disable-next-line unicorn/prefer-top-level-await -- No top level await in a web app
|
||||||
|
catch((error: unknown) => {
|
||||||
|
console.error(error);
|
||||||
|
});
|
||||||
|
|||||||
+1
-1
@@ -6,7 +6,7 @@
|
|||||||
"outDir": "./out-tsc/spec",
|
"outDir": "./out-tsc/spec",
|
||||||
"types": [
|
"types": [
|
||||||
"vitest/globals"
|
"vitest/globals"
|
||||||
]
|
],
|
||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"src/**/*.d.ts",
|
"src/**/*.d.ts",
|
||||||
|
|||||||
Reference in New Issue
Block a user