diff --git a/src/client/.eslintrc b/src/client/.eslintrc new file mode 100644 index 0000000000..baff352604 --- /dev/null +++ b/src/client/.eslintrc @@ -0,0 +1,8 @@ +{ + "globals": { + "_DEV_": false, + "_LANGS_": false, + "_VERSION_": false, + "_ENV_": false + } +} diff --git a/src/client/@types/global.d.ts b/src/client/@types/global.d.ts new file mode 100644 index 0000000000..9f600268c8 --- /dev/null +++ b/src/client/@types/global.d.ts @@ -0,0 +1,4 @@ +declare const _LANGS_: string[]; +declare const _VERSION_: string; +declare const _ENV_: string; +declare const _DEV_: boolean; diff --git a/src/client/v.d.ts b/src/client/@types/vue.d.ts similarity index 100% rename from src/client/v.d.ts rename to src/client/@types/vue.d.ts diff --git a/src/client/vuex-shim.d.ts b/src/client/@types/vuex-shim.d.ts similarity index 100% rename from src/client/vuex-shim.d.ts rename to src/client/@types/vuex-shim.d.ts diff --git a/src/client/config.ts b/src/client/config.ts index 8b9091649d..ac8d7d9528 100644 --- a/src/client/config.ts +++ b/src/client/config.ts @@ -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'; diff --git a/src/client/init.ts b/src/client/init.ts index cc09edd587..b5c02ba3ab 100644 --- a/src/client/init.ts +++ b/src/client/init.ts @@ -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); } diff --git a/src/client/scripts/paging.ts b/src/client/scripts/paging.ts index debb81db44..01d47b72cc 100644 --- a/src/client/scripts/paging.ts +++ b/src/client/scripts/paging.ts @@ -4,6 +4,8 @@ import { onScrollTop, isTopVisible } from './scroll'; const SECOND_FETCH_LIMIT = 30; export default (opts) => ({ + emits: ['queue'], + data() { return { items: [], diff --git a/src/client/tsconfig.json b/src/client/tsconfig.json index c74db69c1e..e6a6b8eb2d 100644 --- a/src/client/tsconfig.json +++ b/src/client/tsconfig.json @@ -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" + ] } diff --git a/webpack.config.ts b/webpack.config.ts index 813a82ae86..2674203b4b 100644 --- a/webpack.config.ts +++ b/webpack.config.ts @@ -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) => {