Skip to content

Commit

Permalink
revert from unbuild to vite
Browse files Browse the repository at this point in the history
  • Loading branch information
zernonia committed May 10, 2023
1 parent 21704a8 commit 949e99a
Show file tree
Hide file tree
Showing 13 changed files with 680 additions and 271 deletions.
12 changes: 0 additions & 12 deletions build.config.ts

This file was deleted.

319 changes: 315 additions & 4 deletions demo/nuxt/yarn.lock

Large diffs are not rendered by default.

13 changes: 8 additions & 5 deletions demo/vue/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { createApp } from "vue"
import App from "./App.vue"
import { router } from "./router"
import "vue3-notion/dist/style.css"
import { createApp } from "vue";
import App from "./App.vue";
import { router } from "./router";
import "vue3-notion/dist/style.css";

createApp(App).use(router).mount("#app")
import "prismjs/themes/prism.css";
import "katex/dist/katex.min.css";

createApp(App).use(router).mount("#app");
12 changes: 6 additions & 6 deletions demo/vue/src/router/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { createRouter, createWebHistory } from "vue-router"
import Home from "../view/Index.vue"
import Page from "../view/Page.vue"
import { createRouter, createWebHistory } from "vue-router";
import Home from "../view/Index.vue";
import Page from "../view/Page.vue";

const routes = [
{ path: "/", name: "Home", component: Home },
{ path: "/page/:id", name: "Page", component: Page },
]
{ path: "/:id", name: "Page", component: Page },
];

export const router = createRouter({
history: createWebHistory(),
routes,
})
});
22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
"homepage": "https://vue3-notion.vercel.app/",
"repository": "github:zernonia/vue3-notion",
"type": "module",
"main": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"main": "./dist/vue3-notion.umd.cjs",
"module": "./dist/vue3-notion.js",
"exports": {
".": {
"import": "./dist/index.mjs",
"require": "./dist/index.js"
"import": "./dist/vue3-notion.js",
"require": "./dist/vue3-notion.umd.cjs"
},
"./nuxt": {
"require": "./nuxt/index.ts",
Expand All @@ -36,28 +36,28 @@
"scripts": {
"dev": "vite serve playground",
"dev:build": "vite build playground",
"build": "unbuild",
"build": "vite build",
"preview": "vite preview",
"version": " git add -A src",
"postversion": "git push && git push --tags",
"deploy": "npm run build && npm version patch && npm publish"
},
"dependencies": {
"@nuxt/kit": "^3.4.3",
"@vueuse/core": "^8.7.5",
"katex": "^0.15.1",
"prismjs": "^1.25.0",
"vue": "^3.2.26",
"vue-router": "4"
"vue": "^3.2.26"
},
"devDependencies": {
"vue-router": "4",
"@nuxt/kit": "^3.4.3",
"@vueuse/core": "^8.7.5",
"@types/katex": "^0.11.1",
"@types/node": "^17.0.5",
"@types/prismjs": "^1.16.6",
"@vitejs/plugin-vue": "^4.2.1",
"typescript": "^5.0.4",
"unbuild": "^1.2.1",
"vite": "^4.3.5"
"vite": "^4.3.5",
"vite-plugin-dts": "^2.3.0"
},
"peerDependencies": {
"katex": "^0.15.1",
Expand Down
12 changes: 6 additions & 6 deletions playground/router/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { createRouter, createWebHistory } from "vue-router"
import Home from "../view/Index.vue"
import Page from "../view/Page.vue"
import { createRouter, createWebHistory } from "vue-router";
import Home from "../view/Index.vue";
import Page from "../view/Page.vue";

const routes = [
{ path: "/", name: "Home", component: Home },
{ path: "/page/:id", name: "Page", component: Page },
]
{ path: "/:id", name: "Page", component: Page },
];

export const router = createRouter({
history: createWebHistory(),
routes,
})
});
1 change: 0 additions & 1 deletion postcss.ts

This file was deleted.

17 changes: 0 additions & 17 deletions rollup.config.ts

This file was deleted.

3 changes: 1 addition & 2 deletions src/blocks/page.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<script setup lang="ts">
import { useNotionBlock, defineNotionProps } from "../lib/blockable";
import NotionPageHeader from "../blocks/helpers/page-header.vue";
import NotionPageIcon from "../blocks/helpers/page-icon.vue";
import NotionTextRenderer from "../blocks/helpers/text-renderer.vue";
import { computed, StyleValue } from "vue";
Expand All @@ -21,7 +20,7 @@ const computedFont = computed(() => {
} else if (font == "mono") {
return { fontFamily: "iawriter-mono, Nitti, Menlo, Courier, monospace" };
}
}) as StyleValue;
});
</script>

<script lang="ts">
Expand Down
3 changes: 0 additions & 3 deletions src/components/notion-renderer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
import { defineNotionProps, useNotionBlock } from "../lib/blockable";
import NotionBlock from "../components/block.vue";
import "prismjs/themes/prism.css";
import "katex/dist/katex.min.css";
const props = defineProps({ ...defineNotionProps });
//@ts-ignore
const { pass, block } = useNotionBlock(props);
Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { App } from "vue";
import * as components from "./components";
import "./style.css";

// Default export is library as a whole, registered via Vue.use()
export default {
Expand Down
30 changes: 30 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { defineConfig } from "vite";
import path from "path";
import vue from "@vitejs/plugin-vue";
import dts from "vite-plugin-dts";

// https://vitejs.dev/config/
export default defineConfig({
plugins: [
vue(),
dts({
insertTypesEntry: true,
}),
],
build: {
target: "esnext",
lib: {
entry: path.resolve(__dirname, "src/index.ts"),
name: "vue3-notion",
},
rollupOptions: {
external: ["vue"],
output: {
globals: {
vue: "Vue",
},
exports: "named",
},
},
},
});
Loading

0 comments on commit 949e99a

Please sign in to comment.