diff --git a/.gitignore b/.gitignore index 32c29dd..285db2c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ node_modules/ pnpm-lock.yaml -stats.html \ No newline at end of file +stats.html +options.toml \ No newline at end of file diff --git a/options.default.toml b/options.default.toml new file mode 100644 index 0000000..684c0e8 --- /dev/null +++ b/options.default.toml @@ -0,0 +1,5 @@ +#Passes configuration directly into rollup-plugin-jscc, refer to it's documentation for more details + +[values] +_DEBUG = 0 #does nothing as of now +_ANALYTICS = 0 #enables analytics nagging \ No newline at end of file diff --git a/package.json b/package.json index ddcd09f..01910ec 100644 --- a/package.json +++ b/package.json @@ -10,8 +10,10 @@ "author": "Drake", "license": "BSD-3-Clause", "dependencies": { + "@ltd/j-toml": "^1.30.0", "idb-keyval": "^6.1.0", "nests": "^2.3.1", + "rollup-plugin-jscc": "^2.0.0", "rollup-plugin-visualizer": "^5.7.0", "spitroast": "^1.4.2" }, diff --git a/rollup.config.js b/rollup.config.js index 0309fcc..8c44baf 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -5,9 +5,22 @@ import alias from "@rollup/plugin-alias"; import { swc } from "rollup-plugin-swc3"; import { resolve as resolvePath } from "path"; import { visualizer } from "rollup-plugin-visualizer"; +import TOML from "@ltd/j-toml"; +import jscc from "rollup-plugin-jscc"; +import { readFileSync as readFile, existsSync as fileExists } from "fs"; const projectRootDir = resolvePath(__dirname); +let data + +if (fileExists("options.toml")) { + data = readFile("options.toml") +} else if (fileExists("options.default.toml")) { + data = readFile("options.default.toml") +} else { + throw new Error("Could not find options file") +} + export default defineConfig({ input: pkjs.main, output: { @@ -16,6 +29,7 @@ export default defineConfig({ }, external: ["React"], plugins: [ + jscc(TOML.parse(data)), alias({ entries: [ { diff --git a/src/api/analytics.js b/src/api/analytics.js new file mode 100644 index 0000000..a522979 --- /dev/null +++ b/src/api/analytics.js @@ -0,0 +1,9 @@ +import modals from "./utils/modals"; + +/* demon.summon("utils/modals").openConfirmModal("Test Modal", "confirm", { + header: "Demoncord" +}) */ + +export default { + init: ()=>{} +} \ No newline at end of file diff --git a/src/index.js b/src/index.js index cdf80e5..8d66d29 100644 --- a/src/index.js +++ b/src/index.js @@ -60,3 +60,7 @@ window.demon = { plugins.init(); settings.init(); +/*//#if _ANALYTICS +import analytics from "./api/analytics" +analytics.init() +//#endif*/ \ No newline at end of file