Skip to content

Commit

Permalink
adjust module paths and tree shaking stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
DanC5 committed May 13, 2021
1 parent 703f007 commit d59249d
Show file tree
Hide file tree
Showing 99 changed files with 122 additions and 135 deletions.
1 change: 0 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ dist
/src/styles/vendor/
*.md
babel.i18next-extract.js
/built
/coverage
types/index.d.ts
src/components/Channel/types.ts
Expand Down
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,3 @@ client/dist
/.virtualgo
.vscode/
coverage.out

/built
1 change: 0 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@ src/stream-emoji.json
/include/
/build/
build
/built
*.md
src/components/docs/
23 changes: 12 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
"description": "React components to create chat conversations or livestream style chat",
"author": "GetStream",
"homepage": "https://getstream.io/chat/",
"typings": "built/types/src/index.d.ts",
"main": "dist/index.js",
"module": "dist/index.es.js",
"jsnext:main": "dist/index.es.js",
"typings": "dist/index.d.ts",
"main": "dist/index.cjs.js",
"module": "dist/index.js",
"jsnext:main": "dist/index.js",
"style": "dist/css/index.css",
"sideEffects": false,
"jsdelivr": "./dist/browser.full-bundle.min.js",
"keywords": [
"chat",
Expand Down Expand Up @@ -55,9 +56,8 @@
"stream-chat": "^3.1.0"
},
"files": [
"built",
"dist",
"types",
"package.json",
"README.md"
],
"devDependencies": {
Expand All @@ -73,7 +73,7 @@
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^10.0.0",
"@rollup/plugin-replace": "^2.3.4",
"@rollup/plugin-typescript": "^8.1.1",
"@rollup/plugin-typescript": "8.2.1",
"@stream-io/rollup-plugin-node-builtins": "^2.1.5",
"@testing-library/jest-dom": "5.11.6",
"@testing-library/react": "^11.2.2",
Expand Down Expand Up @@ -156,7 +156,8 @@
"stylelint-config-standard": "^20.0.0",
"stylelint-scss": "^3.18.0",
"ts-jest": "^26.5.1",
"typescript": "4.1.3",
"tslib": "^2.2.0",
"typescript": "4.2.4",
"url-loader": "^4.1.1",
"webpack": "4.44.2",
"webpack-cli": "^3.3.12",
Expand All @@ -169,12 +170,12 @@
},
"scripts": {
"analyze": "yarn build -- --stats && webpack-bundle-analyzer build/bundle-stats.json",
"build": "mkdir -p dist/assets assets && yarn build-translations && yarn types && yarn --silent copy-translations && yarn bundle",
"build": "rm -rf dist && mkdir -p dist/assets assets && yarn --silent copy-version && yarn build-translations && yarn types && yarn bundle",
"build-styles": "sass src/styles/index.scss dist/css/index.css --style compressed",
"bundle": "rollup -c",
"bundle-size": "BUNDLE_SIZE=true yarn bundle",
"build-translations": "rm -rf .tmpi18ncache || true && mkdir .tmpi18ncache && yarn run babel --config-file ./babel.i18next-extract.js --extensions '.ts','.tsx','.js','.jsx' 'src/**/*.{js,jsx,ts,tsx}' --out-dir '.tmpi18ncache/' && rm -rf .tmpi18ncache && prettier --write 'src/i18n/*.{js,jsx,ts,tsx,json}'",
"copy-translations": "echo '\u001b[34mℹ\u001b[0m Copying translation files to \u001b[34mbuilt/types/src/i18n\u001b[0m' && cp -R -f ./src/i18n/*.json ./built/types/src/i18n && echo '\u001b[32m✓\u001b[0m Done Copying Translations'",
"copy-version": "echo '\u001b[34mℹ\u001b[0m Copying Version to \u001b[34msrc/version.ts\u001b[0m' && PACKAGE_VERSION=$(node -pe 'require(`./package.json`).version') && PACKAGE_STRING=\"'$PACKAGE_VERSION'\" && echo 'export const version = '$PACKAGE_STRING';' > src/version.ts && echo '\u001b[32m✓\u001b[0m Done Copying Version'",
"coverage": "yarn test --collectCoverage && codecov",
"docs": "styleguidist build",
"docs-server": "styleguidist server",
Expand All @@ -188,7 +189,7 @@
"postversion": "git push && git push --tags && npm publish",
"prepare": "yarn run build",
"preversion": "yarn install && yarn lint && yarn test",
"test": "rm -rf built && jest",
"test": "jest",
"types": "tsc --strict",
"validate-translations": "node scripts/validate-translations.js",
"version": "yarn docs && git add docs",
Expand Down
13 changes: 0 additions & 13 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,6 @@ const basePlugins = [
preventAssignment: true,
'process.env.NODE_ENV': JSON.stringify('production'),
}),
// Replace our alias for a relative path so the jsdoc resolution still
// works after bundling.
replace({
delimiters: ['', ''],
"import('types')": "import('../types')",
preventAssignment: true,
}),
// Remove peer-dependencies from final bundle
external(),
typescript(),
Expand All @@ -114,7 +107,6 @@ const basePlugins = [
[
{ dest: 'dist/scss', files: 'src/styles/**/*' },
{ dest: 'dist/assets', files: 'src/assets/*' },
{ dest: 'dist/i18n', files: 'src/i18n/*.json' },
],
{
verbose: process.env.VERBOSE,
Expand All @@ -135,11 +127,6 @@ const normalBundle = {
format: 'cjs',
sourcemap: true,
},
{
file: pkg.module,
format: 'es',
sourcemap: true,
},
],
plugins: [...basePlugins],
};
Expand Down
2 changes: 1 addition & 1 deletion src/components/Attachment/Attachment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import type { Attachment as StreamAttachment } from 'stream-chat';

