@forsakringskassan/vue-lib-template 1.1.0 → 1.2.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.
Files changed (57) hide show
  1. package/files/Jenkinsfile +2 -0
  2. package/files/_editorconfig +3 -0
  3. package/files/_gitignore +3 -0
  4. package/files/_htmlvalidateignore +3 -0
  5. package/files/_prettierignore +4 -1
  6. package/files/api-extractor.lib.json +1 -1
  7. package/files/api-extractor.selectors.json +1 -1
  8. package/files/babel.config.js +2 -0
  9. package/files/cypress/support/common.ts +7 -6
  10. package/files/cypress/support/component.ts +5 -25
  11. package/files/cypress/support/main.scss +2 -0
  12. package/files/cypress/tsconfig.json +3 -3
  13. package/files/cypress.config.ts +14 -76
  14. package/files/docs/build.mts +2 -0
  15. package/files/docs/{kattinformation → guide}/index.md +1 -0
  16. package/files/docs/package.json +1 -1
  17. package/files/docs/src/bundle-mocks.mjs +1 -1
  18. package/files/docs/tsconfig.json +2 -0
  19. package/files/eslint.config.mjs +2 -0
  20. package/files/package.json +12 -14
  21. package/files/renovate.json +1 -3
  22. package/files/src/{FcCatInfoComponent.cy.ts → components/guide/FcCatInfo/FcCatInfoComponent.cy.ts} +1 -1
  23. package/files/src/{FcCatInfoComponent.vue → components/guide/FcCatInfo/FcCatInfoComponent.vue} +2 -2
  24. package/files/src/{FcCatInfoComponentLiveExample.vue → components/guide/FcCatInfo/examples/FcCatInfoComponentLiveExample.vue} +5 -3
  25. package/files/src/components/guide/FcCatInfo/index.ts +1 -0
  26. package/files/src/components/guide/README.md +7 -0
  27. package/files/src/components/guide/index.ts +1 -0
  28. package/files/src/components/index.ts +1 -0
  29. package/files/src/index.ts +1 -1
  30. package/files/src/{cat-api-mock.spec.ts → mocks/guide/cat-api-mock.spec.ts} +5 -7
  31. package/files/src/{cat-api.mock.mts → mocks/guide/cat-api.mock.mts} +2 -2
  32. package/files/src/mocks/index.mts +1 -0
  33. package/files/src/selectors/guide/index.ts +1 -0
  34. package/files/src/selectors/index.ts +1 -1
  35. package/files/tsconfig.cypress.json +1 -1
  36. package/files/tsconfig.json +1 -1
  37. package/files/tsconfig.lib.json +2 -8
  38. package/files/tsconfig.selectors.json +1 -1
  39. package/files/vite.config.mts +2 -2
  40. package/hooks/install.mjs +9 -1
  41. package/index.js +1 -1
  42. package/package.json +24 -26
  43. package/files/cypress/support/commands/forced-colors.ts +0 -33
  44. package/files/cypress/support/component-index.html +0 -14
  45. package/files/cypress/types/cy-mount.d.ts +0 -9
  46. package/files/cypress/types/forced-colors.d.ts +0 -18
  47. /package/files/src/{CatInfoEdit.vue → components/guide/FcCatInfo/CatInfoEdit.vue} +0 -0
  48. /package/files/src/{CatInfoShow.vue → components/guide/FcCatInfo/CatInfoShow.vue} +0 -0
  49. /package/files/src/{cat-api.spec.ts → components/guide/FcCatInfo/cat-api.spec.ts} +0 -0
  50. /package/files/src/{cat-api.ts → components/guide/FcCatInfo/cat-api.ts} +0 -0
  51. /package/files/src/{cat-data.ts → components/guide/FcCatInfo/cat-data.ts} +0 -0
  52. /package/files/src/{CatInfoLogic.spec.ts → components/guide/FcCatInfo/cat-info-logic.spec.ts} +0 -0
  53. /package/files/src/{cat-info-logic.ts → components/guide/FcCatInfo/cat-info-logic.ts} +0 -0
  54. /package/files/src/{cat-types.ts → components/guide/FcCatInfo/cat-types.ts} +0 -0
  55. /package/files/src/{examples/CatInfoExample.vue → components/guide/FcCatInfo/examples/FcCatInfoComponentExample.vue} +0 -0
  56. /package/files/src/{mocks.mts → mocks/guide/index.mts} +0 -0
  57. /package/files/src/selectors/{FcCatInfoComponent.selectors.ts → guide/FcCatInfoComponent.selectors.ts} +0 -0
