Skip to content

Commit

Permalink
prepare for docs
Browse files Browse the repository at this point in the history
  • Loading branch information
davay42 committed Jan 19, 2023
1 parent 7e9da75 commit a6f69a6
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 105 deletions.
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@
"dist"
],
"scripts": {
"build": "tsc && vite build",
"build": "tsc && vite build --config vite.config.lib.js",
"deploy": "sh deploy.sh",
"dev": "vite --mode page",
"page": "vite build --mode page",
"serve": "vite preview --mode page --port=5005"
"dev": "vite",
"page": "vite build",
"serve": "vite preview --port=5005"
},
"dependencies": {
"@vueuse/core": "9.10.0",
Expand All @@ -62,4 +62,4 @@
"vitepress": "1.0.0-alpha.36",
"windicss": "^3.5.6"
}
}
}
40 changes: 20 additions & 20 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
{
// Change this to match your project
"include": ["src/**/*"],
// Change this to match your project
"include": ["src/main.js"],
"exclude": ["node_modules"],
"compilerOptions": {
// Tells TypeScript to read JS files, as
// normally they are ignored as source files
"allowJs": true,
// Generate d.ts files
"declaration": true,
// This compiler run should
// only output d.ts files
"emitDeclarationOnly": true,
// Types should go into this directory.
// Removing this would place the .d.ts files
// next to the .js files
"outDir": "public/types",
// go to js file when using IDE functions like
// "Go to Definition" in VSCode
"declarationMap": true
}
}
"compilerOptions": {
// Tells TypeScript to read JS files, as
// normally they are ignored as source files
"allowJs": true,
// Generate d.ts files
"declaration": true,
// This compiler run should
// only output d.ts files
"emitDeclarationOnly": true,
// Types should go into this directory.
// Removing this would place the .d.ts files
// next to the .js files
"outDir": "public/types",
// go to js file when using IDE functions like
// "Go to Definition" in VSCode
"declarationMap": true
}
}
133 changes: 53 additions & 80 deletions vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,88 +4,61 @@ import Components from "unplugin-vue-components/vite";
import Icons from "unplugin-icons/vite";
import IconsResolver from "unplugin-icons/resolver";
import WindiCSS from "vite-plugin-windicss";
import Vue from "@vitejs/plugin-vue";

export default defineConfig(({ command, mode }) => {
const config = {
base: "./",
plugins: [
WindiCSS({
scan: {
dirs: ["src"],
exclude: ["/node_modules/"],
fileExtensions: ["vue", "ts"],
},
}),
Icons({
/* options */
}),
Components({
dirs: ["src"],
extensions: ["html", "vue"],
directoryAsNamespace: true,
globalNamespaces: ["global"],
include: [/\.vue$/, /\.vue\?vue/, /\.html$/],
exclude: [/node_modules/, /\.git/],
resolvers: [
IconsResolver({
componentPrefix: "",
}),
],
}),
],
};

if (mode == "production") {
return {
...config,
build: {
outDir: "./dist",
lib: {
entry: path.resolve(__dirname, "./src/main.js"),
name: "gun-avatar",
},
optimizeDeps: {
include: [
"gun",
"gun/gun",
"gun/sea",
"gun/sea.js",
"gun/lib/then",
"gun/lib/webrtc",
"gun/lib/radix",
"gun/lib/radisk",
"gun/lib/store",
"gun/lib/rindexed",
],
},
},
};
}

if (mode == "page") {
return {
...config,
build: {
outDir: "./demo",
optimizeDeps: {
include: [
"gun",
"gun/gun",
"gun/sea",
"gun/sea.js",
"gun/lib/then",
"gun/lib/webrtc",
"gun/lib/radix",
"gun/lib/radisk",
"gun/lib/store",
"gun/lib/rindexed",
],
},
export default defineConfig({
base: "./",
build: {
outDir: "./demo",
optimizeDeps: {
include: [
"gun",
"gun/gun",
"gun/sea",
"gun/sea.js",
"gun/lib/then",
"gun/lib/webrtc",
"gun/lib/radix",
"gun/lib/radisk",
"gun/lib/store",
"gun/lib/rindexed",
],
},
},
plugins: [
Vue({
template: {
compilerOptions: {
isCustomElement: tag => tag == 'gun-avatar'
}
}
}),
WindiCSS({
scan: {
dirs: ["src/demo/"],
exclude: ["/node_modules/"],
fileExtensions: ["vue", "ts"],
},
};
}
return config;
});
config: { separator: "_", }
}),
Icons({
/* options */
}),
Components({
dirs: ["src/demo/components/"],
extensions: ["html", "vue"],
directoryAsNamespace: true,
globalNamespaces: ["global"],
include: [/\.vue$/, /\.vue\?vue/, /\.html$/],
exclude: [/node_modules/, /\.git/],
resolvers: [
IconsResolver({
componentPrefix: "",
}),
],
}),
],
})



Expand Down
12 changes: 12 additions & 0 deletions vite.config.lib.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import path from "path";
import { defineConfig } from "vite";

export default defineConfig({
build: {
outDir: "./dist",
lib: {
entry: path.resolve(__dirname, "./src/main.js"),
name: "gun-avatar",
},
},
})

0 comments on commit a6f69a6

Please sign in to comment.