This commit is contained in:
JesmoDev
2022-05-25 15:24:38 +02:00
7 changed files with 1934 additions and 3 deletions

View File

@@ -13,6 +13,9 @@ dist-ssr
types
*.local
## testing
/coverage/
# Editor directories and files
.vscode/*
!.vscode/extensions.json

File diff suppressed because it is too large Load Diff

View File

@@ -19,7 +19,8 @@
"dev": "vite",
"build": "tsc && vite build",
"preview": "vite preview --open",
"test": "echo 'TODO: Implement test'",
"test": "web-test-runner --coverage",
"test:watch": "web-test-runner --watch",
"lint": "eslint . --ext .ts --cache",
"lint:fix": "npm run lint -- --fix",
"format": "prettier 'src/**/*.ts'",
@@ -32,6 +33,7 @@
},
"dependencies": {
"@umbraco-ui/uui": "^0.2.1",
"element-internals-polyfill": "^1.1.4",
"lit": "^2.2.4",
"openapi-typescript-fetch": "^1.1.3",
"rxjs": "^7.5.5"
@@ -42,6 +44,9 @@
"@types/mocha": "^9.1.1",
"@typescript-eslint/eslint-plugin": "^5.24.0",
"@typescript-eslint/parser": "^5.24.0",
"@web/dev-server-esbuild": "^0.3.0",
"@web/test-runner": "^0.13.28",
"@web/test-runner-playwright": "^0.8.8",
"eslint": "^8.15.0",
"eslint-config-prettier": "^8.5.0",
"eslint-import-resolver-typescript": "^2.7.1",

View File

@@ -177,7 +177,8 @@ export class UmbBackofficeHeader extends UmbContextConsumerMixin(LitElement) {
.subscribe((sectionExtensions: any) => {
this._sections = sectionExtensions.filter((section: any) => this._allowedSection.includes(section.alias));
this._visibleSections = this._sections;
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const currentSectionAlias = this._sections.find(section => section.name === this._location?.params?.section)?.alias;
if (!currentSectionAlias) return;
this._sectionContext?.setCurrent(currentSectionAlias);

View File

@@ -1,4 +1,5 @@
import { Observable, ReplaySubject } from 'rxjs';
import { UmbRouterBeforeEnterEvent } from './router-before-enter.event';
import { UmbRouterBeforeLeaveEvent } from './router-before-leave.event';
@@ -10,7 +11,7 @@ export interface UmbRoute {
export interface UmbRouteLocation {
pathname: string;
params: object;
params: Record<string, any>;
fullPath: string;
route: UmbRoute;
}

View File

@@ -0,0 +1,12 @@
# What is this?
This folder contains the schema generator which resides here temporarily until Umbraco provides a proper way to generate schemas in its own repository.
## How do I use it?
1. Run `npm install` in this folder.
2. Update any schema through `api.ts` and then run `npm run generate` to simulate a new schema.
3. You then need to go to the main folder and run `npm run generate:api` to generate the API fetchers and interfaces.
1. This is the only thing that will remain in the final version.
We are using the excellent tool `@airtasker/spot` to decorate the schema methods. [You can read more about it here](https://github.com/airtasker/spot).

View File

@@ -0,0 +1,22 @@
import { esbuildPlugin } from '@web/dev-server-esbuild';
import { playwrightLauncher } from '@web/test-runner-playwright';
export default {
nodeResolve: true,
files: 'src/**/*.test.ts',
plugins: [esbuildPlugin({ ts: true, target: 'auto' })],
browsers: [
playwrightLauncher({ product: 'chromium' }),
playwrightLauncher({ product: 'firefox' }),
playwrightLauncher({ product: 'webkit' }),
],
testRunnerHtml: (testFramework) =>
`<html>
<body>
<script type="module" src="${testFramework}"></script>
<script type="module">
import 'element-internals-polyfill';
</script>
</body>
</html>`,
};