Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
473 changes: 471 additions & 2 deletions .pnp.cjs

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed .yarn/cache/fsevents-patch-19706e7e35-10.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
5 changes: 5 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
packageExtensions:
'@atls-ui-parts/text@*':
dependencies:
'@emotion/react': '*'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

вот с этим надо разобраться - почему он требует эмоушн хотя в зависимостях все есть. Проверь еще в гиперионе пожалуйста

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"dependencies": {
    "csstype": "3.1.3"
  },
  "devDependencies": {
    "@emotion/styled": "11.11.0",
    "@types/react": "18.2.48",
    "@types/styled-system": "5.1.22",
    "react": "18.2.0",
    "styled-system": "5.1.5"
  },
  "peerDependencies": {
    "@emotion/styled": "11.11.0",
    "react": "18.2.0",
    "styled-system": "5.1.5"
  },
  "publishConfig": {
    "access": "public",
    "main": "dist/index.js",
    "typings": "dist/index.d.ts"
  }

Нам не нужно его явно в пирах получать?

@emotion/react вообще не фигурирует в зависимостях для текста в гипперионе

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Тогда надо обязательно добавить.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

создай пожалуйста таску на это дело


compressionLevel: mixed

enableGlobalCache: false
Expand Down
3 changes: 3 additions & 0 deletions app-router/entrypoints/renderer/locales/ru.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"text": "text"
}
42 changes: 42 additions & 0 deletions pages-router/entrypoints/renderer/extract-all-translations.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/* eslint-disable */

import { readdirSync, existsSync, readFileSync, writeFileSync } from 'fs'
import { join } from 'path'
import { execSync } from 'child_process'

const processDirectory = (startPath, folderName, allLocales) => {
if (!existsSync(startPath)) {
console.log('No directory ', startPath)
return
}

const directories = readdirSync(startPath, { withFileTypes: true })
.filter((dirent) => dirent.isDirectory())
.map((dirent) => dirent.name)

directories.forEach((dir) => {
const localePath = join(startPath, dir)
if (existsSync(`${localePath}/${folderName}`)) {
const command = `formatjs extract "${localePath}/**/*.tsx" --out-file "${localePath}/${folderName}/ru.json" --format simple`
console.log(`Running: ${command}`)
execSync(command, { stdio: 'inherit' })
allLocales.push(`${localePath}/${folderName}/ru.json`)
}
})
}

const mergeLocales = (files, outputPath) => {
const mergedLocales = {}
files.forEach((file) => {
if (existsSync(file)) {
const content = JSON.parse(readFileSync(file, 'utf8'))
Object.assign(mergedLocales, content)
}
})
writeFileSync(outputPath, JSON.stringify(mergedLocales, null, 2), 'utf8')
}

const allLocales = []
processDirectory('../../fragments', 'locales', allLocales)
processDirectory('../../pages', 'locales', allLocales)
mergeLocales(allLocales, './locales/ru.json')
7 changes: 7 additions & 0 deletions pages-router/entrypoints/renderer/locales/ru.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"app.navbar.hello": "HELLO TOO FROM NAVBAR",
"app.navbar_fragment.identity": "IDENTITY",
"app.sidebar-fragment.identity": "SIDEBAR",
"app.home_page.content": "CONTENT",
"app.home_page.hello": "HELLO FROM HOME"
}
4 changes: 4 additions & 0 deletions pages-router/entrypoints/renderer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
"scripts": {
"build": "yarn next build src --no-lint && cp -r ./src/.next/standalone ./dist && cp -r ./src/.next/static ./dist/src/.next/static && mv ./dist/src/server.js ./dist/src/index.cjs",
"dev": "yarn next dev src",
"extract-all": "node extract-all-translations.js",
"postinstall": "yarn extract-all",
"prepack": "run build",
"start": "node dist/src/index.cjs"
},
Expand All @@ -15,10 +17,12 @@
"next": "14.1.0",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-intl": "6.6.2",
"styled-system": "5.1.5"
},
"devDependencies": {
"@app/home-page": "workspace:0.0.1",
"@formatjs/cli": "6.2.7",
"@types/node": "20.11.5",
"@types/react": "18.2.48",
"@types/react-dom": "18.2.18",
Expand Down
11 changes: 8 additions & 3 deletions pages-router/entrypoints/renderer/src/pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
import React from 'react'
import { IntlProvider } from 'react-intl'

import { ThemeProvider } from '@ui/theme'

import messages from '../../locales/ru.json'

const App = ({ Component, pageProps, ...props }) => (
<ThemeProvider>
<Component {...pageProps} {...props} />
</ThemeProvider>
<IntlProvider defaultLocale='ru' locale='ru' messages={messages}>
<ThemeProvider>
<Component {...pageProps} {...props} />
</ThemeProvider>
</IntlProvider>
)

export default App
4 changes: 4 additions & 0 deletions pages-router/fragments/navbar/locales/ru.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"app.navbar.hello": "HELLO TOO FROM NAVBAR",
"app.navbar_fragment.identity": "IDENTITY"
}
22 changes: 22 additions & 0 deletions pages-router/fragments/navbar/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "@app/navbar-fragment",
"version": "0.0.1",
"main": "src/index.ts",
"dependencies": {
"@ui/hello": "workspace:0.0.1",
"@ui/layout": "workspace:0.0.1",
"@ui/text": "workspace:0.0.1"
},
"devDependencies": {
"@types/react": "18.2.48",
"@types/react-dom": "18.2.18",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-intl": "6.6.2"
},
"peerDependencies": {
"react": "*",
"react-dom": "*",
"react-intl": "*"
}
}
1 change: 1 addition & 0 deletions pages-router/fragments/navbar/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './navbar.component'
33 changes: 33 additions & 0 deletions pages-router/fragments/navbar/src/navbar.component.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import React from 'react'
import { FormattedMessage } from 'react-intl'
import { useIntl } from 'react-intl'

