Add a build step in dev mode to create a symlink to the compendium packs on disk
This commit is contained in:
parent
47deb24d67
commit
2567f5fb62
1 changed files with 20 additions and 1 deletions
|
|
@ -1,9 +1,9 @@
|
||||||
/* eslint-disable no-undef */
|
/* eslint-disable no-undef */
|
||||||
|
|
||||||
|
import { readFileSync, symlinkSync } from "fs";
|
||||||
import { defineConfig } from "vite";
|
import { defineConfig } from "vite";
|
||||||
import { glob } from "glob";
|
import { glob } from "glob";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import { readFileSync } from "fs";
|
|
||||||
|
|
||||||
// MARK: custom plugins
|
// MARK: custom plugins
|
||||||
function fileMarkerPlugin() {
|
function fileMarkerPlugin() {
|
||||||
|
|
@ -41,6 +41,24 @@ function watcher(...globs) {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
The intent of this plugin is to handle the symlinking of the compendium packs
|
||||||
|
so that they can modified during dev without needing to worry about the rebuild
|
||||||
|
destroying the in-progress compendia data.
|
||||||
|
*/
|
||||||
|
function handlePacks() {
|
||||||
|
return {
|
||||||
|
writeBundle(options) {
|
||||||
|
console.log(options.dir);
|
||||||
|
symlinkSync(
|
||||||
|
path.resolve(__dirname, `packs`),
|
||||||
|
`${options.dir}/packs`,
|
||||||
|
`dir`,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
// MARK: config
|
// MARK: config
|
||||||
export default defineConfig(({ mode }) => {
|
export default defineConfig(({ mode }) => {
|
||||||
const isProd = mode === `prod`;
|
const isProd = mode === `prod`;
|
||||||
|
|
@ -49,6 +67,7 @@ export default defineConfig(({ mode }) => {
|
||||||
|
|
||||||
if (!isProd) {
|
if (!isProd) {
|
||||||
plugins.push(
|
plugins.push(
|
||||||
|
handlePacks(),
|
||||||
watcher(
|
watcher(
|
||||||
`./public`,
|
`./public`,
|
||||||
),
|
),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue