Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ charset = utf-8
insert_final_newline = true
trim_trailing_whitespace = true
indent_size = 4

[{package.json,package-lock.json,**/package.json,**/package-lock.json}]
indent_size = 2
17 changes: 0 additions & 17 deletions .lintstagedrc

This file was deleted.

4 changes: 2 additions & 2 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/node_modules/
/build

# Exclude package(-lock).json for all packages
package.json
# Exclude package-lock.json — npm/lerna-owned, never Prettier-formatted
package-lock.json
**/package-lock.json

# Exclude *.api.md
packages/plasma-b2c/api/
Expand Down
11 changes: 10 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,14 @@
"semi": true,
"singleQuote": true,
"tabWidth": 4,
"trailingComma": "all"
"trailingComma": "all",
"overrides": [
{
"files": ["package.json", "**/package.json"],
"options": {
"parser": "json",
"tabWidth": 2
}
}
]
}
24 changes: 24 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,30 @@ npx lerna clean -y
npx lerna bootstrap
```

## Обновление package-lock.json

При изменении `dependencies`, `devDependencies` или `peerDependencies` в корневом или пакетном `package.json` необходимо синхронизировать lock-файлы.

**Рекомендуемый способ (полная регенерация, как в CI):**

```sh
npm run update:package-locks
```

**Точечное обновление после правки зависимостей одного пакета:**

```sh
npm run update:package-locks:scope --scope=@salutejs/plasma-hope
```

**Не делайте так:**

- `cd packages/foo && npm install` — изолированная установка перегенерирует lock и может изменить дерево зависимостей;
- `npm install --package-lock-only` без флагов `--lockfile-version 2 --legacy-peer-deps`;
- форматирование `package-lock.json` через Prettier — lock-файлы генерируются npm/lerna.

Проверка: `git diff` по lock-файлам должен отражать только изменения зависимостей, а не массовую смену отступов.

## Запуск Storybook

Для разработки компонент используется `Storybook`, который запускается и собирается с помощью `Vite`. Для локальной разработки необходимо из корня проекта перейти в нужную директорию (`plasma-web`, `plasma-b2c`, `plasma-ui`) и выполнить команду запуска:
Expand Down
10 changes: 10 additions & 0 deletions lint-staged.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = {
'*.{js,jsx,ts,tsx}': ['eslint --fix', 'prettier --write'],
'*.{jsx,tsx}': ['stylelint'],
'*.md': ['prettier --write --parser markdown'],
'*.json': (files) => {
const format = files.filter((f) => !f.endsWith('package-lock.json'));

return format.length ? [`prettier --write --parser json ${format.map((f) => `"${f}"`).join(' ')}`] : [];
},
};
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
"prepare": "test ! -n \"$CI\" && husky install || echo skip husky",
"bootstrap": "npx lerna bootstrap",
"bootstrap:since": "npm run bootstrap -- --since=$(git merge-base --fork-point origin/dev)",
"update:package-locks": "npm run update:package-locks:root && npm run update:package-locks:lerna && npm run update:package-locks:root",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Дважды update:package-locks:root

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Тут сделано также как в CI:
https://github.com/salute-developers/plasma/blob/dev/.github/actions/update-package-lock/action.yml#L39-L42

Я помню что это добавлялось черте когда, из за того что в после lerna clean -y && lerna bootstrap почему-то корневой lock файл тоже менялся, и чтобы это пофиксить еще раз обновляли корневой package-lock;

в целом я бы подумал в сторону того чтобы поменять lerna на что-то по новее или в целом что-то улучшить в районе управления монорепы, но не в рамках этой задачи

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Хотя бы просто перейти на workspace + lerna@latest

"update:package-locks:root": "npm i --no-audit --no-progress --package-lock-only --lockfile-version 2 --legacy-peer-deps",
"update:package-locks:lerna": "npx lerna clean -y && npx lerna bootstrap --ignore-scripts --no-ci",
"update:package-locks:scope": "npx lerna bootstrap --scope=$npm_config_scope --include-dependencies --ignore-scripts --no-ci",
"postinstall": "patch-package",
"lerna:clean": "npx lerna clean -y",
"bootstrap:plasma-giga:full": "npx lerna bootstrap --scope='@salutejs/plasma-giga' --scope='@salutejs/{plasma-sb-utils,plasma-tokens,plasma-tokens-utils,core-themes,plasma-typo,plasma-new-hope,plasma-colors,plasma-themes,plasma-core,plasma-docs-ui,plasma-giga-docs}'",
Expand Down
Loading