import { Hello } from '@ui/hello'
import { Box } from '@ui/layout'
import { Column } from '@ui/layout'
import { Text } from '@ui/text'

export const Navbar = () => {
const { formatMessage } = useIntl()
return (
<Column gap={20}>
<Box
justifyContent='center'
alignItems='center'
padding='huge'
backgroundColor='darkRed'
border='boldLightGray'
boxShadow='black.fifteenHundredthsTransparent'
height={50}
gap={20}
>
<Text color='white'>
<FormattedMessage id='app.navbar_fragment.identity' defaultMessage='IDENTITY' />
</Text>
<Hello
hello={formatMessage({ id: 'app.navbar.hello', defaultMessage: 'HELLO TOO FROM NAVBAR' })}
/>
</Box>
</Column>
)
}
3 changes: 3 additions & 0 deletions pages-router/fragments/sidebar/locales/ru.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"app.sidebar-fragment.identity": "SIDEBAR"
}
21 changes: 21 additions & 0 deletions pages-router/fragments/sidebar/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "@app/sidebar-fragment",
"version": "0.0.1",
"main": "src/index.ts",
"dependencies": {
"@ui/layout": "workspace:0.0.1",
"@ui/text": "workspace:0.0.1"
},
"devDependencies": {
"@types/react": "18.2.48",
"@types/react-dom": "18.2.18",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-intl": "6.6.2"
},
"peerDependencies": {
"react": "*",
"react-dom": "*",
"react-intl": "*"
}
}
1 change: 1 addition & 0 deletions pages-router/fragments/sidebar/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './sidebar.component'
22 changes: 22 additions & 0 deletions pages-router/fragments/sidebar/src/sidebar.component.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import React from 'react'
import { FormattedMessage } from 'react-intl'

import { Box } from '@ui/layout'
import { Text } from '@ui/text'

export const Sidebar = () => (
<Box
justifyContent='center'
alignItems='center'
height='calc(100vh - 50px)'
width={200}
padding='huge'
backgroundColor='darkRed'
borderTop='boldLightGray'
borderRight='boldLightGray'
>
<Text>
<FormattedMessage id='app.sidebar-fragment.identity' defaultMessage='SIDEBAR' />
</Text>
</Box>
)
4 changes: 4 additions & 0 deletions pages-router/pages/home/locales/ru.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"app.home_page.content": "CONTENT",
"app.home_page.hello": "HELLO FROM HOME"
}
12 changes: 9 additions & 3 deletions pages-router/pages/home/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,22 @@
"version": "0.0.1",
"main": "src/index.ts",
"dependencies": {
"@ui/hello": "workspace:0.0.1"
"@app/navbar-fragment": "workspace:0.0.1",
"@app/sidebar-fragment": "workspace:0.0.1",
"@ui/hello": "workspace:0.0.1",
"@ui/layout": "workspace:0.0.1",
"@ui/text": "workspace:0.0.1"
},
"devDependencies": {
"@types/react": "18.2.48",
"@types/react-dom": "18.2.18",
"react": "18.2.0",
"react-dom": "18.2.0"
"react-dom": "18.2.0",
"react-intl": "6.6.2"
},
"peerDependencies": {
"react": "*",
"react-dom": "*"
"react-dom": "*",
"react-intl": "*"
}
}
36 changes: 28 additions & 8 deletions pages-router/pages/home/src/home.component.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,32 @@
import React from 'react'
import React from 'react'
import { FormattedMessage } from 'react-intl'
import { useIntl } from 'react-intl'

import { Hello } from '@ui/hello'
import { Navbar } from '@app/navbar-fragment'
import { Sidebar } from '@app/sidebar-fragment'
import { Hello } from '@ui/hello'
import { Box } from '@ui/layout'
import { Row } from '@ui/layout'
import { Text } from '@ui/text'

const HomePage = () => (
<>
<h1>HELLO</h1>
<Hello />
</>
)
const HomePage = () => {
const { formatMessage } = useIntl()
return (
<>
<Navbar />
<Row fill>
<Sidebar />
<Box gap={20}>
<Hello
hello={formatMessage({ id: 'app.home_page.hello', defaultMessage: 'HELLO FROM HOME' })}
/>
<Text>
<FormattedMessage id='app.home_page.content' defaultMessage='CONTENT' />
</Text>
</Box>
</Row>
</>
)
}

export default HomePage
4 changes: 3 additions & 1 deletion ui/hello/src/hello.component.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import React from 'react'

export const Hello = () => <i>HELLO</i>
export const Hello = ({ hello }: { hello?: string }) => (
<i>{hello ?? 'GLOOMY HELLO WITHOUT TRANSLATION'}</i>
)
26 changes: 26 additions & 0 deletions ui/text/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "@ui/text",
"version": "0.0.1",
"main": "src/index.ts",
"dependencies": {
"@atls-ui-parts/text": "0.1.1"
},
"devDependencies": {
"@emotion/react": "11.11.3",
"@emotion/styled": "11.9.3",
"@types/react": "18.2.48",
"@types/react-dom": "18.2.18",
"@types/styled-system": "5.1.22",
"csstype": "3.1.2",
"react": "18.2.0",
"react-dom": "18.2.0",
"styled-system": "5.1.5"
},
"peerDependencies": {
"@emotion/react": "*",
"@emotion/styled": "*",
"react": "*",
"react-dom": "*",
"styled-system": "*"
}
}
3 changes: 3 additions & 0 deletions ui/text/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
'use client'

export * from '@atls-ui-parts/text'
Loading