Felicio Mununga abd26c9c1d
Indicate unread chats and mentions (#303)
* add activityCenter.ts

* use `process.env.VITEST`

* add `isMention` and `isReply`

* use activityCenter.ts

* fix initial `count`

* add `Badge` component

* add "Launch via Vite Node"

* remove comments

* remove `console.log`

* add comments

* type hook

* reverse order of notifications

* remove `activityCenter` from `provider.tsx`

* set `count`'s default value

* ref `ChatMessage` by id instead of object reference

* Revert "ref `ChatMessage` by id instead of object reference"

This reverts commit 1284386d22146345d1778b92bf104b49781bd4cb.

* use `isAuthor`
2022-09-16 15:49:20 +02:00

49 lines
1.0 KiB
TypeScript

/// <reference types="vitest" />
import { defineConfig } from 'vite'
import { dependencies } from './package.json'
import type { Alias } from 'vite'
const external = [
...Object.keys(dependencies || {}),
// ...Object.keys(peerDependencies || {}),
].map(name => new RegExp(`^${name}(/.*)?`))
export default defineConfig(({ mode }) => {
const alias: Alias[] = []
if (process.env.VITEST === 'true' || mode === 'test') {
alias.push({
/**
* Note: `happy-dom` nor `jsdom` have Crypto implemented (@see https://github.com/jsdom/jsdom/issues/1612)
*/
find: /^.*\/crypto\/pbkdf2.browser$/,
replacement: 'ethereum-cryptography/pbkdf2',
})
}
return {
build: {
target: 'es2020',
lib: {
entry: './src/index.ts',
fileName: 'index',
formats: ['es'],
},
sourcemap: true,
emptyOutDir: mode === 'production',
rollupOptions: {
external,
},
},
resolve: {
alias,
},
test: {
environment: 'happy-dom',
},
}
})