@forsakringskassan/vue-lib-template 1.3.0 → 1.5.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/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
@@ -6,6 +6,7 @@
6
6
 
7
7
  @use "@fkui/design/src/fonts";
8
8
  @use "@fkui/design/src/fkui";
9
+ @use "../../src/theme";
9
10
 
10
11
  :root {
11
12
  --f-logo-image-small: hotpink;
@@ -1,8 +1,8 @@
1
1
  /* This file is managed by @forsakringskassan/vue-lib-template. Changes will be overwritten! */
2
2
 
3
3
  import path from "node:path";
4
- import { fileURLToPath } from "node:url";
5
4
  import {
5
+ type Processor,
6
6
  Generator,
7
7
  extractMarkdownProcessor,
8
8
  frontMatterFileReader,
@@ -11,11 +11,24 @@ import {
11
11
  } from "@forsakringskassan/docs-generator";
12
12
  import pkg from "../package.json" with { type: "json" };
13
13
 
14
+ function teleportTarget(): Processor {
15
+ return {
16
+ after: "generate-docs",
17
+ name: "fkui:teleport",
18
+ async handler(context) {
19
+ context.addTemplateBlock("body:end", "teleport-target", {
20
+ filename: "partials/teleport.html",
21
+ });
22
+ },
23
+ };
24
+ }
25
+
14
26
  const docs = new Generator(import.meta.url, {
15
27
  site: { name: pkg.name, lang: "sv" },
16
28
  outputFolder: path.resolve(import.meta.dirname, "public"),
17
29
  exampleFolders: [path.resolve(import.meta.dirname, "../src")],
18
30
  setupPath: path.resolve(import.meta.dirname, "src/setup.ts"),
31
+ templateFolders: ["./templates"],
19
32
  vendor: [
20
33
  { package: "vue", alias: "vue/dist/vue.esm-bundler.js" },
21
34
  {
@@ -31,6 +44,7 @@ const docs = new Generator(import.meta.url, {
31
44
  outputFolder: path.join(import.meta.dirname, "../dist/docs"),
32
45
  }),
33
46
  manifestProcessor(),
47
+ teleportTarget(),
34
48
  ],
35
49
  });
36
50
 
@@ -42,19 +56,17 @@ docs.compileStyle("main", "./src/main.scss", {
42
56
  appendTo: "head",
43
57
  });
44
58
 
45
- const styleUrl = import.meta.resolve(`../dist/esm/style.css`);
46
- const stylePath = fileURLToPath(styleUrl); // workaround for https://github.com/Forsakringskassan/docs-generator/issues/499
47
- docs.compileStyle("lib", stylePath, {
59
+ const styleUrl = new URL(import.meta.resolve(`../dist/esm/style.css`));
60
+ docs.compileStyle("lib", styleUrl, {
48
61
  appendTo: "head",
49
62
  });
50
63
 
51
- docs.compileScript("mocks", "./src/bundle-mocks.mjs", {
52
- appendTo: "head",
64
+ docs.compileScript("#apimock", "./src/bundle-mocks.ts", {
65
+ appendTo: "none",
53
66
  });
54
67
 
55
- const mswUrl = import.meta.resolve("msw/mockServiceWorker.js");
56
- const mswPath = fileURLToPath(mswUrl); // workaround for https://github.com/Forsakringskassan/docs-generator/issues/499
57
- docs.compileWorker("msw", mswPath);
68
+ const mswUrl = new URL(import.meta.resolve("msw/mockServiceWorker.js"));
69
+ docs.compileWorker("#mock-service-worker", mswUrl);
58
70
 
59
71
  await docs.build([
60
72
  {
@@ -2,15 +2,18 @@
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"
8
11
  },
9
12
  "devDependencies": {
10
- "@fkui/icon-lib-default": "6.58.0",
11
- "@fkui/vue": "6.58.0",
12
- "@forsakringskassan/apimock-express": "4.1.0",
13
- "@forsakringskassan/docs-generator": "3.11.1",
13
+ "@fkui/icon-lib-default": "6.59.0",
14
+ "@fkui/vue": "6.59.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
+ });
@@ -1,20 +1,8 @@
1
1
  @use "@forsakringskassan/docs-generator/style.css";
2
- @use "@fkui/theme-default" as theme with (
3
- $global: false
4
- );
5
- @use "@fkui/font-default" as font with (
6
- $global: false
7
- );
8
2
  @use "@fkui/design";
9
3
  @use "@fkui/design/lib/fonts.css";
10
4
  @use "@forsakringskassan/docs-live-example";
11
-
12
- @include font.font-face;
13
-
14
- :root {
15
- @include theme.auto;
16
- @include font.font-family;
17
- }
5
+ @use "../../src/theme";
18
6
 
19
7
  html,
20
8
  body {
@@ -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,
@@ -0,0 +1 @@
1
+ <div id="teleport-target" class="user-theme"></div>
@@ -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
  },
@@ -87,38 +87,38 @@
87
87
  "devDependencies": {
88
88
  "@babel/core": "7.29.7",
89
89
  "@babel/preset-env": "7.29.7",
90
- "@fkui/design": "6.58.0",
91
- "@fkui/font-default": "6.58.0",
92
- "@fkui/icon-lib-default": "6.58.0",
93
- "@fkui/logic": "6.58.0",
94
- "@fkui/test-utils": "6.58.0",
95
- "@fkui/theme-default": "6.58.0",
96
- "@fkui/vue": "6.58.0",
97
- "@forsakringskassan/apimock-express": "4.1.0",
90
+ "@fkui/design": "6.59.0",
91
+ "@fkui/font-default": "6.59.0",
92
+ "@fkui/icon-lib-default": "6.59.0",
93
+ "@fkui/logic": "6.59.0",
94
+ "@fkui/test-utils": "6.59.0",
95
+ "@fkui/theme-default": "6.59.0",
96
+ "@fkui/vue": "6.59.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.11.1",
101
+ "@forsakringskassan/docs-generator": "3.12.1",
102
102
  "@forsakringskassan/docs-live-example": "3.0.2",
103
- "@forsakringskassan/eslint-config": "15.10.0",
104
- "@forsakringskassan/eslint-config-cli": "15.10.0",
105
- "@forsakringskassan/eslint-config-cypress": "15.10.0",
106
- "@forsakringskassan/eslint-config-jest": "15.10.0",
107
- "@forsakringskassan/eslint-config-typescript": "15.10.0",
108
- "@forsakringskassan/eslint-config-typescript-typeinfo": "15.10.0",
109
- "@forsakringskassan/eslint-config-vitest": "15.10.0",
110
- "@forsakringskassan/eslint-config-vue": "15.10.0",
103
+ "@forsakringskassan/eslint-config": "15.11.0",
104
+ "@forsakringskassan/eslint-config-cli": "15.11.0",
105
+ "@forsakringskassan/eslint-config-cypress": "15.11.0",
106
+ "@forsakringskassan/eslint-config-jest": "15.11.0",
107
+ "@forsakringskassan/eslint-config-typescript": "15.11.0",
108
+ "@forsakringskassan/eslint-config-typescript-typeinfo": "15.11.0",
109
+ "@forsakringskassan/eslint-config-vitest": "15.11.0",
110
+ "@forsakringskassan/eslint-config-vue": "15.11.0",
111
111
  "@forsakringskassan/prettier-config": "3.7.10",
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.3.0",
115
+ "@forsakringskassan/vue-lib-template": "1.5.0",
116
116
  "@html-validate/release-scripts": "7.6.12",
117
- "@types/node": "24.13.5",
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.24.1",
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",
@@ -1,19 +1,7 @@
1
- @use "@fkui/theme-default" as theme with (
2
- $global: false
3
- );
4
- @use "@fkui/font-default" as font with (
5
- $global: false
6
- );
7
1
  @use "@fkui/design";
8
2
  @use "@fkui/design/lib/fonts.css";
9
3
  @use "@forsakringskassan/docs-live-example";
10
-
11
- @include font.font-face;
12
-
13
- :root {
14
- @include theme.auto;
15
- @include font.font-family;
16
- }
4
+ @use "theme";
17
5
 
18
6
  html,
19
7
  body {
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Theme selection.
3
+ *
4
+ * This file can be customized to set theme and related features for:
5
+ *
6
+ * - Local builds (`npm start`)
7
+ * - Cypress component tests
8
+ * - Documentation
9
+ *
10
+ * It is not included in the production build.
11
+ *
12
+ * --- This notice must be kept ---
13
+ */
14
+
15
+ @use "@fkui/theme-default" as theme with (
16
+ $global: false
17
+ );
18
+
19
+ @use "@fkui/font-default" as font with (
20
+ $global: false
21
+ );
22
+
23
+ @include font.font-face;
24
+
25
+ :root {
26
+ @include theme.auto;
27
+ @include font.font-family;
28
+ }
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: "3ed96f7ccd01c366c430cf3081cbf47d160888c6d793dc177709a483b78000f9",
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.3.0",
3
+ "version": "1.5.0",
4
4
  "description": "Vue library template based on Cloneman",
5
5
  "keywords": [
6
6
  "template",
@@ -49,11 +49,12 @@
49
49
  "docs/guide/index.md",
50
50
  "docs/index.md",
51
51
  "docs/package.json",
52
- "docs/src/bundle-mocks.mjs",
52
+ "docs/src/bundle-mocks.ts",
53
53
  "docs/src/global.d.ts",
54
54
  "docs/src/main.js",
55
55
  "docs/src/main.scss",
56
56
  "docs/src/setup.ts",
57
+ "docs/templates/partials/teleport.html",
57
58
  "docs/tsconfig.json",
58
59
  "eslint.config.mjs",
59
60
  "etc/lib.api.md",
@@ -96,6 +97,7 @@
96
97
  "src/selectors/guide/index.ts",
97
98
  "src/selectors/index.ts",
98
99
  "src/style.scss",
100
+ "src/theme.scss",
99
101
  "src/vite-dev/app.vue",
100
102
  "tsconfig.cypress.json",
101
103
  "tsconfig.json",
@@ -125,7 +127,7 @@
125
127
  "cypress/types/mocha.d.ts",
126
128
  "docs/build.mts",
127
129
  "docs/package.json",
128
- "docs/src/bundle-mocks.mjs",
130
+ "docs/src/bundle-mocks.ts",
129
131
  "docs/src/global.d.ts",
130
132
  "docs/src/main.js",
131
133
  "docs/src/main.scss",
@@ -142,6 +144,14 @@
142
144
  "tsconfig.selectors.json",
143
145
  "vite.config.mts"
144
146
  ],
147
+ "partiallyManagedFiles": [
148
+ {
149
+ "filename": "src/theme.scss",
150
+ "include": {
151
+ "above": "--- This notice must be kept ---"
152
+ }
153
+ }
154
+ ],
145
155
  "removeFiles": [
146
156
  "api-extractor.json",
147
157
  "index.html",
@@ -155,6 +165,7 @@
155
165
  "cypress/types/forced-colors.d.ts",
156
166
  "etc/vue-lib-template-selectors.api.md",
157
167
  "etc/vue-lib-template.api.md",
168
+ "docs/src/bundle-mocks.mjs",
158
169
  "docs/components/AwesomeComponent.md",
159
170
  "src/examples/DummyExample.vue",
160
171
  "src/AwesomeComponent.cy.ts",
@@ -172,6 +183,16 @@
172
183
  "!@fkui/tsconfig",
173
184
  "@forsakringskassan/*-api",
174
185
  "fk-icons"
186
+ ],
187
+ "parameters": [
188
+ {
189
+ "key": "docs-repo-url",
190
+ "description": "URL to repository to deploy documentation to",
191
+ "help": "Format: ssh://user@host/project/repo.git",
192
+ "required": false,
193
+ "defaultValue": "",
194
+ "pattern": "ssh://.*.git"
195
+ }
175
196
  ]
176
197
  }
177
198
  }
@@ -1,22 +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}/msw.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
- },
22
- });