@forsakringskassan/vue-lib-template 0.0.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/files/CHANGELOG.md +0 -0
- package/files/CODEOWNERS +9 -0
- package/files/Jenkinsfile +1 -0
- package/files/LICENSE.md +7 -0
- package/files/README.md +88 -0
- package/files/_editorconfig +21 -0
- package/files/_gitignore +24 -0
- package/files/_htmlvalidate.json +22 -0
- package/files/_npmrc +5 -0
- package/files/_prettierignore +29 -0
- package/files/api-extractor.lib.json +18 -0
- package/files/api-extractor.selectors.json +16 -0
- package/files/babel.config.js +3 -0
- package/files/cypress/fixtures/example.json +5 -0
- package/files/cypress/support/commands/forced-colors.ts +33 -0
- package/files/cypress/support/common.ts +10 -0
- package/files/cypress/support/component-index.html +14 -0
- package/files/cypress/support/component.ts +45 -0
- package/files/cypress/support/main.scss +11 -0
- package/files/cypress/tsconfig.json +20 -0
- package/files/cypress/types/cy-mount.d.ts +9 -0
- package/files/cypress/types/forced-colors.d.ts +18 -0
- package/files/cypress.config.ts +91 -0
- package/files/docs/build.mts +34 -0
- package/files/docs/components/AwesomeComponent.md +27 -0
- package/files/docs/components/index.md +5 -0
- package/files/docs/index.md +3 -0
- package/files/docs/package.json +17 -0
- package/files/docs/src/main.scss +1 -0
- package/files/docs/src/setup.ts +30 -0
- package/files/docs/tsconfig.json +8 -0
- package/files/eslint.config.mjs +69 -0
- package/files/etc/vue-lib-template-selectors.api.md +9 -0
- package/files/etc/vue-lib-template.api.md +19 -0
- package/files/package-lock.json +16060 -0
- package/files/package.json +167 -0
- package/files/renovate.json +73 -0
- package/files/src/AwesomeComponent.cy.ts +9 -0
- package/files/src/AwesomeComponent.vue +45 -0
- package/files/src/AwesomeComponentLogic.spec.ts +30 -0
- package/files/src/awesome-component-logic.ts +28 -0
- package/files/src/examples/DummyExample.vue +7 -0
- package/files/src/index.ts +1 -0
- package/files/src/local.scss +22 -0
- package/files/src/local.ts +22 -0
- package/files/src/selectors/index.ts +1 -0
- package/files/src/vite-dev/app.vue +15 -0
- package/files/tsconfig.cypress.json +16 -0
- package/files/tsconfig.json +16 -0
- package/files/tsconfig.lib.json +13 -0
- package/files/tsconfig.selectors.json +5 -0
- package/files/vite.config.mts +8 -0
- package/index.js +15 -0
- package/package.json +119 -6
- package/README.md +0 -45
|
File without changes
|
package/files/CODEOWNERS
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
buildRepo()
|
package/files/LICENSE.md
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Copyright 2026 Försäkringskassan
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
+
|
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/files/README.md
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# @forsakringskassan/vue-lib-template
|
|
2
|
+
|
|
3
|
+
En mall för hur ett komponentbibliotek fungerar.
|
|
4
|
+
|
|
5
|
+
## Dokumentation
|
|
6
|
+
|
|
7
|
+
Bygg och starta dokumentationen med:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm run build:docs
|
|
11
|
+
npm run start:docs
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Dokumentationen kan nås på http://localhost:8080.
|
|
15
|
+
|
|
16
|
+
Komponenter dokumenteras i `docs/components` katalogen.
|
|
17
|
+
Varje komponent ska ha en tillhörande Markdown fil (`.md`) med ett inledande Frontmatter-block:
|
|
18
|
+
|
|
19
|
+
```md
|
|
20
|
+
---
|
|
21
|
+
title: Fantastisk komponent
|
|
22
|
+
status: Draft
|
|
23
|
+
layout: component
|
|
24
|
+
component: AwesomeComponent
|
|
25
|
+
---
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Exempel infogas med en code fence:
|
|
29
|
+
|
|
30
|
+
````md
|
|
31
|
+
```import
|
|
32
|
+
${filename}
|
|
33
|
+
```
|
|
34
|
+
````
|
|
35
|
+
|
|
36
|
+
Vue API dokumentation för komponenter infogas med ett api block:
|
|
37
|
+
|
|
38
|
+
```md
|
|
39
|
+
::: api
|
|
40
|
+
vue:${component}
|
|
41
|
+
:::
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Dokumentationen genereras med [`@forsakringskassan/docs-generator`](https://forsakringskassan.github.io/docs-generator/latest/).
|
|
45
|
+
|
|
46
|
+
## Att dokumentera
|
|
47
|
+
|
|
48
|
+
- [ ] ingress
|
|
49
|
+
- [ ] quick start: de vanliga kommandon man behöver
|
|
50
|
+
- [ ] lintning och statisk kodanalys
|
|
51
|
+
- vilka verktyg körs och varför
|
|
52
|
+
- förklara html-validate och no-unknown-elements
|
|
53
|
+
- [ ] förklara varför vi använder api-extractor/värde | public internal | dts-fil
|
|
54
|
+
- [ ] förstå vad paketet levererar
|
|
55
|
+
- [ ] så här kör du cypress
|
|
56
|
+
- [ ] bundling och inte bundling, hur gör jag
|
|
57
|
+
- [ ] hur dokumenterar man komponenter?
|
|
58
|
+
- [x] hur bygger man dokumentationen?
|
|
59
|
+
- [x] hur startar man dokumentationen?
|
|
60
|
+
- [ ] checklista över vad som ska fungera
|
|
61
|
+
- importera static assets
|
|
62
|
+
- vscode: ska inte visa squiggly lines vid import av static assets
|
|
63
|
+
- vscode: ska inte visa squiggly lines vid cy.mount i komponenttest
|
|
64
|
+
|
|
65
|
+
## Att göra
|
|
66
|
+
|
|
67
|
+
- [x] börja med att kopiera alla rotfiler och cypresskatalog etc från designsystem (det vi inte fick med som körs från roten t ex lint osv)
|
|
68
|
+
- [x] docs
|
|
69
|
+
- [x] sandbox eller inte
|
|
70
|
+
- [ ] stylelint, även på sfc
|
|
71
|
+
- [x] levera css
|
|
72
|
+
- [ ] postcss med autoprefixer ska köras
|
|
73
|
+
- [x] trimma allowScripts (jättelåg prio)
|
|
74
|
+
- [x] semantic release för vanligt repo
|
|
75
|
+
- [ ] uppdatera .gitignore med app.vue
|
|
76
|
+
- [ ] pretest: att vara eller att inte vara, det är frågan
|
|
77
|
+
- [x] npm start
|
|
78
|
+
- [x] npm start AwesomeComponent
|
|
79
|
+
- [x] npm test
|
|
80
|
+
- [x] npm run build
|
|
81
|
+
- [x] npm run build:docs
|
|
82
|
+
- [x] npm run start:docs
|
|
83
|
+
- [ ] apimock
|
|
84
|
+
- [ ] bättre exempelkomponent
|
|
85
|
+
- [ ] bättre enhetstest
|
|
86
|
+
- [ ] bättre komponenttest
|
|
87
|
+
- [ ] live exempel
|
|
88
|
+
- [ ] skill för att skapa live exempel
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# EditorConfig documentation: http://EditorConfig.org
|
|
2
|
+
root = true
|
|
3
|
+
|
|
4
|
+
[*]
|
|
5
|
+
charset = utf-8
|
|
6
|
+
end_of_line = lf
|
|
7
|
+
|
|
8
|
+
[*.{html,ts,mts,cts,js,cjs,mjs,scss,json,vue}]
|
|
9
|
+
indent_style = space
|
|
10
|
+
indent_size = 4
|
|
11
|
+
trim_trailing_whitespace = true
|
|
12
|
+
insert_final_newline = true
|
|
13
|
+
|
|
14
|
+
[package{,-lock}.json]
|
|
15
|
+
indent_size = 2
|
|
16
|
+
|
|
17
|
+
[Jenkinsfile]
|
|
18
|
+
indent_style = space
|
|
19
|
+
indent_size = 4
|
|
20
|
+
trim_trailing_whitespace = true
|
|
21
|
+
insert_final_newline = true
|
package/files/_gitignore
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# vite dev
|
|
2
|
+
# /src/vite-dev/app.vue
|
|
3
|
+
*.tgz
|
|
4
|
+
node_modules/
|
|
5
|
+
|
|
6
|
+
# Build artifacts
|
|
7
|
+
.eslintcache
|
|
8
|
+
coverage/
|
|
9
|
+
dist/
|
|
10
|
+
public/
|
|
11
|
+
temp/
|
|
12
|
+
|
|
13
|
+
# Cypress output
|
|
14
|
+
cypress/screenshots/
|
|
15
|
+
test-results/
|
|
16
|
+
|
|
17
|
+
# Editor directories and files
|
|
18
|
+
.DS_Store
|
|
19
|
+
.idea
|
|
20
|
+
*.suo
|
|
21
|
+
*.ntvs*
|
|
22
|
+
*.njsproj
|
|
23
|
+
*.sln
|
|
24
|
+
*.sw?
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"root": true,
|
|
3
|
+
"extends": [
|
|
4
|
+
"@fkui/vue:recommended",
|
|
5
|
+
"html-validate:recommended",
|
|
6
|
+
"html-validate:prettier",
|
|
7
|
+
"html-validate-vue:recommended",
|
|
8
|
+
"@forsakringskassan/docs-live-example/htmlvalidate:recommended"
|
|
9
|
+
],
|
|
10
|
+
"plugins": [
|
|
11
|
+
"html-validate-vue",
|
|
12
|
+
"@fkui/vue/htmlvalidate",
|
|
13
|
+
"@forsakringskassan/docs-live-example/htmlvalidate"
|
|
14
|
+
],
|
|
15
|
+
"transform": {
|
|
16
|
+
"^.*\\.spec.ts$": "html-validate-vue:html",
|
|
17
|
+
"^.*\\.md$": "html-validate-markdown",
|
|
18
|
+
"^.*\\.md:html$": "html-validate-vue:html",
|
|
19
|
+
"^.*\\.vue$": "html-validate-vue"
|
|
20
|
+
},
|
|
21
|
+
"elements": ["html5"]
|
|
22
|
+
}
|
package/files/_npmrc
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# owned by tooling
|
|
2
|
+
package-lock.json
|
|
3
|
+
node_modules/
|
|
4
|
+
|
|
5
|
+
# generated files
|
|
6
|
+
CHANGELOG.md
|
|
7
|
+
*.api.md
|
|
8
|
+
|
|
9
|
+
# build artifacts
|
|
10
|
+
build/
|
|
11
|
+
coverage/
|
|
12
|
+
dist/
|
|
13
|
+
temp/
|
|
14
|
+
|
|
15
|
+
.DS_Store
|
|
16
|
+
|
|
17
|
+
# Log files
|
|
18
|
+
*.log
|
|
19
|
+
npm-debug.log*
|
|
20
|
+
yarn-debug.log*
|
|
21
|
+
yarn-error.log*
|
|
22
|
+
|
|
23
|
+
# Editor directories and files
|
|
24
|
+
.idea
|
|
25
|
+
*.suo
|
|
26
|
+
*.ntvs*
|
|
27
|
+
*.njsproj
|
|
28
|
+
*.sln
|
|
29
|
+
*.sw?
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/* This file was generated by @forsakringskassan/vite-lib-config. Changes may be overwritten! */
|
|
2
|
+
|
|
3
|
+
{
|
|
4
|
+
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
|
5
|
+
"extends": "@forsakringskassan/vite-lib-config/api-extractor/api-extractor.json",
|
|
6
|
+
"compiler": {
|
|
7
|
+
"tsconfigFilePath": "<projectFolder>/tsconfig.lib.json"
|
|
8
|
+
},
|
|
9
|
+
"apiReport": {
|
|
10
|
+
"reportFileName": "<unscopedPackageName>.api.md"
|
|
11
|
+
},
|
|
12
|
+
"docModel": {
|
|
13
|
+
"enabled": true
|
|
14
|
+
},
|
|
15
|
+
"dtsRollup": {
|
|
16
|
+
"publicTrimmedFilePath": "<projectFolder>/dist/types/index.d.ts"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/* This file was generated by @forsakringskassan/vite-lib-config. Changes may be overwritten! */
|
|
2
|
+
|
|
3
|
+
{
|
|
4
|
+
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
|
5
|
+
"extends": "@forsakringskassan/vite-lib-config/api-extractor/api-extractor.json",
|
|
6
|
+
"mainEntryPointFilePath": "<projectFolder>/temp/types/selectors/index.d.ts",
|
|
7
|
+
"compiler": {
|
|
8
|
+
"tsconfigFilePath": "<projectFolder>/tsconfig.selectors.json"
|
|
9
|
+
},
|
|
10
|
+
"apiReport": {
|
|
11
|
+
"reportFileName": "<unscopedPackageName>-selectors.api.md"
|
|
12
|
+
},
|
|
13
|
+
"dtsRollup": {
|
|
14
|
+
"publicTrimmedFilePath": "<projectFolder>/dist/types/selectors.d.ts"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/// <reference types="cypress" />
|
|
2
|
+
|
|
3
|
+
export type ForcedColorMode = "none" | "dark" | "light";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Custom Cypress command for testing with forced colors mode
|
|
7
|
+
* Forces the browser to use forced colors prefers-color-scheme media query
|
|
8
|
+
*/
|
|
9
|
+
Cypress.Commands.add("forcedColors", (mode: ForcedColorMode) => {
|
|
10
|
+
const cdpCommand = "Emulation.setEmulatedMedia";
|
|
11
|
+
const media = "forced-colors";
|
|
12
|
+
|
|
13
|
+
const features =
|
|
14
|
+
mode === "none"
|
|
15
|
+
? [{ name: media, value: "none" }]
|
|
16
|
+
: [
|
|
17
|
+
{ name: media, value: "active" },
|
|
18
|
+
{
|
|
19
|
+
name: "prefers-color-scheme",
|
|
20
|
+
value: mode,
|
|
21
|
+
},
|
|
22
|
+
];
|
|
23
|
+
|
|
24
|
+
cy.then(() => {
|
|
25
|
+
return Cypress.automation("remote:debugger:protocol", {
|
|
26
|
+
command: cdpCommand,
|
|
27
|
+
params: {
|
|
28
|
+
media,
|
|
29
|
+
features,
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
}).window();
|
|
33
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="cypress" />
|
|
2
|
+
|
|
3
|
+
import "@forsakringskassan/cypress-visual-regression/commands";
|
|
4
|
+
import "@forsakringskassan/cypress-axe/support";
|
|
5
|
+
import "cypress-html-validate/dist/commands";
|
|
6
|
+
import "./commands/forced-colors";
|
|
7
|
+
|
|
8
|
+
afterEach(() => {
|
|
9
|
+
cy.htmlvalidate();
|
|
10
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
|
6
|
+
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
|
|
7
|
+
<title>Components App</title>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div data-cy-root>
|
|
11
|
+
<div id="teleport"></div>
|
|
12
|
+
</div>
|
|
13
|
+
</body>
|
|
14
|
+
</html>
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { type App } from "vue";
|
|
2
|
+
import { mount } from "cypress/vue";
|
|
3
|
+
import { injectSpritesheet } from "@fkui/icon-lib-default/dist/f/injectSpritesheet";
|
|
4
|
+
import {
|
|
5
|
+
config,
|
|
6
|
+
setRunningContext,
|
|
7
|
+
FormatPlugin,
|
|
8
|
+
TestPlugin,
|
|
9
|
+
TranslationPlugin,
|
|
10
|
+
ValidationPlugin,
|
|
11
|
+
} from "@fkui/vue";
|
|
12
|
+
import "@fkui/theme-default";
|
|
13
|
+
import "./main.scss";
|
|
14
|
+
import "./common";
|
|
15
|
+
|
|
16
|
+
config.teleportTarget = "#teleport";
|
|
17
|
+
|
|
18
|
+
Cypress.Commands.add("mount", (component, options = {}) => {
|
|
19
|
+
// Setup options object
|
|
20
|
+
options.global ??= {};
|
|
21
|
+
options.global.plugins ??= [];
|
|
22
|
+
options.global.config ??= {};
|
|
23
|
+
options.global.config.compilerOptions ??= {};
|
|
24
|
+
options.global.config.compilerOptions.whitespace = "preserve";
|
|
25
|
+
|
|
26
|
+
/* Installing validationPlugin */
|
|
27
|
+
options.global.plugins.push({
|
|
28
|
+
install(app: App) {
|
|
29
|
+
app.use(FormatPlugin);
|
|
30
|
+
app.use(ValidationPlugin);
|
|
31
|
+
app.use(TestPlugin);
|
|
32
|
+
app.use(TranslationPlugin);
|
|
33
|
+
setRunningContext(app);
|
|
34
|
+
|
|
35
|
+
/* handle warnings as errors */
|
|
36
|
+
app.config.warnHandler = (msg, b, trace) => {
|
|
37
|
+
throw new Error(`Vue warning: ${msg}\n${trace}`);
|
|
38
|
+
};
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
return mount(component, options);
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
injectSpritesheet();
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": ["@fkui/tsconfig/recommended", "@fkui/tsconfig/cypress"],
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"rootDir": "..",
|
|
5
|
+
"types": [
|
|
6
|
+
"cypress",
|
|
7
|
+
"node",
|
|
8
|
+
"vite/client",
|
|
9
|
+
"cy-mount",
|
|
10
|
+
"cypress-html-validate/commands",
|
|
11
|
+
"@forsakringskassan/cypress-visual-regression/commands",
|
|
12
|
+
"forced-colors"
|
|
13
|
+
],
|
|
14
|
+
"typeRoots": ["../node_modules", "../node_modules/@types", "./types"],
|
|
15
|
+
"paths": {
|
|
16
|
+
"@forsakringskassan/vue-lib-template": ["./src/index.ts"]
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"include": ["**/*.ts"]
|
|
20
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/// <reference types="cypress" />
|
|
2
|
+
|
|
3
|
+
declare global {
|
|
4
|
+
namespace Cypress {
|
|
5
|
+
interface Chainable {
|
|
6
|
+
/**
|
|
7
|
+
* Forces the application to run in forced colors mode
|
|
8
|
+
* @param mode - "light" or "dark" color mode, "none" will disable the forced colors
|
|
9
|
+
* @example cy.forcedColors("dark")
|
|
10
|
+
*/
|
|
11
|
+
forcedColors(
|
|
12
|
+
mode: "none" | "dark" | "light",
|
|
13
|
+
): Cypress.Chainable<void>;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { defineConfig } from "cypress";
|
|
2
|
+
import exclude from "@fkui/vue/htmlvalidate/cypress";
|
|
3
|
+
import { init as installAxe } from "@forsakringskassan/cypress-axe/plugins";
|
|
4
|
+
import getToMatchScreenshotsPlugin from "@forsakringskassan/cypress-visual-regression/plugin";
|
|
5
|
+
import htmlvalidate, {
|
|
6
|
+
CypressHtmlValidateOptions,
|
|
7
|
+
} from "cypress-html-validate/plugin";
|
|
8
|
+
import { type ConfigData } from "html-validate";
|
|
9
|
+
|
|
10
|
+
function installPlugins(
|
|
11
|
+
on: Cypress.PluginEvents,
|
|
12
|
+
config: Cypress.PluginConfigOptions,
|
|
13
|
+
): Cypress.PluginConfigOptions {
|
|
14
|
+
getToMatchScreenshotsPlugin(on, config);
|
|
15
|
+
htmlvalidate.install(on, htmlValidateConfig, htmlValidateOptions);
|
|
16
|
+
config = installAxe(on, config, {
|
|
17
|
+
context: {
|
|
18
|
+
include: [
|
|
19
|
+
[".code-preview"],
|
|
20
|
+
["[data-preview]"],
|
|
21
|
+
["[data-cy-root]"],
|
|
22
|
+
],
|
|
23
|
+
exclude: [
|
|
24
|
+
[".calendar__item--selected"],
|
|
25
|
+
[".file-selector input"],
|
|
26
|
+
[".wizard-step__header__title"],
|
|
27
|
+
[".live-example__code"],
|
|
28
|
+
],
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
return config;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const htmlValidateConfig: ConfigData = {
|
|
35
|
+
rules: {
|
|
36
|
+
/* some examples show how to use custom heading levels which often
|
|
37
|
+
* doesn't match the heading outline for the documentation */
|
|
38
|
+
"heading-level": ["off"],
|
|
39
|
+
|
|
40
|
+
/* prevents mismatches from disabled rules which does not trigger errors
|
|
41
|
+
* when Cypress tests are running but would yield errors during normal
|
|
42
|
+
* validation */
|
|
43
|
+
"no-unused-disable": "off",
|
|
44
|
+
|
|
45
|
+
/* we cannot use native progressbar element due to SLA */
|
|
46
|
+
"prefer-native-element": [
|
|
47
|
+
"error",
|
|
48
|
+
{
|
|
49
|
+
exclude: ["progressbar"],
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
|
|
53
|
+
/* sadly we dont use SRI at FK */
|
|
54
|
+
"require-sri": "off",
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const htmlValidateOptions: CypressHtmlValidateOptions = {
|
|
59
|
+
include: [
|
|
60
|
+
/* Cypress component tests */
|
|
61
|
+
"#__cy_vue_root > div",
|
|
62
|
+
],
|
|
63
|
+
exclude,
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export default defineConfig({
|
|
67
|
+
allowCypressEnv: false,
|
|
68
|
+
// Cypress may sometimes restart tests when it detects a changed file in the __screenshot__ folder.
|
|
69
|
+
watchForFileChanges: false,
|
|
70
|
+
/* disable video recording, it is to slow both on remote machines and on
|
|
71
|
+
* CI/CD testing. */
|
|
72
|
+
video: false,
|
|
73
|
+
reporter: require.resolve("mocha-multi-reporters"),
|
|
74
|
+
reporterOptions: {
|
|
75
|
+
reporterEnabled: "spec, mocha-junit-reporter",
|
|
76
|
+
mochaJunitReporterReporterOptions: {
|
|
77
|
+
mochaFile: "test-results/cypress-test-output_[hash].xml",
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
component: {
|
|
81
|
+
setupNodeEvents(on, config) {
|
|
82
|
+
return installPlugins(on, config);
|
|
83
|
+
},
|
|
84
|
+
devServer: {
|
|
85
|
+
framework: "vue",
|
|
86
|
+
bundler: "vite",
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
defaultBrowser: "chrome",
|
|
90
|
+
hosts: { localhost: "127.0.0.1" },
|
|
91
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import {
|
|
3
|
+
Generator,
|
|
4
|
+
frontMatterFileReader,
|
|
5
|
+
vueFileReader,
|
|
6
|
+
} from "@forsakringskassan/docs-generator";
|
|
7
|
+
import pkg from "../package.json" with { type: "json" };
|
|
8
|
+
|
|
9
|
+
const docs = new Generator(import.meta.url, {
|
|
10
|
+
site: { name: pkg.name, lang: "sv" },
|
|
11
|
+
outputFolder: path.resolve(import.meta.dirname, "public"),
|
|
12
|
+
exampleFolders: [path.resolve(import.meta.dirname, "../src")],
|
|
13
|
+
setupPath: path.resolve(import.meta.dirname, "src/setup.ts"),
|
|
14
|
+
vendor: [
|
|
15
|
+
{ package: "vue", alias: "vue/dist/vue.esm-bundler.js" },
|
|
16
|
+
"@fkui/vue",
|
|
17
|
+
],
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
docs.compileStyle("main", "./src/main.scss", {
|
|
21
|
+
appendTo: "head",
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
await docs.build([
|
|
25
|
+
{
|
|
26
|
+
include: ["**/*.md"],
|
|
27
|
+
exclude: ["**/node_modules/**"],
|
|
28
|
+
fileReader: frontMatterFileReader,
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
include: ["../src/**/*.vue"],
|
|
32
|
+
fileReader: vueFileReader,
|
|
33
|
+
},
|
|
34
|
+
]);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Mäktig komponent
|
|
3
|
+
status: Draft
|
|
4
|
+
layout: component
|
|
5
|
+
component: AwesomeComponent
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
𝅘𝅥𝅮 Allting är så mäktigt 𝅘𝅥𝅮
|
|
9
|
+
|
|
10
|
+
```import
|
|
11
|
+
DummyExample.vue
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Tänk på att
|
|
15
|
+
|
|
16
|
+
- Detta är en exempel komponent.
|
|
17
|
+
- Den ska inte användas i produktion.
|
|
18
|
+
|
|
19
|
+
## Copy
|
|
20
|
+
|
|
21
|
+
- Använd tydlig och begriplig text.
|
|
22
|
+
|
|
23
|
+
## API
|
|
24
|
+
|
|
25
|
+
:::api
|
|
26
|
+
vue:AwesomeComponent
|
|
27
|
+
:::
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "docs",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"scripts": {
|
|
6
|
+
"build": "node build.mts",
|
|
7
|
+
"start": "http-server public"
|
|
8
|
+
},
|
|
9
|
+
"devDependencies": {
|
|
10
|
+
"@fkui/vue": "6.54.0",
|
|
11
|
+
"@forsakringskassan/docs-generator": "3.6.1",
|
|
12
|
+
"@tsconfig/node24": "24.0.5",
|
|
13
|
+
"@tsconfig/recommended": "1.0.13",
|
|
14
|
+
"http-server": "14.1.1",
|
|
15
|
+
"vue": "3.5.41"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@use "@forsakringskassan/docs-generator/style.css";
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { createApp, h } from "vue";
|
|
2
|
+
import {
|
|
3
|
+
ErrorPlugin,
|
|
4
|
+
FErrorHandlingApp,
|
|
5
|
+
FormatPlugin,
|
|
6
|
+
TestPlugin,
|
|
7
|
+
TranslationPlugin,
|
|
8
|
+
ValidationPlugin,
|
|
9
|
+
setRunningContext,
|
|
10
|
+
} from "@fkui/vue";
|
|
11
|
+
import { type SetupOptions } from "@forsakringskassan/docs-generator";
|
|
12
|
+
|
|
13
|
+
export function setup(options: SetupOptions): void {
|
|
14
|
+
const { rootComponent, selector } = options;
|
|
15
|
+
const app = createApp({
|
|
16
|
+
render() {
|
|
17
|
+
return h(FErrorHandlingApp, { defaultComponent: rootComponent });
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
setRunningContext(app);
|
|
21
|
+
app.use(ErrorPlugin, {
|
|
22
|
+
captureWarnings: true,
|
|
23
|
+
logToConsole: true,
|
|
24
|
+
});
|
|
25
|
+
app.use(ValidationPlugin);
|
|
26
|
+
app.use(TestPlugin);
|
|
27
|
+
app.use(TranslationPlugin);
|
|
28
|
+
app.use(FormatPlugin);
|
|
29
|
+
app.mount(selector);
|
|
30
|
+
}
|