@forsakringskassan/vue-lib-template 1.4.0 → 1.5.1

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/CODEOWNERS CHANGED
@@ -3,7 +3,7 @@
3
3
  # Each line is a file pattern followed by one or more owners.
4
4
 
5
5
  # Global owner for the whole repository
6
- # * @username-or-team
6
+ #* @username-or-team
7
7
 
8
8
  # Example folder-specific owner
9
- # /docs/ @org/doc-team
9
+ #/docs/ @org/doc-team
@@ -61,12 +61,12 @@ docs.compileStyle("lib", styleUrl, {
61
61
  appendTo: "head",
62
62
  });
63
63
 
64
- docs.compileScript("mocks", "./src/bundle-mocks.mjs", {
65
- appendTo: "head",
64
+ docs.compileScript("#apimock", "./src/bundle-mocks.ts", {
65
+ appendTo: "none",
66
66
  });
67
67
 
68
68
  const mswUrl = new URL(import.meta.resolve("msw/mockServiceWorker.js"));
69
- docs.compileWorker("mock-service-worker", mswUrl);
69
+ docs.compileWorker("#mock-service-worker", mswUrl);
70
70
 
71
71
  await docs.build([
72
72
  {
@@ -0,0 +1,4 @@
1
+ ---
2
+ title: Komponenter
3
+ layout: article
4
+ ---
@@ -0,0 +1,28 @@
1
+ ---
2
+ title: Kattinformation
3
+ status: Draft
4
+ layout: component
5
+ component: FcCatInfoComponent
6
+ ---
7
+
8
+ Komponenten kan visa kattdata i visningsläge eller i ett redigerbart läge.
9
+ Den hämtar kattdata från ett mockat backend.
10
+
11
+ ```import live-example
12
+ FcCatInfoComponentLiveExample.vue
13
+ ```
14
+
15
+ ## Tänk på att
16
+
17
+ - Detta är en exempelkomponent.
18
+ - Den ska inte användas i produktion.
19
+
20
+ ## Copy
21
+
22
+ - Använd tydlig och begriplig text.
23
+
24
+ ## API
25
+
26
+ ::: api
27
+ vue:FcCatInfoComponent
28
+ :::
@@ -1,29 +1,4 @@
1
1
  ---
2
- title: Kattinformation
3
- status: Draft
4
- layout: component
5
- component: FcCatInfoComponent
6
- visible: false
2
+ title: Guide
3
+ layout: article
7
4
  ---
8
-
9
- Komponenten kan visa kattdata i visningsläge eller i ett redigerbart läge.
10
- Den hämtar kattdata från ett mockat backend.
11
-
12
- ```import live-example
13
- FcCatInfoComponentLiveExample.vue
14
- ```
15
-
16
- ## Tänk på att
17
-
18
- - Detta är en exempelkomponent.
19
- - Den ska inte användas i produktion.
20
-
21
- ## Copy
22
-
23
- - Använd tydlig och begriplig text.
24
-
25
- ## API
26
-
27
- ::: api
28
- vue:FcCatInfoComponent
29
- :::
@@ -2,6 +2,9 @@
2
2
  "name": "docs",
3
3
  "version": "0.0.0",
4
4
  "private": true,
5
+ "imports": {
6
+ "#apimock": "./src/bundle-mocks.ts"
7
+ },
5
8
  "scripts": {
6
9
  "build": "node build.mts",
7
10
  "start": "http-server public"
@@ -9,8 +12,8 @@
9
12
  "devDependencies": {
10
13
  "@fkui/icon-lib-default": "6.59.0",
11
14
  "@fkui/vue": "6.59.0",
12
- "@forsakringskassan/apimock-express": "4.1.0",
13
- "@forsakringskassan/docs-generator": "3.12.0",
15
+ "@forsakringskassan/apimock-express": "4.2.1",
16
+ "@forsakringskassan/docs-generator": "3.12.1",
14
17
  "@tsconfig/node24": "24.0.5",
15
18
  "@tsconfig/recommended": "1.0.13",
16
19
  "http-server": "14.1.1",
@@ -0,0 +1,10 @@
1
+ import { setupWorker } from "@forsakringskassan/apimock-express/browser";
2
+ import mocks from "../../src/mocks/index.mjs";
3
+
4
+ /* this is resolved from the importmap (mapped to the bundle with the same name
5
+ * compiled in `docs/build.mts`) */
6
+ const workerUrl = import.meta.resolve("#mock-service-worker");
7
+
8
+ export const apimockReady = setupWorker(workerUrl, mocks, {
9
+ type: "module",
10
+ });
@@ -10,18 +10,22 @@ import {
10
10
  } from "@fkui/vue";
11
11
  import { type SetupOptions } from "@forsakringskassan/docs-generator";
12
12
 
13
+ /* this is resolved from the importmap (mapped to the bundle with the same name
14
+ * compiled in `docs/build.mts`) */
15
+ import { apimockReady } from "#apimock";
16
+
13
17
  export async function setup(options: SetupOptions): Promise<void> {
14
18
  const { rootComponent, selector } = options;
15
19
 
16
- // Set in bundle-mocks.mjs, wait on mock service worker to be ready.
17
- if (window.bundleMocks) {
18
- await window.bundleMocks;
19
- }
20
+ /* wait for apimock to be ready before we mount the example */
21
+ await apimockReady;
22
+
20
23
  const app = createApp({
21
24
  render() {
22
25
  return h(FErrorHandlingApp, { defaultComponent: rootComponent });
23
26
  },
24
27
  });
28
+
25
29
  setRunningContext(app);
26
30
  app.use(ErrorPlugin, {
27
31
  captureWarnings: true,
@@ -3,6 +3,10 @@
3
3
  {
4
4
  "extends": ["@tsconfig/recommended", "@tsconfig/node24"],
5
5
  "compilerOptions": {
6
+ "noEmit": true,
7
+ "target": "esnext",
8
+ "module": "esnext",
9
+ "moduleResolution": "bundler",
6
10
  "lib": ["DOM", "DOM.Iterable", "ESNext"],
7
11
  "types": ["node"]
8
12
  },
@@ -94,11 +94,11 @@
94
94
  "@fkui/test-utils": "6.59.0",
95
95
  "@fkui/theme-default": "6.59.0",
96
96
  "@fkui/vue": "6.59.0",
97
- "@forsakringskassan/apimock-express": "4.1.0",
97
+ "@forsakringskassan/apimock-express": "4.2.1",
98
98
  "@forsakringskassan/commitlint-config": "4.2.8",
99
99
  "@forsakringskassan/cypress-config": "1.10.0",
100
100
  "@forsakringskassan/cypress-visual-regression": "5.2.0",
101
- "@forsakringskassan/docs-generator": "3.12.0",
101
+ "@forsakringskassan/docs-generator": "3.12.1",
102
102
  "@forsakringskassan/docs-live-example": "3.0.2",
103
103
  "@forsakringskassan/eslint-config": "15.11.0",
104
104
  "@forsakringskassan/eslint-config-cli": "15.11.0",
@@ -112,13 +112,13 @@
112
112
  "@forsakringskassan/stylelint-config": "3.5.0",
113
113
  "@forsakringskassan/vite-lib-config": "5.12.4",
114
114
  "@forsakringskassan/vitest-config-jsdom": "5.0.0",
115
- "@forsakringskassan/vue-lib-template": "1.4.0",
115
+ "@forsakringskassan/vue-lib-template": "1.5.1",
116
116
  "@html-validate/release-scripts": "7.6.12",
117
117
  "@types/node": "24.13.6",
118
118
  "@typescript/native": "npm:typescript@7.0.2",
119
119
  "@vue/server-renderer": "3.5.43",
120
120
  "@vue/test-utils": "2.5.1",
121
- "cloneman": "1.25.0",
121
+ "cloneman": "1.25.1",
122
122
  "core-js": "3.50.0",
123
123
  "cypress": "16.1.0",
124
124
  "html-validate": "11.16.0",
package/hooks/install.mjs CHANGED
@@ -1,5 +1,15 @@
1
1
 
2
2
 
3
+ async function enableDeployDocs(context ) {
4
+ const { getParameter, replaceInFile } = context;
5
+ const url = getParameter("docs-repo-url");
6
+ if (url === "") {
7
+ return;
8
+ }
9
+ await replaceInFile("Jenkinsfile", /deploy:/, "false", "true");
10
+ await replaceInFile("Jenkinsfile", /repositoryUrl:/, "null", `"${url}"`);
11
+ }
12
+
3
13
  export async function install(context ) {
4
14
  const { getApplicationName, replaceInFile } = context;
5
15
  const scopedName = getApplicationName();
@@ -13,4 +23,7 @@ export async function install(context ) {
13
23
  await replaceInFile("tsconfig.lib.json", placeholder, quotedName);
14
24
  await replaceInFile("tsconfig.cypress.json", placeholder, quotedName);
15
25
  await replaceInFile("tsconfig.selectors.json", placeholder, quotedName);
26
+
27
+ /* enable deployment of documentation if a documentation url is provided */
28
+ await enableDeployDocs(context);
16
29
  }
package/index.js CHANGED
@@ -7,7 +7,7 @@
7
7
 
8
8
  const options = {
9
9
  ...packageJson.cloneman,
10
- fileHash: "06d2b6a7e26a9d5b9df47375fe9fc0d856d30afd18da47362ccf24b6fa6c1468",
10
+ fileHash: "509a23e5489100d974625d2197bd7e65aee36d3ce87686a907623db845674b81",
11
11
  filesDir: path.join(import.meta.dirname, "files"),
12
12
  hooksDir: path.join(import.meta.dirname, "hooks"),
13
13
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forsakringskassan/vue-lib-template",
3
- "version": "1.4.0",
3
+ "version": "1.5.1",
4
4
  "description": "Vue library template based on Cloneman",
5
5
  "keywords": [
6
6
  "template",
@@ -46,10 +46,12 @@
46
46
  "cypress/tsconfig.json",
47
47
  "cypress/types/mocha.d.ts",
48
48
  "docs/build.mts",
49
+ "docs/components/index.md",
50
+ "docs/guide/cat-info.md",
49
51
  "docs/guide/index.md",
50
52
  "docs/index.md",
51
53
  "docs/package.json",
52
- "docs/src/bundle-mocks.mjs",
54
+ "docs/src/bundle-mocks.ts",
53
55
  "docs/src/global.d.ts",
54
56
  "docs/src/main.js",
55
57
  "docs/src/main.scss",
@@ -127,7 +129,7 @@
127
129
  "cypress/types/mocha.d.ts",
128
130
  "docs/build.mts",
129
131
  "docs/package.json",
130
- "docs/src/bundle-mocks.mjs",
132
+ "docs/src/bundle-mocks.ts",
131
133
  "docs/src/global.d.ts",
132
134
  "docs/src/main.js",
133
135
  "docs/src/main.scss",
@@ -165,6 +167,7 @@
165
167
  "cypress/types/forced-colors.d.ts",
166
168
  "etc/vue-lib-template-selectors.api.md",
167
169
  "etc/vue-lib-template.api.md",
170
+ "docs/src/bundle-mocks.mjs",
168
171
  "docs/components/AwesomeComponent.md",
169
172
  "src/examples/DummyExample.vue",
170
173
  "src/AwesomeComponent.cy.ts",
@@ -182,6 +185,16 @@
182
185
  "!@fkui/tsconfig",
183
186
  "@forsakringskassan/*-api",
184
187
  "fk-icons"
188
+ ],
189
+ "parameters": [
190
+ {
191
+ "key": "docs-repo-url",
192
+ "description": "URL to repository to deploy documentation to",
193
+ "help": "Format: ssh://user@host/project/repo.git",
194
+ "required": false,
195
+ "defaultValue": "",
196
+ "pattern": "ssh://.*.git"
197
+ }
185
198
  ]
186
199
  }
187
200
  }
@@ -1,23 +0,0 @@
1
- import { matchRequest } from "@forsakringskassan/apimock-express/browser";
2
- import { http } from "msw";
3
- import { setupWorker } from "msw/browser";
4
- import mocks from "../../src/mocks/index.mts";
5
-
6
- const handlers = [
7
- http.all("/api/*", async (req) => {
8
- return await matchRequest(mocks, req.request);
9
- }),
10
- ];
11
- const worker = setupWorker(...handlers);
12
- // eslint-disable-next-line no-undef -- technical debt
13
- const rootUrl = document.documentElement.dataset["rootUrl"];
14
- const url = `${rootUrl}/mock-service-worker.js`;
15
-
16
- // Used in setup.ts
17
- // eslint-disable-next-line unicorn/no-global-object-property-assignment, no-undef -- technical debt
18
- window.bundleMocks = worker.start({
19
- serviceWorker: {
20
- url,
21
- options: { type: "module" },
22
- },
23
- });