Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plasma-infra: Scaffold docs dir CLI #1099

Merged
merged 3 commits into from
Mar 18, 2024
Merged

plasma-infra: Scaffold docs dir CLI #1099

merged 3 commits into from
Mar 18, 2024

Conversation

Yakutoc
Copy link
Collaborator

@Yakutoc Yakutoc commented Mar 6, 2024

Scaffold docs CLI

  • добавлен CLI для создание директории документации по шаблону
  • добавлен CLI для создание компонента документации по шаблону

What/why changed

Автоматизация развертывания документации для новых пакетов/дизайн вертикалей.

npm run scaffold:docs --package="plasma-asdk" --vertical="plasma" --theme="stylesSalute" --url="asdk"
  • theme - конкретное название темы, например sdds_serv
  • vertical - дизайн вертикаль, например plasma или sdds
  • url - что будет в конце URL - plasma.sberdevices.ru/asdk/

Создаст документацию plasma-asdk-docs для пакета plasma-asdk.

package.json Show resolved Hide resolved
@@ -0,0 +1,25 @@
---
id: {{name}}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

[Note]: будет подставлено название компонента, например Avatar


```tsx live
import React from 'react';
import { {{name}} } from '@salutejs/{{package}}';
Copy link
Collaborator Author

@Yakutoc Yakutoc Mar 6, 2024

Choose a reason for hiding this comment

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

[Note]: package - название пакета, например caldera.

@Salute-Eva
Copy link
Contributor

Theme Builder app deployed!

http://plasma.sberdevices.ru/pr/plasma-theme-builder-pr-1099/

const indexSource = `import React from "react";
import ReactDOM from "react-dom";
import styled, { createGlobalStyle } from "styled-components";
import { {{ theme }}__light } from "@salutejs/{{ vertical }}-themes";
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

[Note]:

  • theme - конкретное название темы, например sdds_serv
  • vertical - дизайн вертикаль, например plasma или sdds

import useIsBrowser from '@docusaurus/useIsBrowser';
import { usePrismTheme, useColorMode } from '@docusaurus/theme-common';
import { PlaygroundPreview } from '@salutejs/plasma-docs-ui';
import { {{ theme }}__dark, {{ theme }}__light } from '@salutejs/{{ vertical }}-themes';
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

[Note]:

  • theme - конкретное название темы, например sdds_serv
  • vertical - дизайн вертикаль, например plasma или sdds

@Yakutoc Yakutoc marked this pull request as ready for review March 6, 2024 09:48
package.json Show resolved Hide resolved
package.json Show resolved Hide resolved
scaffold/scaffold-components.js Outdated Show resolved Hide resolved
scaffold/template-docs/docs/_category_.json Outdated Show resolved Hide resolved

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

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
Collaborator Author

Choose a reason for hiding this comment

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

@Yeti-or Я тогда могу за шаблон взять пример из sdds-serv ?

Copy link
Contributor

Choose a reason for hiding this comment

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

ну в целом мы можем это сделать отдельно, в sdds-serv нужно переписать на plasma-themes

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Давай тогда в задаче про генерацию содержимого для компонентов

Copy link
Collaborator

Choose a reason for hiding this comment

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

Вы имеете в виду доку? Потому что если вы про либу, то она уже использует sdds-themes пакет

scaffold/update-docs-ui.js Outdated Show resolved Hide resolved
scaffold/update-package-json.js Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
scaffold/update-package-json.js Outdated Show resolved Hide resolved
@Salute-Eva
Copy link
Contributor

Theme Builder app deployed!

http://plasma.sberdevices.ru/pr/plasma-theme-builder-pr-1099/

@Yakutoc Yakutoc requested a review from Yeti-or March 12, 2024 10:44
package.json Show resolved Hide resolved
@Salute-Eva
Copy link
Contributor

Theme Builder app deployed!

http://plasma.sberdevices.ru/pr/plasma-theme-builder-pr-1099/

package.json Show resolved Hide resolved
@Yeti-or Yeti-or removed the request for review from neretin-trike March 13, 2024 08:51
scaffold/Readme.md Outdated Show resolved Hide resolved
const { Scaffold } = require('simple-scaffold');
const path = require('path');
const { ensureDir } = require('fs-extra');
const { readdir } = require('node:fs/promises');
Copy link
Collaborator

Choose a reason for hiding this comment

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

минор

А просто readdirSync не подойдет?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@neretin-trike А какие бенефиты?

@Salute-Eva
Copy link
Contributor

Theme Builder app deployed!

http://plasma.sberdevices.ru/pr/plasma-theme-builder-pr-1099/

@Yakutoc Yakutoc added this pull request to the merge queue Mar 18, 2024
Merged via the queue into dev with commit 571f487 Mar 18, 2024
21 checks passed
@Yakutoc Yakutoc deleted the chore-docs-scaffold branch March 18, 2024 07:57
This was referenced Jul 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants