@forsakringskassan/vite-lib-config 5.4.1 → 5.4.3
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/dist/write-config.mjs
CHANGED
|
@@ -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
|
-
|
|
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,29 +714,32 @@ 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"]);
|
|
718
|
+
const buildSelectors = options.enableSelectors || options.enablePageobjects;
|
|
716
719
|
result.scripts.build = [
|
|
717
720
|
"run-s",
|
|
721
|
+
haveBuildMock ? "build:mock" : null,
|
|
718
722
|
"build:lib",
|
|
719
|
-
|
|
723
|
+
buildSelectors ? "build:selectors" : null,
|
|
720
724
|
"build:dts",
|
|
721
725
|
options.enableApiExtractor ? "build:api" : null
|
|
722
726
|
].filter(Boolean).join(" ");
|
|
723
727
|
result.scripts["build:api"] = options.enableApiExtractor ? "fk-api-extractor api-extractor.*.json" : void 0;
|
|
724
728
|
result.scripts["build:dts"] = "vue-tsc -b";
|
|
725
729
|
result.scripts["build:lib"] = "fk-build-vue-lib";
|
|
726
|
-
result.scripts["build:selectors"] =
|
|
730
|
+
result.scripts["build:selectors"] = buildSelectors ? "fk-build-selectors" : void 0;
|
|
727
731
|
delete result.scripts["build:pageobject"];
|
|
728
732
|
return result;
|
|
729
733
|
}
|
|
730
734
|
async function writeBuildScripts(cwd, options) {
|
|
731
735
|
const result = await readJsonFile(cwd, "package.json");
|
|
732
|
-
const { data: pkg, indent } = result;
|
|
736
|
+
const { data: pkg, indent, trailer } = result;
|
|
733
737
|
const updated = JSON.stringify(
|
|
734
738
|
updateBuildScripts(pkg, options),
|
|
735
739
|
void 0,
|
|
736
740
|
indent
|
|
737
741
|
);
|
|
738
|
-
await writeJsonFile(cwd, "package.json", updated);
|
|
742
|
+
await writeJsonFile(cwd, "package.json", `${updated}${trailer}`);
|
|
739
743
|
}
|
|
740
744
|
async function findCypressConfigPath(cwd) {
|
|
741
745
|
const { findUp: findUp2 } = await Promise.resolve().then(() => (init_find_up(), find_up_exports));
|
package/package.json
CHANGED
|
@@ -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",
|