@forsakringskassan/vite-lib-config 5.8.0 → 5.9.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/dist/write-config.mjs +23 -5
- package/package.json +1 -1
package/dist/write-config.mjs
CHANGED
|
@@ -721,8 +721,8 @@ async function generateTsconfigLib(options) {
|
|
|
721
721
|
compilerOptions: {
|
|
722
722
|
types: testRunner === "jest" ? ["node", "jest", "vite/client"] : void 0,
|
|
723
723
|
paths: {
|
|
724
|
-
[`${name}/cypress`]: ["./src/cypress/index.ts"],
|
|
725
|
-
[`${name}/selectors`]: ["./src/selectors/index.ts"],
|
|
724
|
+
[`${name}/cypress`]: options.enablePageobjects ? ["./src/cypress/index.ts"] : void 0,
|
|
725
|
+
[`${name}/selectors`]: options.enableSelectors ? ["./src/selectors/index.ts"] : void 0,
|
|
726
726
|
[name]: ["./src/index.ts"]
|
|
727
727
|
}
|
|
728
728
|
}
|
|
@@ -738,8 +738,8 @@ async function generateTsconfigCypress(options) {
|
|
|
738
738
|
],
|
|
739
739
|
compilerOptions: {
|
|
740
740
|
paths: {
|
|
741
|
-
[`${name}/cypress`]: ["./src/cypress/index.ts"],
|
|
742
|
-
[`${name}/selectors`]: ["./src/selectors/index.ts"],
|
|
741
|
+
[`${name}/cypress`]: options.enablePageobjects ? ["./src/cypress/index.ts"] : void 0,
|
|
742
|
+
[`${name}/selectors`]: options.enableSelectors ? ["./src/selectors/index.ts"] : void 0,
|
|
743
743
|
[name]: ["./src/index.ts"]
|
|
744
744
|
}
|
|
745
745
|
}
|
|
@@ -764,6 +764,20 @@ async function generateTsconfigPageobjects(options) {
|
|
|
764
764
|
};
|
|
765
765
|
return [boilerplate, await serializeJson(config)].join("\n\n");
|
|
766
766
|
}
|
|
767
|
+
function generateViteConfig() {
|
|
768
|
+
const config = [
|
|
769
|
+
`import { defineConfig } from "@forsakringskassan/vite-lib-config/vite";`,
|
|
770
|
+
`import { defineTestConfig } from "@forsakringskassan/vitest-config-jsdom";`,
|
|
771
|
+
``,
|
|
772
|
+
`export default defineConfig({`,
|
|
773
|
+
` test: defineTestConfig({`,
|
|
774
|
+
` setupFiles: ["./vitest.setup.ts"],`,
|
|
775
|
+
` }),`,
|
|
776
|
+
`});`
|
|
777
|
+
].map((it) => `${it}
|
|
778
|
+
`).join("");
|
|
779
|
+
return [boilerplate, config].join("\n\n");
|
|
780
|
+
}
|
|
767
781
|
async function readJsonFile(cwd, filename) {
|
|
768
782
|
const filePath = path3.join(cwd, filename);
|
|
769
783
|
const content = await fs3.readFile(filePath, "utf8");
|
|
@@ -872,6 +886,7 @@ async function run(cwd, argv) {
|
|
|
872
886
|
enableSelectors: Boolean(pkg.exports?.["./selectors"])
|
|
873
887
|
};
|
|
874
888
|
const generated = /* @__PURE__ */ new Map([
|
|
889
|
+
["api-extractor.json", null],
|
|
875
890
|
["api-extractor.lib.json", generateApiExtractorLib(options)],
|
|
876
891
|
["api-extractor.cypress.json", generateApiExtractorCypress(options)],
|
|
877
892
|
[
|
|
@@ -882,7 +897,9 @@ async function run(cwd, argv) {
|
|
|
882
897
|
["tsconfig.lib.json", generateTsconfigLib(options)],
|
|
883
898
|
["tsconfig.cypress.json", generateTsconfigCypress(options)],
|
|
884
899
|
["tsconfig.selectors.json", generateTsconfigSelectors(options)],
|
|
885
|
-
["tsconfig.pageobjects.json", generateTsconfigPageobjects(options)]
|
|
900
|
+
["tsconfig.pageobjects.json", generateTsconfigPageobjects(options)],
|
|
901
|
+
["vite.config.ts", null],
|
|
902
|
+
["vite.config.mts", generateViteConfig()]
|
|
886
903
|
]);
|
|
887
904
|
console.group("Writing configuration files");
|
|
888
905
|
console.log("API Extractor:", flagEnabled(options.enableApiExtractor));
|
|
@@ -924,6 +941,7 @@ export {
|
|
|
924
941
|
generateTsconfigLib,
|
|
925
942
|
generateTsconfigPageobjects,
|
|
926
943
|
generateTsconfigSelectors,
|
|
944
|
+
generateViteConfig,
|
|
927
945
|
run,
|
|
928
946
|
updateBuildScripts
|
|
929
947
|
};
|