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';
declare const _LANGS_: string[];
declare const _VERSION_: string;
declare const _ENV_: string;
const address = new URL(location.href);
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 getLocale = async () => Object.fromEntries((await entries(clientDb.i18n)) as [string, string][]);
export const version = _VERSION_;
export const env = _ENV_;
export const instanceName = siteName === 'Misskey' ? null : siteName;
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}`);
if (_DEV_) {
console.log('Development mode');
}
if (localStorage.getItem('theme') == null) {
applyTheme(lightTheme);
}

View File

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

View File

@ -1,39 +1,40 @@
{
"compilerOptions": {
"allowJs": true,
"noEmitOnError": false,
"noImplicitAny": false,
"noImplicitReturns": true,
"noUnusedParameters": false,
"noUnusedLocals": true,
"noFallthroughCasesInSwitch": true,
"declaration": false,
"sourceMap": false,
"target": "es2017",
"module": "esnext",
"moduleResolution": "node",
"removeComments": false,
"noLib": false,
"strict": true,
"strictNullChecks": false,
"experimentalDecorators": true,
"compilerOptions": {
"allowJs": true,
"noEmitOnError": false,
"noImplicitAny": false,
"noImplicitReturns": true,
"noUnusedParameters": false,
"noUnusedLocals": true,
"noFallthroughCasesInSwitch": true,
"declaration": false,
"sourceMap": false,
"target": "es2017",
"module": "esnext",
"moduleResolution": "node",
"removeComments": false,
"noLib": false,
"strict": true,
"strictNullChecks": false,
"experimentalDecorators": true,
"resolveJsonModule": true,
"baseUrl": ".",
"paths": {
"@/*": ["./*"]
},
"typeRoots": [
"node_modules/@types",
"src/@types"
],
"lib": [
"esnext",
"dom",
"webworker"
]
},
"compileOnSave": false,
"include": [
"./**/*.ts"
]
"typeRoots": [
"node_modules/@types",
"src/@types",
"src/client/@types"
],
"lib": [
"esnext",
"dom",
"webworker"
]
},
"compileOnSave": false,
"include": [
"./**/*.ts"
]
}

View File

@ -132,7 +132,8 @@ module.exports = {
new webpack.DefinePlugin({
_VERSION_: JSON.stringify(meta.version),
_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 WebpackOnBuildPlugin((stats: any) => {