import type { ActionHandlerReturnType } from '../Message';

import type { DefaultAttachmentType } from '../../../types/types';
import type { DefaultAttachmentType } from '../../types/types';

export type AttachmentProps<At extends DefaultAttachmentType = DefaultAttachmentType> = {
/**
Expand Down
2 changes: 1 addition & 1 deletion src/components/Attachment/Audio.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useCallback, useEffect, useRef, useState } from 'react';

import type { Attachment } from 'stream-chat';

import type { DefaultAttachmentType } from '../../../types/types';
import type { DefaultAttachmentType } from '../../types/types';

const progressUpdateInterval = 500;
/**
Expand Down
2 changes: 1 addition & 1 deletion src/components/Attachment/FileAttachment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { SafeAnchor } from '../SafeAnchor';

import type { Attachment } from 'stream-chat';

import type { DefaultAttachmentType } from '../../../types/types';
import type { DefaultAttachmentType } from '../../types/types';

export type FileAttachmentProps<At extends DefaultAttachmentType = DefaultAttachmentType> = {
attachment: Attachment<At>;
Expand Down
2 changes: 1 addition & 1 deletion src/components/Attachment/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import type {
InnerAttachmentUIComponentProps,
} from './Attachment';

import type { DefaultAttachmentType } from '../../../types/types';
import type { DefaultAttachmentType } from '../../types/types';

export const SUPPORTED_VIDEO_FORMATS = ['video/mp4', 'video/ogg', 'video/webm', 'video/quicktime'];

Expand Down
2 changes: 1 addition & 1 deletion src/components/Channel/Channel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ import type {
DefaultMessageType,
DefaultReactionType,
DefaultUserType,
} from '../../../types/types';
} from '../../types/types';

export type ChannelProps<
At extends DefaultAttachmentType = DefaultAttachmentType,
Expand Down
2 changes: 1 addition & 1 deletion src/components/Channel/channelState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import type {
DefaultMessageType,
DefaultReactionType,
DefaultUserType,
} from '../../../types/types';
} from '../../types/types';

export type ChannelStateReducerAction<
At extends DefaultAttachmentType = DefaultAttachmentType,
Expand Down
2 changes: 1 addition & 1 deletion src/components/Channel/hooks/useEditMessageHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import type {
DefaultMessageType,
DefaultReactionType,
DefaultUserType,
} from '../../../../types/types';
} from '../../../types/types';

type UpdateHandler<
At extends DefaultAttachmentType = DefaultAttachmentType,
Expand Down
2 changes: 1 addition & 1 deletion src/components/Channel/hooks/useMentionsHandlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useCallback } from 'react';

import type { UserResponse } from 'stream-chat';

import type { DefaultUserType } from '../../../../types/types';
import type { DefaultUserType } from '../../../types/types';

export type OnMentionAction<Us extends DefaultUserType<Us> = DefaultUserType> = (
event: React.BaseSyntheticEvent,
Expand Down
2 changes: 1 addition & 1 deletion src/components/ChannelHeader/ChannelHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import type {
DefaultMessageType,
DefaultReactionType,
DefaultUserType,
} from '../../../types/types';
} from '../../types/types';

export type ChannelHeaderProps = {
/**
Expand Down
2 changes: 1 addition & 1 deletion src/components/ChannelList/ChannelList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import type {
DefaultMessageType,
DefaultReactionType,
DefaultUserType,
} from '../../../types/types';
} from '../../types/types';

const DEFAULT_FILTERS = {};
const DEFAULT_OPTIONS = {};
Expand Down
2 changes: 1 addition & 1 deletion src/components/ChannelList/ChannelListTeam.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import type {
DefaultMessageType,
DefaultReactionType,
DefaultUserType,
} from '../../../types/types';
} from '../../types/types';

export type ChannelListTeamProps = {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import type {
DefaultMessageType,
DefaultReactionType,
DefaultUserType,
} from '../../../../types/types';
} from '../../../types/types';

export const useChannelDeletedListener = <
At extends DefaultAttachmentType = DefaultAttachmentType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import type {
DefaultMessageType,
DefaultReactionType,
DefaultUserType,
} from '../../../../types/types';
} from '../../../types/types';

export const useChannelHiddenListener = <
At extends DefaultAttachmentType = DefaultAttachmentType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import type {
DefaultMessageType,
DefaultReactionType,
DefaultUserType,
} from '../../../../types/types';
} from '../../../types/types';

export const useChannelTruncatedListener = <
At extends DefaultAttachmentType = DefaultAttachmentType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import type {
DefaultMessageType,
DefaultReactionType,
DefaultUserType,
} from '../../../../types/types';
} from '../../../types/types';

export const useChannelUpdatedListener = <
At extends DefaultAttachmentType = DefaultAttachmentType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import type {
DefaultMessageType,
DefaultReactionType,
DefaultUserType,
} from '../../../../types/types';
} from '../../../types/types';

export const useChannelVisibleListener = <
At extends DefaultAttachmentType = DefaultAttachmentType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import type {
DefaultMessageType,
DefaultReactionType,
DefaultUserType,
} from '../../../../types/types';
} from '../../../types/types';

export const useConnectionRecoveredListener = <
At extends DefaultAttachmentType = DefaultAttachmentType,
Expand Down
2 changes: 1 addition & 1 deletion src/components/ChannelList/hooks/useMessageNewListener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import type {
DefaultMessageType,
DefaultReactionType,
DefaultUserType,
} from '../../../../types/types';
} from '../../../types/types';

export const useMessageNewListener = <
At extends DefaultAttachmentType = DefaultAttachmentType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import type {
DefaultMessageType,
DefaultReactionType,
DefaultUserType,
} from '../../../../types/types';
} from '../../../types/types';

export const useNotificationAddedToChannelListener = <
At extends DefaultAttachmentType = DefaultAttachmentType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import type {
DefaultMessageType,
DefaultReactionType,
DefaultUserType,
} from '../../../../types/types';
} from '../../../types/types';

export const useNotificationMessageNewListener = <
At extends DefaultAttachmentType = DefaultAttachmentType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import type {
DefaultMessageType,
DefaultReactionType,
DefaultUserType,
} from '../../../../types/types';
} from '../../../types/types';

export const useNotificationRemovedFromChannelListener = <
At extends DefaultAttachmentType = DefaultAttachmentType,
Expand Down
2 changes: 1 addition & 1 deletion src/components/ChannelList/hooks/usePaginatedChannels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import type {
DefaultMessageType,
DefaultReactionType,
DefaultUserType,
} from '../../../../types/types';
} from '../../../types/types';

export const usePaginatedChannels = <
At extends DefaultAttachmentType = DefaultAttachmentType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import type {
DefaultMessageType,
DefaultReactionType,
DefaultUserType,
} from '../../../../types/types';
} from '../../../types/types';

export const useUserPresenceChangedListener = <
At extends DefaultAttachmentType = DefaultAttachmentType,
Expand Down
2 changes: 1 addition & 1 deletion src/components/ChannelList/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type {
DefaultMessageType,
DefaultReactionType,
DefaultUserType,
} from '../../../types/types';
} from '../../types/types';

export const getChannel = async <
At extends DefaultAttachmentType = DefaultAttachmentType,
Expand Down
2 changes: 1 addition & 1 deletion src/components/ChannelPreview/ChannelPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import type {
DefaultMessageType,
DefaultReactionType,
DefaultUserType,
} from '../../../types/types';
} from '../../types/types';

export type ChannelPreviewUIComponentProps<
At extends DefaultAttachmentType = DefaultAttachmentType,
Expand Down
2 changes: 1 addition & 1 deletion src/components/ChannelPreview/ChannelPreviewCompact.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import type {
DefaultMessageType,
DefaultReactionType,
DefaultUserType,
} from '../../../types/types';
} from '../../types/types';

const UnMemoizedChannelPreviewCompact = <
At extends DefaultAttachmentType = DefaultAttachmentType,
Expand Down
2 changes: 1 addition & 1 deletion src/components/ChannelPreview/ChannelPreviewCountOnly.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import type {
DefaultMessageType,
DefaultReactionType,
DefaultUserType,
} from '../../../types/types';
} from '../../types/types';

const UnMemoizedChannelPreviewCountOnly = <
At extends DefaultAttachmentType = DefaultAttachmentType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import type {
DefaultMessageType,
DefaultReactionType,
DefaultUserType,
} from '../../../types/types';
} from '../../types/types';

const UnMemoizedChannelPreviewLastMessage = <
At extends DefaultAttachmentType = DefaultAttachmentType,
Expand Down
2 changes: 1 addition & 1 deletion src/components/ChannelPreview/ChannelPreviewMessenger.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import type {
DefaultMessageType,
DefaultReactionType,
DefaultUserType,
} from '../../../types/types';
} from '../../types/types';

const UnMemoizedChannelPreviewMessenger = <
At extends DefaultAttachmentType = DefaultAttachmentType,
Expand Down
2 changes: 1 addition & 1 deletion src/components/ChannelPreview/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import type {
DefaultMessageType,
DefaultReactionType,
DefaultUserType,
} from '../../../types/types';
} from '../../types/types';

export const getLatestMessagePreview = <
At extends DefaultAttachmentType = DefaultAttachmentType,
Expand Down
Loading

0 comments on commit d59249d

Please sign in to comment.