formatting

This commit is contained in:
Kainoa Kanter 2023-04-07 23:07:04 -07:00
parent 273fb76548
commit 2e9ae4b695
6 changed files with 37 additions and 34 deletions

View File

@ -1,15 +1,15 @@
import { CapacitorConfig } from '@capacitor/cli'; import { CapacitorConfig } from "@capacitor/cli";
const config: CapacitorConfig = { const config: CapacitorConfig = {
appId: 'org.calckey.app', appId: "org.calckey.app",
appName: 'Calckey', appName: "Calckey",
webDir: '../../built/_client_dist_', webDir: "../../built/_client_dist_",
bundledWebRuntime: false, bundledWebRuntime: false,
plugins: { plugins: {
PushNotifications: { PushNotifications: {
presentationOptions: ["badge", "sound", "alert"] presentationOptions: ["badge", "sound", "alert"],
} },
} },
}; };
export default config; export default config;

View File

@ -16,9 +16,11 @@ export const url = $i?.instanceUrl;
export const url = address.origin; export const url = address.origin;
// #v-endif // #v-endif
export const apiUrl = `${url ? url : "http://localhost"}/api`; export const apiUrl = `${url ? url : "http://localhost"}/api`;
export const wsUrl = `${url ? url export const wsUrl = `${
.replace("http://", "ws://") url
.replace("https://", "wss://") : "ws://localhost"}/streaming`; ? url.replace("http://", "ws://").replace("https://", "wss://")
: "ws://localhost"
}/streaming`;
export const lang = localStorage.getItem("lang"); export const lang = localStorage.getItem("lang");
export const langs = _LANGS_; export const langs = _LANGS_;
export const locale = JSON.parse(localStorage.getItem("locale")); export const locale = JSON.parse(localStorage.getItem("locale"));

View File

@ -12,4 +12,3 @@ declare module "@vue/runtime-core" {
$ts: typeof i18n["locale"]; $ts: typeof i18n["locale"];
} }
} }

View File

@ -146,7 +146,7 @@ function compile(theme: Theme): Record<string, string> {
// #v-ifdef VITE_CAPACITOR // #v-ifdef VITE_CAPACITOR
if (storedDeviceInfo.platform === "ios") { if (storedDeviceInfo.platform === "ios") {
StatusBar.setStyle({ StatusBar.setStyle({
style: theme.base === "dark" ? Style.Dark : Style.Light, style: theme.base === "dark" ? Style.Dark : Style.Light,
}); });
} }
// #v-endif // #v-endif

View File

@ -6,7 +6,7 @@ import { url } from "@/config";
export const stream = markRaw( export const stream = markRaw(
new Misskey.Stream( new Misskey.Stream(
// #v-ifdef VITE_CAPACITOR // #v-ifdef VITE_CAPACITOR
$i? $i.instanceUrl : "localhost", $i ? $i.instanceUrl : "localhost",
// #v-else // #v-else
url, url,
// #v-endif // #v-endif

View File

@ -2,14 +2,14 @@ import * as fs from "fs";
import pluginVue from "@vitejs/plugin-vue"; import pluginVue from "@vitejs/plugin-vue";
import { defineConfig } from "vite"; import { defineConfig } from "vite";
import locales from '../../locales'; import locales from "../../locales";
import { dependencies } from './package.json'; import { dependencies } from "./package.json";
import meta from '../../package.json'; import meta from "../../package.json";
import pluginJson5 from './vite.json5'; import pluginJson5 from "./vite.json5";
import viteCompression from 'vite-plugin-compression'; import viteCompression from "vite-plugin-compression";
import ConditionalCompile from "vite-plugin-conditional-compiler"; import ConditionalCompile from "vite-plugin-conditional-compiler";
import tsconfigPaths from 'vite-tsconfig-paths' import tsconfigPaths from "vite-tsconfig-paths";
const extensions = [ const extensions = [
".ts", ".ts",
@ -28,7 +28,11 @@ const extensions = [
export default defineConfig(({ command, mode }) => { export default defineConfig(({ command, mode }) => {
fs.mkdirSync(`${__dirname}/../../built`, { recursive: true }); fs.mkdirSync(`${__dirname}/../../built`, { recursive: true });
fs.writeFileSync(`${__dirname}/../../built/meta.json`, JSON.stringify({ version: meta.version }), 'utf-8'); fs.writeFileSync(
`${__dirname}/../../built/meta.json`,
JSON.stringify({ version: meta.version }),
"utf-8",
);
return { return {
base: "/assets/", base: "/assets/",
@ -52,9 +56,9 @@ export default defineConfig(({ command, mode }) => {
resolve: { resolve: {
extensions, extensions,
alias: { alias: {
'@/': `${__dirname}/src/`, "@/": `${__dirname}/src/`,
'/client-assets/': `${__dirname}/assets/`, "/client-assets/": `${__dirname}/assets/`,
'/static-assets/': `${__dirname}/../backend/assets/`, "/static-assets/": `${__dirname}/../backend/assets/`,
}, },
}, },
@ -74,25 +78,23 @@ export default defineConfig(({ command, mode }) => {
}, },
build: { build: {
target: [ target: ["es2017"],
'es2017', manifest: "manifest.json",
],
manifest: 'manifest.json',
rollupOptions: { rollupOptions: {
input: { input: {
index: 'index.html', index: "index.html",
app: './src/init.ts', app: "./src/init.ts",
}, },
output: { output: {
manualChunks: { manualChunks: {
vendor: ['vue'], vendor: ["vue"],
} },
}, },
}, },
cssCodeSplit: true, cssCodeSplit: true,
assetsInlineLimit: 0, assetsInlineLimit: 0,
outDir: `${__dirname}/../../built/_client_dist_`, outDir: `${__dirname}/../../built/_client_dist_`,
assetsDir: '.', assetsDir: ".",
emptyOutDir: false, emptyOutDir: false,
sourcemap: process.env.NODE_ENV === "development", sourcemap: process.env.NODE_ENV === "development",
reportCompressedSize: false, reportCompressedSize: false,