@forsakringskassan/vite-lib-config 5.4.1 → 5.4.2

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.
@@ -704,7 +704,8 @@ async function readJsonFile(cwd, filename) {
704
704
  const content = await fs3.readFile(filePath, "utf8");
705
705
  const data = JSON.parse(content);
706
706
  const { indent } = detectIndent(content);
707
- return { data, indent };
707
+ const trailer = content.endsWith("\n") ? "\n" : "";
708
+ return { data, indent, trailer };
708
709
  }
709
710
  async function writeJsonFile(cwd, filename, content) {
710
711
  const filePath = path3.join(cwd, filename);
@@ -713,8 +714,10 @@ async function writeJsonFile(cwd, filename, content) {
713
714
  }
714
715
  function updateBuildScripts(pkg, options) {
715
716
  const result = { ...pkg, scripts: { ...pkg.scripts } };
717
+ const haveBuildMock = Boolean(result.scripts["build:mock"]);
716
718
  result.scripts.build = [
717
719
  "run-s",
720
+ haveBuildMock ? "build:mock" : null,
718
721
  "build:lib",
719
722
  options.enableSelectors ? "build:selectors" : null,
720
723
  "build:dts",
@@ -729,13 +732,13 @@ function updateBuildScripts(pkg, options) {
729
732
  }
730
733
  async function writeBuildScripts(cwd, options) {
731
734
  const result = await readJsonFile(cwd, "package.json");
732
- const { data: pkg, indent } = result;
735
+ const { data: pkg, indent, trailer } = result;
733
736
  const updated = JSON.stringify(
734
737
  updateBuildScripts(pkg, options),
735
738
  void 0,
736
739
  indent
737
740
  );
738
- await writeJsonFile(cwd, "package.json", updated);
741
+ await writeJsonFile(cwd, "package.json", `${updated}${trailer}`);
739
742
  }
740
743
  async function findCypressConfigPath(cwd) {
741
744
  const { findUp: findUp2 } = await Promise.resolve().then(() => (init_find_up(), find_up_exports));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forsakringskassan/vite-lib-config",
3
- "version": "5.4.1",
3
+ "version": "5.4.2",
4
4
  "description": "Försäkringskassan toolchain to build libraries with Vite",
5
5
  "keywords": [
6
6
  "vite"
@@ -7,7 +7,17 @@
7
7
  "rootDir": "${configDir}/src",
8
8
  "emitDeclarationOnly": true,
9
9
  "declarationDir": "temp/cypress",
10
- "skipLibCheck": true
10
+ "skipLibCheck": true,
11
+
12
+ /* workaround for `cy.mount()` (via `@vue/test-utils`) being
13
+ * incompatable with types generated by `vue-tsc`, giving errors such
14
+ * as:
15
+ *
16
+ * - "Types of parameters 'props' and 'props' are incompatable"
17
+ * - "Types of property 'setup' are incompatable"
18
+ * - etc...
19
+ */
20
+ "strictFunctionTypes": false
11
21
  },
12
22
  "include": [
13
23
  "${configDir}/src/**/*.ts",