This commit is contained in:
syuilo 2020-09-06 15:05:00 +09:00
parent 339a7d64d7
commit 3762116c17
9 changed files with 53 additions and 39 deletions

8
src/client/.eslintrc Normal file
View File

@ -0,0 +1,8 @@
{
"globals": {
"_DEV_": false,
"_LANGS_": false,
"_VERSION_": false,
"_ENV_": false
}
}

4
src/client/@types/global.d.ts vendored Normal file
View File

@ -0,0 +1,4 @@
declare const _LANGS_: string[];
declare const _VERSION_: string;
declare const _ENV_: string;
declare const _DEV_: boolean;

View File

@ -1,9 +1,5 @@
import { clientDb, entries } from './db'; import { clientDb, entries } from './db';
declare const _LANGS_: string[];
declare const _VERSION_: string;
declare const _ENV_: string;
const address = new URL(location.href); const address = new URL(location.href);
const siteName = (document.querySelector('meta[property="og:site_name"]') as HTMLMetaElement)?.content; const siteName = (document.querySelector('meta[property="og:site_name"]') as HTMLMetaElement)?.content;
@ -16,7 +12,5 @@ export const lang = localStorage.getItem('lang');
export const langs = _LANGS_; export const langs = _LANGS_;
export const getLocale = async () => Object.fromEntries((await entries(clientDb.i18n)) as [string, string][]); export const getLocale = async () => Object.fromEntries((await entries(clientDb.i18n)) as [string, string][]);
export const version = _VERSION_; export const version = _VERSION_;
export const env = _ENV_;
export const instanceName = siteName === 'Misskey' ? null : siteName; export const instanceName = siteName === 'Misskey' ? null : siteName;
export const deckmode = localStorage.getItem('deckmode') === 'true'; export const deckmode = localStorage.getItem('deckmode') === 'true';
export const _DEV_ = env !== 'production';

View File

@ -25,6 +25,10 @@ import { stream, sound, isMobile } from '@/os';
console.info(`Misskey v${version}`); console.info(`Misskey v${version}`);
if (_DEV_) {
console.log('Development mode');
}
if (localStorage.getItem('theme') == null) { if (localStorage.getItem('theme') == null) {
applyTheme(lightTheme); applyTheme(lightTheme);
} }

View File

@ -4,6 +4,8 @@ import { onScrollTop, isTopVisible } from './scroll';
const SECOND_FETCH_LIMIT = 30; const SECOND_FETCH_LIMIT = 30;
export default (opts) => ({ export default (opts) => ({
emits: ['queue'],
data() { data() {
return { return {
items: [], items: [],

View File

@ -24,7 +24,8 @@
}, },
"typeRoots": [ "typeRoots": [
"node_modules/@types", "node_modules/@types",
"src/@types" "src/@types",
"src/client/@types"
], ],
"lib": [ "lib": [
"esnext", "esnext",

View File

@ -132,7 +132,8 @@ module.exports = {
new webpack.DefinePlugin({ new webpack.DefinePlugin({
_VERSION_: JSON.stringify(meta.version), _VERSION_: JSON.stringify(meta.version),
_LANGS_: JSON.stringify(Object.entries(locales).map(([k, v]: [string, any]) => [k, v._lang_])), _LANGS_: JSON.stringify(Object.entries(locales).map(([k, v]: [string, any]) => [k, v._lang_])),
_ENV_: JSON.stringify(process.env.NODE_ENV) _ENV_: JSON.stringify(process.env.NODE_ENV),
_DEV_: JSON.stringify(process.env.NODE_ENV) !== 'production',
}), }),
new VueLoaderPlugin(), new VueLoaderPlugin(),
new WebpackOnBuildPlugin((stats: any) => { new WebpackOnBuildPlugin((stats: any) => {