Skip to content

Commit

Permalink
Merge pull request #33 from Gearonix/refactoring
Browse files Browse the repository at this point in the history
merge(refactoring): merged
  • Loading branch information
gearonix authored Oct 6, 2023
2 parents 0d88986 + e999079 commit 5724b08
Show file tree
Hide file tree
Showing 439 changed files with 1,384 additions and 1,203 deletions.
49 changes: 3 additions & 46 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,49 +1,6 @@
const {configure, presets} = require('eslint-kit')
const grnx = require('@grnx-utils/eslint')

module.exports = configure({
mode: 'only-errors',
allowDebug: process.env.NODE_ENV !== 'production',
module.exports = grnx({
root: __dirname,
presets: [
presets.node(),
presets.prettier({
singleQuote: true,
trailingComma: 'none',
endOfLine: 'auto'
}),
presets.typescript({
tsconfig: 'tsconfig.base.json',
root: './'
}),
presets.react(),
// eslint runs forever because of this preset
// ---
// presets.imports({
// sort: {
// newline: true
// }
// })
],
extend: {
root: true,
ignorePatterns: ["**/*"],
plugins: ['@nx', 'prefer-arrow'],
rules: {
'react/react-in-jsx-scope': 'off',
quotes: [2, 'single', { avoidEscape: true }],
'@typescript-eslint/no-namespace': 'off',
'@typescript-eslint/member-delimiter-style': [
'error',
{ multiline: { delimiter: 'none' } }
],
'import/no-unresolved': 'off',
'@typescript-eslint/no-unnecessary-condition': 'off',
'import/extensions': 'off',
'react-hooks/exhaustive-deps': 'warn',
'react/no-array-index-key': 'warn',
'@typescript-eslint/no-explicit-any': 'warn',
'dot-notation': 'off',
'prefer-arrow/prefer-arrow-functions': 'error'
}
}
tsconfig: 'tsconfig.base.json'
})
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
run: yarn install

- name: Creating a Production Build
run: yarn run build
run: yarn dlx nx run-many -t=build -p client server --parallel=8

build-storybook:
name: Building and deploying storybook
Expand Down
2 changes: 1 addition & 1 deletion .lintstagedrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"*.ts": ["yarn run lint"]
"*.ts": ["yarn dlx nx run-many --targets=lint --all --parallel=8"]
}
1 change: 1 addition & 0 deletions .yarn/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
cache
install-state.gz
unplugged
14 changes: 7 additions & 7 deletions .yarn/releases/yarn-3.6.2.cjs → .yarn/releases/yarn-3.6.3.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ plugins:
- path: .yarn/plugins/@yarnpkg/plugin-typescript.cjs
spec: "@yarnpkg/plugin-typescript"

yarnPath: .yarn/releases/yarn-3.6.2.cjs
yarnPath: .yarn/releases/yarn-3.6.3.cjs
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@
* initialized preact app by using nx ([5ac13a6](https://github.com/Gearonix/CodeGear/commit/5ac13a6a179293e680caebbd039db36d1ada78e0))
* initialized styled-components ([a26d8d2](https://github.com/Gearonix/CodeGear/commit/a26d8d2f0792153f787de84f2e745659b3c3c68e))
* registered service worker and enabled caching by workbox and vite-plugin-pwa ([54dd54a](https://github.com/Gearonix/CodeGear/commit/54dd54aed6d2d4f5b9b4408becd571a5d409453a))
* renamed paths from "$/shared" to "$/client-shared" by using ts-morph script ([9ae1189](https://github.com/Gearonix/CodeGear/commit/9ae11890f8c5ec4a3c6910c979c90f42587f8b3f))
* renamed paths from "$/shared" to "@code-gear/web/shared" by using ts-morph script ([9ae1189](https://github.com/Gearonix/CodeGear/commit/9ae11890f8c5ec4a3c6910c979c90f42587f8b3f))
* renamed services to nest-services, initialized swagger module ([56f06a9](https://github.com/Gearonix/CodeGear/commit/56f06a9e7ca9a8a765f7a2c6e95c07abddcce31d))
* setup ts-morph ([fe1757d](https://github.com/Gearonix/CodeGear/commit/fe1757df655c3ac756703ae982efb16b951c7636))
* solved problem this useThemeLoader.ts ([3fbe15f](https://github.com/Gearonix/CodeGear/commit/3fbe15f754e204336fa5b12f57d76ee782bb9e0f))
* started to implement basic authorization by using passport js ([039c46e](https://github.com/Gearonix/CodeGear/commit/039c46e99203d1820e2053af0ace4318a59e0d1b))
* testing yarn workspaces ([da31b41](https://github.com/Gearonix/CodeGear/commit/da31b41faa6763b23ff2ad0b12f26e413592d217))
* trying to solve git bugs ([deae061](https://github.com/Gearonix/CodeGear/commit/deae0616fd43528fb70193158edaa8c7962aeb59))
* trying to solve git bugs ([deae061](https://github.com/Gearonix/CodeGear/commit/deae0616fd43528fb70193158edaa8c7962aeb59))
14 changes: 14 additions & 0 deletions apps/client/.config/vite/entry.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// It is important to specify relative paths here.
import { createViteConfig } from '../../../../packages/config/src/vite'

import { resolve } from 'path'
import { buildCustomPlugins } from './plugins'

export default createViteConfig({
projectName: 'client',
projectType: 'application',
rootDir: resolve(__dirname, '..'),
layer: 'second',
external: [],
plugins: buildCustomPlugins()
})
3 changes: 3 additions & 0 deletions apps/client/.config/vite/fonts.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const fonts: string[] = [
'https://fonts.googleapis.com/css2?family=Poppins&display=swap'
]
28 changes: 28 additions & 0 deletions apps/client/.config/vite/plugins.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { PluginOption } from 'vite'

import { fonts } from './fonts'

import preact from '@preact/preset-vite'
import { VitePWA } from 'vite-plugin-pwa'
import webfontDownload from 'vite-plugin-webfont-dl'

export const buildCustomPlugins = (): PluginOption[] => [
webfontDownload(fonts),
preact(),
VitePWA({
registerType: 'autoUpdate',
injectRegister: 'auto',
strategies: 'injectManifest',
srcDir: 'public',
filename: 'service-worker.js',
workbox: {
globPatterns: ['**/*.{js,css,html,ico,png,svg}'],
clientsClaim: true,
skipWaiting: true
},
devOptions: {
enabled: false
},
includeAssets: ['**/*']
})
]
32 changes: 0 additions & 32 deletions apps/client/config/definePlugins.ts

This file was deleted.

3 changes: 0 additions & 3 deletions apps/client/config/index.ts

This file was deleted.

2 changes: 1 addition & 1 deletion apps/client/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
</head>
<body>
<div id="root"></div>
<script src="/src/app/entrypoint/entry.tsx" type="module"></script>
<script src="src/app/entrypoint/core/entry.tsx" type="module"></script>
</body>
</html>
1 change: 0 additions & 1 deletion apps/client/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"name": "cg-client",
"version": "0.0.1",
"packageManager": "yarn@3.6.0",
"devDependencies": {
"cg-config": "workspace:^",
"cg-ui": "workspace:^"
Expand Down
3 changes: 2 additions & 1 deletion apps/client/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"defaultConfiguration": "production",
"options": {
"outputPath": "dist/apps/client",
"skipTypeCheck": true
"skipTypeCheck": true,
"configFile": "apps/client/.config/vite/entry.ts"
},
"configurations": {
"development": {
Expand Down
5 changes: 5 additions & 0 deletions apps/client/src/app/entrypoint/core/entry.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { render } from 'preact'

import { Root } from '../../root'

render(<Root />, document.querySelector('#root')!)
14 changes: 0 additions & 14 deletions apps/client/src/app/entrypoint/entry.tsx

This file was deleted.

1 change: 0 additions & 1 deletion apps/client/src/app/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
export { default as App } from './entrypoint/application'
export { RootStore, StoreContext } from './providers/store'
2 changes: 1 addition & 1 deletion apps/client/src/app/providers/router/config/router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Main } from '@/pages/main'
import { NotFound } from '@/pages/not-found'
import { ProfilePage } from '@/pages/profile'

import { RoutePaths } from '$/client-shared'
import { RoutePaths } from '@code-gear/web/shared'

const router = createBrowserRouter([
{
Expand Down
2 changes: 1 addition & 1 deletion apps/client/src/app/providers/store/config/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { makeAutoObservable } from 'mobx'

import { AuthStore } from '@/widgets/sign-in-modal'

import { EditorStore } from '$/editor'
import { EditorStore } from '@code-gear/web/editor'

class RootStore {
editor: EditorStore
Expand Down
2 changes: 1 addition & 1 deletion apps/client/src/app/providers/store/ui/store-provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { createContext } from 'react'

import RootStore from '../config/store'

import { WithPreactChildren } from '$/client-shared'
import { WithPreactChildren } from '@code-gear/web/shared'

export const StoreContext = createContext<RootStore>({} as RootStore)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { ThemeProvider, GlobalStyles } from '$/client-shared'
import { ThemeProvider, GlobalStyles } from '@code-gear/web/shared'

import 'normalize.css'

import { RouterProvider } from '../providers/router'
import { StoreProvider } from '../providers/store'

const App = () => {
export const Root = () => {
return (
<StoreProvider>
<ThemeProvider>
Expand All @@ -15,5 +15,3 @@ const App = () => {
</StoreProvider>
)
}

export default App
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Form } from 'antd'
import styled from 'styled-components'

import { wh } from '$/styles'
import { s } from '@code-gear/web/shared'

export const SignInModalStyles = styled(Form)`
width: 84%;
Expand All @@ -19,7 +19,7 @@ export const SubmitButton = styled.button`
`

export const LogoWrapper = styled.img`
${wh('68px', '92px')}
${s.wh('68px', '92px')}
margin: 10px auto;
display: block;
`
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import {
SubmitButton
} from './sign-in-modal-template.styles'

import { Logo } from '$/assets'
import { ColoredButton, ModalTitle } from '$/ui'
import { Assets } from '@code-gear/web/shared'
import { ColoredButton, ModalTitle } from '@code-gear/web/ui'

interface SignInModalTemplateProps<T> {
onSubmit: (data: T) => void
Expand All @@ -23,7 +23,7 @@ export const SignInModalTemplate = <T,>({
name="sign-in-form"
autoComplete="off"
onFinish={onSubmit}>
<LogoWrapper src={Logo} />
<LogoWrapper src={Assets.logo} />
<ModalTitle>CodeGear</ModalTitle>

<Form.Item name="username" rules={getFormItemRules()}>
Expand Down
2 changes: 1 addition & 1 deletion apps/client/src/pages/edit/ui/edit-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Suspense } from 'react'
import { Page } from '@/shared/lib'
import { SignInModal } from '@/widgets/sign-in-modal'

import { Editor } from '$/editor'
import { Editor } from '@code-gear/web/editor'

const EditPage = () => {
return (
Expand Down
2 changes: 1 addition & 1 deletion apps/client/src/pages/main/ui/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Link } from 'react-router-dom'

import { Page } from '@/shared/lib'

import { RoutePaths } from '$/client-shared'
import { RoutePaths } from '@code-gear/web/shared'

const Main = () => {
return (
Expand Down
2 changes: 1 addition & 1 deletion apps/client/src/shared/lib/components/page/auth-guard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
useAsyncEffect,
useBooleanState,
WithChildren
} from '$/client-shared'
} from '@code-gear/web/shared'

const AuthGuard = observer(({ children }: WithChildren) => {
const { isAuthorized, services } = useStore('auth')
Expand Down
2 changes: 1 addition & 1 deletion apps/client/src/shared/lib/components/page/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import AuthGuard from '@/shared/lib/components/page/auth-guard'

import { ErrorBoundary, WithChildren } from '$/client-shared'
import { ErrorBoundary, WithChildren } from '@code-gear/web/shared'

const Page = ({ children }: WithChildren) => {
return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { gql } from '@apollo/react-hooks'

import { ApolloOperation } from '$/client-shared'
import { ApolloOperation } from '@code-gear/web/shared'

export const getProfileQuery: ApolloOperation = {
gql: gql`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { gql } from '@apollo/react-hooks'

import { ApolloOperation } from '$/client-shared'
import { ApolloOperation } from '@code-gear/web/shared'

export const SignInMutation: ApolloOperation = {
gql: gql`
Expand Down
7 changes: 2 additions & 5 deletions apps/client/src/widgets/sign-in-modal/store/auth.services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@ import { getProfileQuery } from '@/widgets/sign-in-modal/graphql/get-profile.que

import { SignInMutation } from '../graphql/sign-in.mutation'

import { ApolloMiddleware, LocalStorageClient } from '$/client-shared'
import { UserEntity } from '$/common-types'
import { SignInResponse } from '$/common-types'
import { SignInForm } from '$/common-types'
import { AccessToken } from '$/common-types'
import { ApolloMiddleware, LocalStorageClient } from '@code-gear/web/shared'
import { UserEntity, SignInResponse, SignInForm, AccessToken } from '@code-gear/api/common'

export class AuthServices {
private state: AuthStore
Expand Down
6 changes: 3 additions & 3 deletions apps/client/src/widgets/sign-in-modal/ui/sign-in-modal.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SignInForm } from '$/common-types'
import { Modal } from '$/ui'
import { SignInForm } from '@code-gear/api/common'
import { Modal } from '@code-gear/web/ui'
import { observer } from 'mobx-react-lite'
import { useNavigate } from 'react-router-dom'

Expand All @@ -12,7 +12,7 @@ import {
useFilteredEffect,
useNotifications,
VoidFunction
} from '$/client-shared'
} from '@code-gear/web/shared'

interface SignInModalProps {
isOpen: boolean
Expand Down
Loading

0 comments on commit 5724b08

Please sign in to comment.