package/files/Jenkinsfile CHANGED
@@ -1,3 +1,5 @@
1
+ /* This file is managed by @forsakringskassan/vue-lib-template. Changes will be overwritten! */
2
+
1
3
  buildRepo([
2
4
  nodejs: [
3
5
  docs: [
@@ -1,3 +1,6 @@
1
+ # This file is managed by @forsakringskassan/vue-lib-template.
2
+ # Changes will be overwritten!
3
+
1
4
  # EditorConfig documentation: http://EditorConfig.org
2
5
  root = true
3
6
 
package/files/_gitignore CHANGED
@@ -1,3 +1,6 @@
1
+ # This file is managed by @forsakringskassan/vue-lib-template.
2
+ # Changes will be overwritten!
3
+
1
4
  # vite dev
2
5
  # /src/vite-dev/app.vue
3
6
  *.tgz
@@ -1,3 +1,6 @@
1
+ # This file is managed by @forsakringskassan/vue-lib-template.
2
+ # Changes will be overwritten!
3
+
1
4
  # generated files
2
5
  docs/public/
3
6
  docs/node_modules/
@@ -1,3 +1,6 @@
1
+ # This file is managed by @forsakringskassan/vue-lib-template.
2
+ # Changes will be overwritten!
3
+
1
4
  # owned by tooling
2
5
  package-lock.json
3
6
  node_modules/
@@ -26,4 +29,4 @@ yarn-error.log*
26
29
  *.ntvs*
27
30
  *.njsproj
28
31
  *.sln
29
- *.sw?
32
+ *.sw?
@@ -1,4 +1,4 @@
1
- /* This file was generated by @forsakringskassan/vite-lib-config. Changes may be overwritten! */
1
+ /* This file is managed by @forsakringskassan/vue-lib-template. Changes will be overwritten! */
2
2
 
3
3
  {
4
4
  "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
@@ -1,4 +1,4 @@
1
- /* This file was generated by @forsakringskassan/vite-lib-config. Changes may be overwritten! */
1
+ /* This file is managed by @forsakringskassan/vue-lib-template. Changes will be overwritten! */
2
2
 
3
3
  {
4
4
  "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
@@ -1,3 +1,5 @@
1
+ /* This file is managed by @forsakringskassan/vue-lib-template. Changes will be overwritten! */
2
+
1
3
  module.exports = {
2
4
  presets: ["@forsakringskassan/vite-lib-config/babel"],
3
5
  };
@@ -1,10 +1,11 @@
1
- /// <reference types="cypress" />
1
+ /* This file is managed by @forsakringskassan/vue-lib-template. Changes will be overwritten! */
2
2
 
3
+ import { configure } from "@forsakringskassan/cypress-config/support";
3
4
  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
5
 
8
- afterEach(() => {
9
- cy.htmlvalidate();
6
+ await configure({
7
+ resetEmulatedMedia: true,
8
+ afterEach: {
9
+ htmlvalidate: true,
10
+ },
10
11
  });
@@ -1,38 +1,18 @@
1
- import { type App } from "vue";
2
- import { mount } from "cypress/vue";
1
+ /* This file is managed by @forsakringskassan/vue-lib-template. Changes will be overwritten! */
2
+
3
+ import { mount } from "@forsakringskassan/cypress-config/support";
3
4
  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
5
  import "@fkui/theme-default";
13
6
  import "./main.scss";
14
7
  import "./common";
15
8
 
16
- config.teleportTarget = "#teleport";
17
-
18
9
  Cypress.Commands.add("mount", (component, options = {}) => {
19
- // Setup options object
20
10
  options.global ??= {};
21
11
  options.global.plugins ??= [];
22
- options.global.config ??= {};
23
- options.global.config.compilerOptions ??= {};
24
- options.global.config.compilerOptions.whitespace = "preserve";
25
12
 
26
- /* Installing validationPlugin */
13
+ /* handle warnings as errors */
27
14
  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 */
15
+ install(app) {
36
16
  app.config.warnHandler = (msg) => {
37
17
  const mochaRunner = Cypress.mocha.getRunner();
38
18
  const body = mochaRunner.test?.body ?? "";
@@ -1,3 +1,5 @@
1
+ /* This file is managed by @forsakringskassan/vue-lib-template. Changes will be overwritten! */
2
+
1
3
  @use "@fkui/design/src/core/config-variables" with (
2
4
  $asset-path: "@fkui/design"
3
5
  );
@@ -1,3 +1,5 @@
1
+ /* This file is managed by @forsakringskassan/vue-lib-template. Changes will be overwritten! */
2
+
1
3
  {
2
4
  "extends": ["@fkui/tsconfig/recommended", "@fkui/tsconfig/cypress"],
3
5
  "compilerOptions": {
@@ -6,10 +8,8 @@
6
8
  "cypress",
7
9
  "node",
8
10
  "vite/client",
9
- "cy-mount",
10
- "cypress-html-validate/commands",
11
+ "@forsakringskassan/cypress-config/support",
11
12
  "@forsakringskassan/cypress-visual-regression/commands",
12
- "forced-colors",
13
13
  "mocha"
14
14
  ],
15
15
  "typeRoots": ["../node_modules", "../node_modules/@types", "./types"],
@@ -1,91 +1,29 @@
1
- import { defineConfig } from "cypress";
2
- import exclude from "@fkui/vue/htmlvalidate/cypress";
3
- import { init as installAxe } from "@forsakringskassan/cypress-axe/plugins";
1
+ /* This file is managed by @forsakringskassan/vue-lib-template. Changes will be overwritten! */
2
+
3
+ import {
4
+ axePlugin,
5
+ defineConfig,
6
+ htmlValidatePlugin,
7
+ } from "@forsakringskassan/cypress-config";
4
8
  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
9
 
10
- function installPlugins(
10
+ async function installPlugins(
11
11
  on: Cypress.PluginEvents,
12
12
  config: Cypress.PluginConfigOptions,
13
- ): Cypress.PluginConfigOptions {
13
+ ): Promise<Cypress.PluginConfigOptions> {
14
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
- });
15
+ config = await axePlugin(on, config);
16
+ config = await htmlValidatePlugin(on, config);
31
17
  return config;
32
18
  }
33
19
 
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,
20
+ export default defineConfig(import.meta.dirname, {
68
21
  // Cypress may sometimes restart tests when it detects a changed file in the __screenshot__ folder.
69
22
  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
23
  component: {
81
- setupNodeEvents(on, config) {
82
- return installPlugins(on, config);
83
- },
84
- devServer: {
85
- framework: "vue",
86
- bundler: "vite",
24
+ async setupNodeEvents(on, config) {
25
+ return await installPlugins(on, config);
87
26
  },
88
- excludeSpecPattern: ["temp/**"], // cloneman puts cy-files in temp folder during build
89
27
  },
90
28
  defaultBrowser: "chrome",
91
29
  hosts: { localhost: "127.0.0.1" },
@@ -1,3 +1,5 @@
1
+ /* This file is managed by @forsakringskassan/vue-lib-template. Changes will be overwritten! */
2
+
1
3
  import { copyFileSync } from "node:fs";
2
4
  import path from "node:path";
3
5
  import {
@@ -3,6 +3,7 @@ title: Kattinformation
3
3
  status: Draft
4
4
  layout: component
5
5
  component: FcCatInfoComponent
6
+ visible: false
6
7
  ---
7
8
 
8
9
  Komponenten kan visa kattdata i visningsläge eller i ett redigerbart läge.
@@ -9,7 +9,7 @@
9
9
  "devDependencies": {
10
10
  "@fkui/icon-lib-default": "6.57.1",
11
11
  "@fkui/vue": "6.57.1",
12
- "@forsakringskassan/apimock-express": "4.0.0",
12
+ "@forsakringskassan/apimock-express": "4.1.0",
13
13
  "@forsakringskassan/docs-generator": "3.6.4",
14
14
  "@tsconfig/node24": "24.0.5",
15
15
  "@tsconfig/recommended": "1.0.13",
@@ -1,7 +1,7 @@
1
1
  import { matchRequest } from "@forsakringskassan/apimock-express/browser";
2
2
  import { http } from "msw";
3
3
  import { setupWorker } from "msw/browser";
4
- import mocks from "../../src/mocks.mts";
4
+ import mocks from "../../src/mocks/index.mts";
5
5
 
6
6
  const handlers = [
7
7
  http.all("/api/*", async (req) => {
@@ -1,3 +1,5 @@
1
+ /* This file is managed by @forsakringskassan/vue-lib-template. Changes will be overwritten! */
2
+
1
3
  {
2
4
  "extends": ["@tsconfig/recommended", "@tsconfig/node24"],
3
5
  "compilerOptions": {
@@ -1,3 +1,5 @@
1
+ /* This file is managed by @forsakringskassan/vue-lib-template. Changes will be overwritten! */
2
+
1
3
  import defaultConfig, {
2
4
  docsConfig,
3
5
  examplesConfig,
@@ -86,44 +86,42 @@
86
86
  "@fkui/test-utils": "6.57.1",
87
87
  "@fkui/theme-default": "6.57.1",
88
88
  "@fkui/vue": "6.57.1",
89
- "@forsakringskassan/apimock-express": "4.0.0",
89
+ "@forsakringskassan/apimock-express": "4.1.0",
90
90
  "@forsakringskassan/commitlint-config": "4.2.8",
91
- "@forsakringskassan/cypress-axe": "5.1.5",
91
+ "@forsakringskassan/cypress-config": "1.9.1",
92
92
  "@forsakringskassan/cypress-visual-regression": "5.2.0",
93
93
  "@forsakringskassan/docs-generator": "3.6.4",
94
94
  "@forsakringskassan/docs-live-example": "3.0.2",
95
- "@forsakringskassan/eslint-config": "15.9.5",
95
+ "@forsakringskassan/eslint-config": "15.9.7",
96
96
  "@forsakringskassan/eslint-config-cli": "15.9.3",
97
- "@forsakringskassan/eslint-config-cypress": "15.9.3",
97
+ "@forsakringskassan/eslint-config-cypress": "15.9.9",
98
98
  "@forsakringskassan/eslint-config-jest": "15.9.2",
99
- "@forsakringskassan/eslint-config-typescript": "15.9.2",
100
- "@forsakringskassan/eslint-config-typescript-typeinfo": "15.9.2",
99
+ "@forsakringskassan/eslint-config-typescript": "15.9.8",
100
+ "@forsakringskassan/eslint-config-typescript-typeinfo": "15.9.8",
101
101
  "@forsakringskassan/eslint-config-vitest": "15.9.4",
102
- "@forsakringskassan/eslint-config-vue": "15.9.6",
102
+ "@forsakringskassan/eslint-config-vue": "15.9.8",
103
103
  "@forsakringskassan/prettier-config": "3.7.8",
104
104
  "@forsakringskassan/stylelint-config": "3.4.6",
105
- "@forsakringskassan/vite-lib-config": "5.11.0",
105
+ "@forsakringskassan/vite-lib-config": "5.12.0",
106
106
  "@forsakringskassan/vitest-config-jsdom": "5.0.0",
107
- "@forsakringskassan/vue-lib-template": "1.1.0",
107
+ "@forsakringskassan/vue-lib-template": "1.2.1",
108
108
  "@html-validate/release-scripts": "7.6.11",
109
- "@types/node": "24.13.3",
109
+ "@types/node": "24.13.4",
110
110
  "@typescript/native": "npm:typescript@7.0.2",
111
111
  "@vue/server-renderer": "3.5.42",
112
112
  "@vue/test-utils": "2.5.0",
113
113
  "cloneman": "1.23.1",
114
114
  "core-js": "3.50.0",
115
115
  "cypress": "16.0.0",
116
- "cypress-html-validate": "9.1.0",
117
- "html-validate": "11.14.0",
116
+ "html-validate": "11.15.0",
118
117
  "html-validate-markdown": "6.0.0",
119
118
  "html-validate-vue": "9.3.1",
120
119
  "mocha-junit-reporter": "2.2.1",
121
- "mocha-multi-reporters": "1.5.1",
122
120
  "npm-pkg-lint": "5.2.5",
123
121
  "npm-run-all2": "9.0.3",
124
122
  "rimraf": "6.1.3",
125
123
  "typescript": "npm:@typescript/typescript6@6.0.2",
126
- "vite": "8.2.2",
124
+ "vite": "8.3.0",
127
125
  "vitest": "5.0.0",
128
126
  "vue": "3.5.42",
129
127
  "vue-tsc": "3.3.11"
@@ -5,7 +5,7 @@
5
5
  "@babel/preset-env",
6
6
  "@forsakringskassan/apimock-express",
7
7
  "@forsakringskassan/commitlint-config",
8
- "@forsakringskassan/cypress-axe",
8
+ "@forsakringskassan/cypress-config",
9
9
  "@forsakringskassan/cypress-visual-regression",
10
10
  "@forsakringskassan/docs-generator",
11
11
  "@forsakringskassan/docs-live-example",
@@ -29,12 +29,10 @@
29
29
  "cloneman",
30
30
  "core-js",
31
31
  "cypress",
32
- "cypress-html-validate",
33
32
  "html-validate",
34
33
  "html-validate-markdown",
35
34
  "html-validate-vue",
36
35
  "mocha-junit-reporter",
37
- "mocha-multi-reporters",
38
36
  "npm-pkg-lint",
39
37
  "npm-run-all2",
40
38
  "rimraf",
@@ -1,7 +1,7 @@
1
1
  import { FLoaderSelectors } from "@fkui/vue/selectors";
2
+ import { FcCatInfoComponentSelectors } from "../../../selectors/guide/FcCatInfoComponent.selectors";
2
3
  import FcCatInfoComponent from "./FcCatInfoComponent.vue";
3
4
  import { cats } from "./cat-data";
4
- import { FcCatInfoComponentSelectors } from "./selectors";
5
5
 
6
6
  describe("FcCatInfoComponent", () => {
7
7
  const testCat = cats[0];
@@ -3,8 +3,8 @@ import { ref, watch } from "vue";
3
3
  import { FCard, FLoader } from "@fkui/vue";
4
4
  import CatInfoEdit from "./CatInfoEdit.vue";
5
5
  import CatInfoShow from "./CatInfoShow.vue";
6
- import { useCatInfo } from "./cat-info-logic";
7
- import { type Cat } from "./cat-types";
6
+ import { useCatInfo } from "./cat-info-logic.js";
7
+ import { type Cat } from "./cat-types.js";
8
8
 
9
9
  interface Props {
10
10
  /**
@@ -2,8 +2,8 @@
2
2
  import { defineComponent } from "vue";
3
3
  import { FCheckboxField, FSelectField } from "@fkui/vue";
4
4
  import { LiveExample } from "@forsakringskassan/docs-live-example";
5
- import FcCatInfoComponent from "./FcCatInfoComponent.vue";
6
- import { getCatIds } from "./cat-data";
5
+ import FcCatInfoComponent from "../FcCatInfoComponent.vue";
6
+ import { getCatIds } from "../cat-data.js";
7
7
 
8
8
  export default defineComponent({
9
9
  name: "FcCatInfoComponentLiveExample",
@@ -23,7 +23,9 @@ export default defineComponent({
23
23
  return this.isEditable ? " is-editable" : "";
24
24
  },
25
25
  template(): string {
26
- return /* HTML */ ` <fc-cat-info-component cat-id="${this.selectedCatId}" ${this.editableAttr} /> `;
26
+ return /* HTML */ `
27
+ <fc-cat-info-component cat-id="${this.selectedCatId}" ${this.editableAttr} />
28
+ `;
27
29
  },
28
30
  },
29
31
  });
@@ -0,0 +1 @@
1
+ export { default as FcCatInfoComponent } from "./FcCatInfoComponent.vue";
@@ -0,0 +1,7 @@
1
+ # Component guide
2
+
3
+ This directory contains an example component, `FcCatInfoComponent`, that demonstrates the setup and conventions used by this template.
4
+ It includes the component, selectors, tests, mock data, related support files, and belonging documentation in `docs/guide`.
5
+
6
+ This guide will stay in sync when you update to later versions of your template,
7
+ with intention to serve as a working reference while building your own components.
@@ -0,0 +1 @@
1
+ export { FcCatInfoComponent } from "./FcCatInfo";
@@ -0,0 +1 @@
1
+ export * from "./guide";
@@ -1,3 +1,3 @@
1
1
  import "./style.scss";
2
2
 
3
- export { default as FcCatInfoComponent } from "./FcCatInfoComponent.vue";
3
+ export * from "./components";
@@ -1,14 +1,12 @@
1
1
  import { matchRequest } from "@forsakringskassan/apimock-express/browser";
2
2
  import { describe, expect, it } from "vitest";
3
- import mocks from "./mocks.mjs";
3
+ import catApiMock from "./cat-api.mock.mts";
4
4
 
5
5
  describe("Cat API Mock Reproduction", () => {
6
6
  it("should return 200 for a valid cat id /api/cat?id=whiskers-001", async () => {
7
7
  expect.assertions(2);
8
- const req = new Request(
9
- "http://localhost:8080/api/cat?id=whiskers-001",
10
- );
11
- const response = await matchRequest(mocks, req);
8
+ const req = new Request("http://localhost:8080/cat?id=whiskers-001");
9
+ const response = await matchRequest([catApiMock], req);
12
10
  expect(response.status).toBe(200);
13
11
 
14
12
  const data = await response.json();
@@ -17,8 +15,8 @@ describe("Cat API Mock Reproduction", () => {
17
15
 
18
16
  it("should return 404 for an invalid cat id /api/cat?id=unknown", async () => {
19
17
  expect.assertions(2);
20
- const req = new Request("http://localhost:8080/api/cat?id=unknown");
21
- const response = await matchRequest(mocks, req);
18
+ const req = new Request("http://localhost:8080/cat?id=unknown");
19
+ const response = await matchRequest([catApiMock], req);
22
20
  expect(response.status).toBe(404);
23
21
 
24
22
  const data = await response.json();
@@ -1,6 +1,6 @@
1
1
  import { defineMock } from "@forsakringskassan/apimock-express/helpers";
2
- import { cats } from "./cat-data.ts";
3
- import type { Cat } from "./cat-types.ts";
2
+ import { cats } from "../../components/guide/FcCatInfo/cat-data.ts";
3
+ import type { Cat } from "../../components/guide/FcCatInfo/cat-types.ts";
4
4
 
5
5
  export default defineMock<Cat | { error: string }>({
6
6
  meta: {
@@ -0,0 +1 @@
1
+ export { default } from "./guide/index.mts";
@@ -0,0 +1 @@
1
+ export { FcCatInfoComponentSelectors } from "./FcCatInfoComponent.selectors";
@@ -1 +1 @@
1
- export { FcCatInfoComponentSelectors } from "./FcCatInfoComponent.selectors";
1
+ export * from "./guide";
@@ -1,4 +1,4 @@
1
- /* This file was generated by @forsakringskassan/vite-lib-config. Changes may be overwritten! */
1
+ /* This file is managed by @forsakringskassan/vue-lib-template. Changes will be overwritten! */
2
2
 
3
3
  {
4
4
  "extends": [
@@ -1,4 +1,4 @@
1
- /* This file was generated by @forsakringskassan/vite-lib-config. Changes may be overwritten! */
1
+ /* This file is managed by @forsakringskassan/vue-lib-template. Changes will be overwritten! */
2
2
 
3
3
  {
4
4
  "extends": "@forsakringskassan/vite-lib-config/tsconfig.root.json",
@@ -1,19 +1,13 @@
1
- /* This file was generated by @forsakringskassan/vite-lib-config. Changes may be overwritten! */
1
+ /* This file is managed by @forsakringskassan/vue-lib-template. Changes will be overwritten! */
2
2
 
3
3
  {
4
4
  "extends": "@forsakringskassan/vite-lib-config/tsconfig.lib.json",
5
5
  "compilerOptions": {
6
- "allowImportingTsExtensions": true,
7
6
  "paths": {
8
7
  "@forsakringskassan/vue-lib-template/selectors": [
9
8
  "./src/selectors/index.ts"
10
9
  ],
11
10
  "@forsakringskassan/vue-lib-template": ["./src/index.ts"]
12
11
  }
13
- },
14
- "include": [
15
- "${configDir}/src/**/*.mts",
16
- "${configDir}/src/**/*.ts",
17
- "${configDir}/src/**/*.vue"
18
- ]
12
+ }
19
13
  }
@@ -1,4 +1,4 @@
1
- /* This file was generated by @forsakringskassan/vite-lib-config. Changes may be overwritten! */
1
+ /* This file is managed by @forsakringskassan/vue-lib-template. Changes will be overwritten! */
2
2
 
3
3
  {
4
4
  "extends": "@forsakringskassan/vite-lib-config/tsconfig.selectors.json"
@@ -1,8 +1,8 @@
1
- /* This file was generated by @forsakringskassan/vite-lib-config. Changes may be overwritten! */
1
+ /* This file is managed by @forsakringskassan/vue-lib-template. Changes will be overwritten! */
2
2
 
3
3
  import { defineConfig } from "@forsakringskassan/vite-lib-config/vite";
4
4
  import { defineTestConfig } from "@forsakringskassan/vitest-config-jsdom";
5
- import mocks from "./src/mocks.mts";
5
+ import mocks from "./src/mocks/index.mts";
6
6
 
7
7
  export default defineConfig({
8
8
  test: defineTestConfig(),
package/hooks/install.mjs CHANGED
@@ -2,7 +2,8 @@
2
2
  * @param {import("cloneman").InstallContext} context
3
3
  */
4
4
  export default async (context) => {
5
- const { getParameter, updateJsonFile } = context;
5
+ const { getParameter, updateJsonFile, getApplicationName, replaceInFile } =
6
+ context;
6
7
 
7
8
  /* write repository url to "package.json" */
8
9
  const repoUrl = getParameter("repo-url");
@@ -12,4 +13,11 @@ export default async (context) => {
12
13
  url: repoUrl,
13
14
  },
14
15
  });
16
+
17
+ /* update placeholder names with the real application name (from package.json) */
18
+ const name = getApplicationName;
19
+ const placeholder = "@forsakringskassan/vue-lib-template";
20
+ await replaceInFile("tsconfig.lib.json", placeholder, name);
21
+ await replaceInFile("tsconfig.cypress.json", placeholder, name);
22
+ await replaceInFile("tsconfig.selectors.json", placeholder, name);
15
23
  };
package/index.js CHANGED
@@ -7,7 +7,7 @@
7
7
 
8
8
  const options = {
9
9
  ...packageJson.cloneman,
10
- fileHash: "1fb23d6a059d91acb529714eaa17c95fa8d67e9346df40b33d29f41679b92a8f",
10
+ fileHash: "b15cb2f279a719719dfa19b85ed5587db8036c5e984ba398bce5a3cd69d0b0f5",
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.1.0",
3
+ "version": "1.2.1",
4
4
  "description": "Vue library template based on Cloneman",
5
5
  "keywords": [
6
6
  "template",
@@ -40,18 +40,14 @@
40
40
  "CODEOWNERS",
41
41
  "cypress.config.ts",
42
42
  "cypress/fixtures/example.json",
43
- "cypress/support/commands/forced-colors.ts",
44
43
  "cypress/support/common.ts",
45
- "cypress/support/component-index.html",
46
44
  "cypress/support/component.ts",
47
45
  "cypress/support/main.scss",
48
46
  "cypress/tsconfig.json",
49
- "cypress/types/cy-mount.d.ts",
50
- "cypress/types/forced-colors.d.ts",
51
47
  "cypress/types/mocha.d.ts",
52
48
  "docs/build.mts",
49
+ "docs/guide/index.md",
53
50
  "docs/index.md",
54
- "docs/kattinformation/index.md",
55
51
  "docs/package.json",
56
52
  "docs/src/bundle-mocks.mjs",
57
53
  "docs/src/global.d.ts",
@@ -66,25 +62,31 @@
66
62
  "LICENSE.md",
67
63
  "README.md",
68
64
  "renovate.json",
69
- "src/cat-api-mock.spec.ts",
70
- "src/cat-api.mock.mts",
71
- "src/cat-api.spec.ts",
72
- "src/cat-api.ts",
73
- "src/cat-data.ts",
74
- "src/cat-info-logic.ts",
75
- "src/cat-types.ts",
76
- "src/CatInfoEdit.vue",
77
- "src/CatInfoLogic.spec.ts",
78
- "src/CatInfoShow.vue",
79
- "src/examples/CatInfoExample.vue",
80
- "src/FcCatInfoComponent.cy.ts",
81
- "src/FcCatInfoComponent.vue",
82
- "src/FcCatInfoComponentLiveExample.vue",
65
+ "src/components/guide/FcCatInfo/cat-api.spec.ts",
66
+ "src/components/guide/FcCatInfo/cat-api.ts",
67
+ "src/components/guide/FcCatInfo/cat-data.ts",
68
+ "src/components/guide/FcCatInfo/cat-info-logic.spec.ts",
69
+ "src/components/guide/FcCatInfo/cat-info-logic.ts",
70
+ "src/components/guide/FcCatInfo/cat-types.ts",
71
+ "src/components/guide/FcCatInfo/CatInfoEdit.vue",
72
+ "src/components/guide/FcCatInfo/CatInfoShow.vue",
73
+ "src/components/guide/FcCatInfo/examples/FcCatInfoComponentExample.vue",
74
+ "src/components/guide/FcCatInfo/examples/FcCatInfoComponentLiveExample.vue",
75
+ "src/components/guide/FcCatInfo/FcCatInfoComponent.cy.ts",
76
+ "src/components/guide/FcCatInfo/FcCatInfoComponent.vue",
77
+ "src/components/guide/FcCatInfo/index.ts",
78
+ "src/components/guide/index.ts",
79
+ "src/components/guide/README.md",
80
+ "src/components/index.ts",
83
81
  "src/index.ts",
84
82
  "src/local.scss",
85
83
  "src/local.ts",
86
- "src/mocks.mts",
87
- "src/selectors/FcCatInfoComponent.selectors.ts",
84
+ "src/mocks/guide/cat-api-mock.spec.ts",
85
+ "src/mocks/guide/cat-api.mock.mts",
86
+ "src/mocks/guide/index.mts",
87
+ "src/mocks/index.mts",
88
+ "src/selectors/guide/FcCatInfoComponent.selectors.ts",
89
+ "src/selectors/guide/index.ts",
88
90
  "src/selectors/index.ts",
89
91
  "src/style.scss",
90
92
  "src/vite-dev/app.vue",
@@ -108,14 +110,10 @@
108
110
  "babel.config.js",
109
111
  "cypress.config.ts",
110
112
  "cypress/fixtures/example.json",
111
- "cypress/support/commands/forced-colors.ts",
112
113
  "cypress/support/common.ts",
113
- "cypress/support/component-index.html",
114
114
  "cypress/support/component.ts",
115
115
  "cypress/support/main.scss",
116
116
  "cypress/tsconfig.json",
117
- "cypress/types/cy-mount.d.ts",
118
- "cypress/types/forced-colors.d.ts",
119
117
  "cypress/types/mocha.d.ts",
120
118
  "docs/build.mts",
121
119
  "docs/package.json",
@@ -1,33 +0,0 @@
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
- });
@@ -1,14 +0,0 @@
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>
@@ -1,9 +0,0 @@
1
- import { mount } from "cypress/vue";
2
-
3
- declare global {
4
- namespace Cypress {
5
- interface Chainable {
6
- mount: typeof mount;
7
- }
8
- }
9
- }
@@ -1,18 +0,0 @@
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 {};
File without changes