Skip to content

Commit f975ca1

Browse files
committed
fixed build to work with typescript
1 parent 446f63b commit f975ca1

File tree

10 files changed

+120
-152
lines changed

10 files changed

+120
-152
lines changed

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
{
22
"name": "xf-cmpt-lib",
33
"private": false,
4-
"version": "0.7.17",
5-
"_id": "[email protected].17",
4+
"version": "0.7.21",
5+
"_id": "[email protected].21",
66
"type": "module",
77
"files": [
88
"dist"
99
],
1010
"readme": "ERROR: No README data found!",
11-
"main": "./dist/cmpt-lib-ts.umd.js",
12-
"module": "./dist/cmpt-lib-ts.es.js",
11+
"types": "./dist/index.d.ts",
12+
"main": "./dist/index.cjs",
13+
"module": "./dist/index.js",
1314
"exports": {
1415
".": {
15-
"import": "./dist/cmpt-lib-ts.es.js",
16-
"require": "./dist/cmpt-lib-ts.umd.js"
16+
"import": "./dist/index.js",
17+
"require": "./dist/index.cjs"
1718
},
18-
"./dist/cmpt-lib-ts.css": {
19-
"import": "./dist/cmpt-lib-ts.css",
20-
"require": "./dist/cmpt-lib-ts.css"
19+
"./style.css": {
20+
"import": "./dist/style.css",
21+
"require": "./dist/style.css"
2122
}
2223
},
23-
"types": "./dist/main.d.ts",
2424
"homepage": "https://xf-cmpt-lib.vercel.app",
2525
"repository": {
2626
"type": "git",

src/App.vue

-7
This file was deleted.

src/components/XfMenu/XfMenu.vue

+2-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ const props = defineProps({
4141
modelValue: {
4242
type: Boolean,
4343
default: false,
44-
required: true,
4544
},
4645
activator: {
4746
type: String,
@@ -157,6 +156,8 @@ watch(
157156
&-content {
158157
position: absolute;
159158
z-index: 51;
159+
height: max-content;
160+
width: max-content;
160161
box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
161162
}
162163
}

src/components/XfNav/XfNav.vue

-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ const props = defineProps({
8080
modelValue: {
8181
type: Boolean,
8282
default: false,
83-
required: true,
8483
},
8584
menuButtonColour: {
8685
type: String,

src/components/index.ts

-39
This file was deleted.

src/components/main.ts

-59
This file was deleted.

src/index.ts

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import "@/assets/styles/index.scss";
2+
3+
import { default as XfSelect } from "@/components/inputs/XfSelect/XfSelect.vue";
4+
import { default as XfCheckbox } from "@/components/inputs/XfCheckbox/XfCheckbox.vue";
5+
import { default as XfTextInput } from "@/components/inputs/XfTextInput/XfTextInput.vue";
6+
import { default as XfTextArea } from "@/components/inputs/XfTextArea/XfTextArea.vue";
7+
8+
import { default as XfLoadingSpinner } from "@/components/loading/XfLoadingSpinner/XfLoadingSpinner.vue";
9+
import { default as XfLoadingBar } from "@/components/loading/XfLoadingBar/XfLoadingBar.vue";
10+
11+
import { default as XfButton } from "@/components/XfButton/XfButton.vue";
12+
import { default as XfIcon } from "@/components/XfIcon/XfIcon.vue";
13+
import { default as XfModal } from "@/components/XfModal/XfModal.vue";
14+
import { default as XfBanner } from "@/components/XfBanner/XfBanner.vue";
15+
import { default as XfNav } from "@/components/XfNav/XfNav.vue";
16+
import { default as XfMenu } from "@/components/XfMenu/XfMenu.vue";
17+
import { default as XfSnackbar } from "@/components/XfSnackbar/XfSnackbar.vue";
18+
import { default as XfExpansionPanel } from "@/components/XfExpansionPanel/XfExpansionPanel.vue";
19+
import { default as XfFuzzyImage } from "@/components/XfFuzzyImage/XfFuzzyImage.vue";
20+
import { default as XfSidebar } from "@/components/XfSidebar/XfSidebar.vue";
21+
22+
export {
23+
XfBanner,
24+
XfButton,
25+
XfIcon,
26+
XfModal,
27+
XfTextArea,
28+
XfTextInput,
29+
XfNav,
30+
XfSelect,
31+
XfCheckbox,
32+
XfMenu,
33+
XfSnackbar,
34+
XfLoadingSpinner,
35+
XfLoadingBar,
36+
XfExpansionPanel,
37+
XfFuzzyImage,
38+
XfSidebar,
39+
};

src/main.ts

+58-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,59 @@
1-
import { createApp } from "vue";
2-
import App from "./App.vue";
1+
import type { App } from "vue";
2+
import {
3+
XfBanner,
4+
XfButton,
5+
XfIcon,
6+
XfModal,
7+
XfTextArea,
8+
XfTextInput,
9+
XfNav,
10+
XfSelect,
11+
XfCheckbox,
12+
XfMenu,
13+
XfSnackbar,
14+
XfLoadingBar,
15+
XfLoadingSpinner,
16+
XfExpansionPanel,
17+
XfFuzzyImage,
18+
XfSidebar,
19+
} from "./index";
320

4-
createApp(App).mount("#app");
21+
export default {
22+
install: (app: App) => {
23+
app.component("XfBanner", XfBanner);
24+
app.component("XfButton", XfButton);
25+
app.component("XfIcon", XfIcon);
26+
app.component("XfModal", XfModal);
27+
app.component("XfTextArea", XfTextArea);
28+
app.component("XfTextInput", XfTextInput);
29+
app.component("XfNav", XfNav);
30+
app.component("XfSelect", XfSelect);
31+
app.component("XfCheckbox", XfCheckbox);
32+
app.component("XfMenu", XfMenu);
33+
app.component("XfSnackbar", XfSnackbar);
34+
app.component("XfLoadingBar", XfLoadingBar);
35+
app.component("XfLoadingSpinner", XfLoadingSpinner);
36+
app.component("XfExpansionPanel", XfExpansionPanel);
37+
app.component("XfFuzzyImage", XfFuzzyImage);
38+
app.component("XfSidebar", XfSidebar);
39+
},
40+
};
41+
42+
export {
43+
XfBanner,
44+
XfButton,
45+
XfIcon,
46+
XfModal,
47+
XfTextArea,
48+
XfTextInput,
49+
XfNav,
50+
XfSelect,
51+
XfMenu,
52+
XfCheckbox,
53+
XfSnackbar,
54+
XfLoadingBar,
55+
XfLoadingSpinner,
56+
XfExpansionPanel,
57+
XfFuzzyImage,
58+
XfSidebar,
59+
};

vite.config.ts

+9-30
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,13 @@ import * as path from "path";
55
import typescript2 from "rollup-plugin-typescript2";
66
import dts from "vite-plugin-dts";
77

8-
// https://vitejs.dev/config/
98
export default defineConfig(({ command }) => ({
109
publicDir: command === "build" ? false : "public",
10+
resolve: {
11+
alias: {
12+
"@": path.resolve(__dirname, "src"),
13+
},
14+
},
1115
css: {
1216
preprocessorOptions: {
1317
scss: {
@@ -35,36 +39,11 @@ export default defineConfig(({ command }) => ({
3539
}),
3640
],
3741
build: {
38-
cssCodeSplit: true,
3942
lib: {
40-
// Could also be a dictionary or array of multiple entry points
41-
entry: "src/components/main.ts",
42-
name: "cmpt-lib",
43-
formats: ["es", "cjs", "umd"],
44-
fileName: (format) => `cmpt-lib-ts.${format}.js`,
45-
},
46-
rollupOptions: {
47-
// make sure to externalize deps that should not be bundled
48-
// into your library
49-
input: {
50-
main: path.resolve(__dirname, "src/components/main.ts"),
51-
},
52-
external: ["vue", "public"],
53-
output: {
54-
assetFileNames: (assetInfo) => {
55-
if (assetInfo.name === "main.css") return "cmpt-lib-ts.css";
56-
return assetInfo.name;
57-
},
58-
exports: "named",
59-
globals: {
60-
vue: "Vue",
61-
},
62-
},
63-
},
64-
},
65-
resolve: {
66-
alias: {
67-
"@": path.resolve(__dirname, "src"),
43+
entry: "src/index.ts",
44+
name: "xf-cmpt-lib",
45+
fileName: "index",
46+
formats: ["es", "cjs"],
6847
},
6948
},
7049
}));

0 commit comments

Comments
 (0)