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

Fresh breath #502

Open
wants to merge 77 commits into
base: next
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
71b755f
[chore]: ignore `.idea`
0x009922 Mar 6, 2023
66574d8
[misc]: migrate to `pnpm`; update deps; wip
0x009922 Mar 7, 2023
ffb8b9d
[misc]: continue cleaning dependencies
0x009922 Mar 7, 2023
2d1886c
[chore]: fix `svgo` version
0x009922 Mar 7, 2023
3fb7319
[refactor]: update `vite-plugin-svg` package
0x009922 Mar 7, 2023
cb0a8b8
[misc]: use stricter TS config
0x009922 Mar 7, 2023
09522f2
[refactor]: update `theme` package
0x009922 Mar 7, 2023
76607f2
[chore]: remove redundant tsconfig.json
0x009922 Mar 7, 2023
08f7ccc
[chore]: update `icons` package
0x009922 Mar 7, 2023
2adc132
[refactor]: migrate Storybook, wip
0x009922 Mar 7, 2023
5ab4e75
[build]: fix `vite.config.ts`
0x009922 Mar 7, 2023
d86b747
[build]: remove API Extractor
0x009922 Mar 7, 2023
aa95526
[build]: update `ui` build
0x009922 Mar 8, 2023
8cc1a33
[test]: pass `vitest` tests
0x009922 Mar 8, 2023
cc940a4
[test]: make Cypress work (but not pass yet)
0x009922 Mar 8, 2023
2f78fb1
[fix] `SModalCard`: set `title` for close button
0x009922 Mar 9, 2023
4620965
[chore]: remove redundant `cypress/plugins`
0x009922 Mar 9, 2023
8e05982
[chore]: convert `vite-plugin-svg` to `type: module`
0x009922 Mar 9, 2023
67b13a7
[chore]: update top-level scripts
0x009922 Mar 9, 2023
62592c3
[chore]: format & lint
0x009922 Mar 9, 2023
1b98710
Set pnpm as packageManager, change node 14 to 16
C4tWithShell Mar 9, 2023
47ac4f8
The same for usual Jenkinsfile
C4tWithShell Mar 9, 2023
06589f0
Change prebuild cmd, revert next.Jenkins
C4tWithShell Mar 9, 2023
08e0d6c
Add cmd
C4tWithShell Mar 9, 2023
ff45611
Add pnpm setup
C4tWithShell Mar 9, 2023
a492342
Install pnpm
C4tWithShell Mar 9, 2023
6f3f06b
Fix cmd
C4tWithShell Mar 9, 2023
ce8f956
Fix cmd
C4tWithShell Mar 9, 2023
81d6022
Fix cmd
C4tWithShell Mar 9, 2023
998e622
Change installation
C4tWithShell Mar 9, 2023
14900f2
Install pnpm globally
C4tWithShell Mar 9, 2023
541b1b3
Merge remote-tracking branch 'origin/next' into fresh-breath
0x009922 Mar 13, 2023
37c4887
[docs]: update README, remove `yarn`
0x009922 Mar 13, 2023
8d67d56
Merge branch 'fresh-breath' of github.com:soramitsu/soramitsu-js-ui-l…
0x009922 Mar 13, 2023
4549d5d
[ci]: remove obsolete `build:theme`
0x009922 Mar 13, 2023
af6ac34
[build]: fix `.d.ts` bundle errors
0x009922 Mar 13, 2023
c1145a0
[chore]: fix format
0x009922 Mar 13, 2023
f874f11
[refactor]: enable `verbatimModuleSyntax`
0x009922 Mar 13, 2023
93da1a4
[chore]: add TODO
0x009922 Mar 13, 2023
6659284
[chore]: ignore stories in `tsconfig.json`
0x009922 Mar 13, 2023
a22b190
Merge branch 'fresh-breath' into 512-stricter-type-script
0x009922 Mar 13, 2023
d8a4cf7
[refactor]: enable `noUnusedParameters`
0x009922 Mar 13, 2023
1fe85f7
[refactor]: fix *some* type errors in Cypress tests
0x009922 Mar 13, 2023
c036a5c
[misc]: add root type-checking script
0x009922 Mar 13, 2023
03a8615
[chore]: fix format
0x009922 Mar 13, 2023
db1ea9b
[refactor]: disallow unreachable code
0x009922 Mar 13, 2023
dceb8d7
[refactor]: enable `exactOptionalPropertyTypes`
0x009922 Mar 13, 2023
2191c40
[refactor]: enable `noImplicitReturns`
0x009922 Mar 13, 2023
e5e1e26
[refactor]: enable `noUncheckedIndexedAccess`
0x009922 Mar 13, 2023
832227b
[docs]: add changesets, belatedly
0x009922 Mar 13, 2023
30424e9
[fix]: refactor heights watcher, close #517
0x009922 Mar 13, 2023
05de048
[fix]: remove props from watch sources
0x009922 Mar 14, 2023
45f987e
[refactor] `STableColumn`: use strict type for `sort-orders`
0x009922 Mar 14, 2023
cc550c2
[chore]: update `test` script
0x009922 Mar 14, 2023
21918f0
[test]: fix Cypress config
0x009922 Mar 14, 2023
7744b14
[test]: revert `.only`
0x009922 Mar 14, 2023
0228216
[build]: fix tsc build configuration
0x009922 Mar 14, 2023
94fd6fb
Merge branch '512-stricter-type-script' into 517-table-heights-watch
0x009922 Mar 14, 2023
a7f17ab
[chore] theme: add `vite` as a dev dep
0x009922 Mar 14, 2023
079b2c0
[chore]: set `vite` as a workspace-level dev dep
0x009922 Mar 14, 2023
fa06a28
test 1
Mar 15, 2023
c41f7ba
adding cypress
Mar 15, 2023
0f6dda5
test 2
Mar 15, 2023
ffc9c3e
delete deprecated parameter
Mar 15, 2023
cb35246
[chore]: remove comment
0x009922 Mar 20, 2023
db29837
[chore]: use released ts 5.0.2
0x009922 Mar 20, 2023
cb972c3
Merge pull request #518 from soramitsu/512-stricter-type-script
0x009922 Mar 21, 2023
91752b4
Merge pull request #519 from soramitsu/517-table-heights-watch
0x009922 Mar 21, 2023
fbc78e3
Update Jenkinsfile
f33r0 Mar 24, 2023
8600146
Merge pull request #522 from soramitsu/feature/dops-2312/test-corepack
f33r0 Apr 4, 2023
e08264b
feauture/dops-2312/use_corepack
Apr 6, 2023
c77cd33
Merge pull request #538 from soramitsu/feauture/dops-2312/use_corepack
f33r0 Apr 12, 2023
cb02f75
Merge branch 'next' into fresh-breath
0x009922 May 2, 2023
c86e712
Update Jenkinsfile
C4tWithShell May 2, 2023
44eb9c0
Update Jenkinsfile
C4tWithShell May 2, 2023
9e37e4c
Update Jenkinsfile
C4tWithShell May 2, 2023
d08f9bb
Update next.Jenkinsfile
C4tWithShell May 2, 2023
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
5 changes: 5 additions & 0 deletions .changeset/chilly-badgers-retire.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@soramitsu-ui/ui': patch
---

**refactor**: refactor internals with stricter TypeScript options
5 changes: 5 additions & 0 deletions .changeset/eight-horses-judge.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@soramitsu-ui/theme': minor
---

**build!**: drop JS part of the library, keep only Sass and fonts
5 changes: 5 additions & 0 deletions .changeset/fair-penguins-beg.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@soramitsu-ui/ui': minor
---

**build**: set `type: module` in package json; update exports; rollup `.d.ts` with `rollup-plugin-dts`
5 changes: 5 additions & 0 deletions .changeset/fuzzy-pens-tickle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@soramitsu-ui/ui': patch
---

**refactor**(`SDatePicker`): remove redundant constant binary expression
5 changes: 5 additions & 0 deletions .changeset/gentle-impalas-love.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@soramitsu-ui/theme': patch
---

**docs**: fix "Sora" import in TL;DR example
5 changes: 5 additions & 0 deletions .changeset/great-mangos-rescue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@soramitsu-ui/icons': patch
---

**docs**: update README
5 changes: 5 additions & 0 deletions .changeset/khaki-cats-cheat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@soramitsu-ui/ui': patch
---

**fix**(`SModalCard`): set `title="Close"` for close button, pass a11y check
5 changes: 5 additions & 0 deletions .changeset/mighty-hats-retire.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@soramitsu-ui/ui': patch
---

**fix**(`SPagination`): compare `pageButton` correctly
5 changes: 5 additions & 0 deletions .changeset/nervous-cooks-sleep.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@soramitsu-ui/vite-plugin-svg': minor
---

**refactor!**: bump major version of `svgo`; specify `vite@4` as a peer dependency; specify `exports` field; bundle package in both CJS and ESM formats; update README
5 changes: 5 additions & 0 deletions .changeset/old-ants-argue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@soramitsu-ui/ui': patch
---

**fix**: specify `type-fest` as a prod dependency
7 changes: 7 additions & 0 deletions .changeset/short-melons-think.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@soramitsu-ui/vite-plugin-svg': minor
'@soramitsu-ui/theme': minor
'@soramitsu-ui/ui': minor
---

**chore**: update dependencies; specify them as `^x.y`
5 changes: 5 additions & 0 deletions .changeset/spotty-jeans-sell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@soramitsu-ui/ui': minor
---

**refactor**(`SSelect`): use `readonly options` in `UseSelectModelParams`
5 changes: 5 additions & 0 deletions .changeset/thick-rice-remain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@soramitsu-ui/ui': minor
---

**refactor**(`STableColumn`): use strict type for `sort-orders` prop -- it should be 1-3 length array without duplications
5 changes: 5 additions & 0 deletions .changeset/wise-trees-applaud.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@soramitsu-ui/ui': patch
---

**fix**(`STable`): refactor internal table-heights watcher
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
node_modules
dist
dist-ts
ts-build
storybook-static
/packages/ui/test/after-build/esm-tree-shaken-dist
8 changes: 8 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ module.exports = {

// make possible `/// <reference...`
'spaced-comment': ['error', 'always', { markers: ['/'] }],

'@typescript-eslint/consistent-type-definitions': 'off',

// FIXME
'vue/require-default-prop': 'off',

// FIXME
'vuejs-accessibility/no-static-element-interactions': 'off',
},
overrides: [
{
Expand Down
1 change: 0 additions & 1 deletion .gitattributes

This file was deleted.

4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ dist
dist-ssr
*.local
versus.md
dist-ts
tsconfig.tsbuildinfo
yarn-error.log
yarn-error.log
.idea
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dedupe-peer-dependents=true
15 changes: 9 additions & 6 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
@Library('jenkins-library')
@Library('jenkins-library') _

def pipeline = new org.js.LibPipeline(
steps: this,
packageManager: 'yarn',
buildDockerImage: 'build-tools/node:14-ubuntu-cypress',
packageManager: 'pnpm',
preBuildCmds: ["pnpm install"],
buildDockerImage: 'build-tools/node:16-cypress-corepack',
npmLoginEmail: '[email protected]',
dockerImageName: 'soramitsu/soramitsu-js-ui-library',
testCmds: ['yarn test:all'],
pushCmds: ['yarn publish-workspaces --no-verify-access'],
testCmds: ['pnpm test:all'],
pushCmds: ['pnpm publish-workspaces'],
libPushBranches: ['master', 'next'],
dockerImageTags: ['master':'latest', 'next':'next'],
libExamplesBuildCmds: ['yarn sb:build']
libExamplesBuildCmds: ['pnpm sb:build'],
corepack: true
)
pipeline.runPipeline()
65 changes: 32 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,49 +7,44 @@ Packages located at `packages/` dir.
Each package has its own `tsconfig.json`, own build & testing configs and their specific user guidelines in README
files.

- **`icons`** package contains only raw SVGs for now.
- **`theme`** package contains theme-related tools - Windi CSS helpers & theme variables, as well as fonts.
- **`ui`** package contains components.
- [`@soramitsu-ui/icons`](./packages/icons) package contains only raw SVGs for now.
- [`@soramitsu-ui/theme`](./packages/theme) package contains Sass theme variables and fonts.
- [`@soramitsu-ui/ui`](./packages/ui) package contains components.
- [`@soramitsu-ui/vite-plugin-svg`](./packages/vite-plugin-svg) package contains custom plugin for loading SVG as Vue components

## Getting started
## Development

**Install packages:**

```shell
yarn
```

**Build theme:** (you need to rebuild it each time you use it from ui lib)

```shell
yarn build:theme
pnpm i
```

**Open storybook:**

```shell
yarn sb:serve
pnpm sb:serve
```

OR **cypress component-testing:**
or/and **Cypress component-testing:**

```shell
yarn cy
pnpm cy
```

**Build all packages:**

```shell
yarn build
pnpm build
```

**Build Storybook:**

```shell
yarn sb:build
pnpm sb:build
```

### To add new component:
### Adding a new component

1. Create a component directory in `ui/src/components` (e.g. `ui/src/components/Button`) with component itself
prefixed with `S` (e.g. `SButton.vue`) and the `index.ts` file exporting it. The file's name becomes component's
Expand All @@ -62,53 +57,57 @@ yarn sb:build
component's name. For searching elements in a component you should use `data-testid` attribute.
5. If there are any quite complex utils they should have their own unit tests nearby.
6. When everything is working, use repo root script `lint:format:fix` to bring the code to common style (more details
in the section **Linting & Format**).
in the section [Linting & Format](#linting--format)).
7. Then you should update `ui.api.md` using two commands in `ui` package: `build:tsc` and then `api:extract:local`.
8. Using `yarn changeset` create a minor change with `**feat**` prefix about new component (e.g.
8. Using `pnpm changeset` create a minor change with `**feat**` prefix about new component (e.g.
`**feat**: added button component`).
9. Create pull request.

### To release & publishing:
### Releases

1. Create a release branch.
2. Make sure that everything is ready.
3. Use the command `yarn changeset version` to update `CHANGELOG.md` files.
3. Use the command `pnpm changeset version` to update `CHANGELOG.md` files.
4. Create a pull request with a release version in name.
5. Merge the pull request. It will automatically publish packages.

### Some recommendations

- There are a useful library [VueUse](https://vueuse.org/) with a lot of composition utilities that can be used in
- There is a useful library [VueUse](https://vueuse.org/) with a lot of composition utilities that can be used in
develop, so it is good idea to regularly check it.
- We often use provide/inject mechanism for main-subsidiary components communication (e.g. checkbox group - checkbox).
- We often use provide/inject mechanism for main-subsidiary components communication (e.g. checkbox group with checkbox).
It should be done by creating `api.ts` with a provided payload type, an injection key and an api hook in
component directory.

### Styleguide

- Previously enums was defined as plain TypeScript enums, but they don't work well with tree shaking, so now we
- Previously enums were defined as plain TypeScript enums, but they don't work well with tree shaking, so now we
define enums as follows:

```ts
const Status = {
Info: 'info',
} as const

type Status = typeof Status[keyof typeof Status]
type Status = (typeof Status)[keyof typeof Status]
```

- There is no need to create folders for every type of subsidiary entities, e.g. composables, utilities, etc.,
if their number is small.
- Move composables to its own files started with `use`. It's helps to detect and group composables in directory tree.
- Move composables to its own files started with `use`. It helps to detect and group composables in directory tree.
- We are using BEM with underscores for class names (e.g. `button__icon_hidden` or `button__icon_size_small`).
- Try to use Windi CSS utility classes.
- Messages in changesets should start with `**type**`, where `type` can be `fix`, `feat` or something like this,
that describes a type of change. After the type should go a scope in brackets if it can be defined. (For example,
it can be the name of a component). Then after colon goes a change description.
Examples: `` **fix**(`STable`): remove unnecessary border `` or `**feat**: add pagination component`.
- Messages in changesets should start with `**<type>**`, where `<type>` can be `fix`, `feat` or something like this,
that describes a type of change. If the change has a scope (e.g. a component name), it should be after the type of the change. Then the description goes after colon. After the type should go a scope in brackets if it can be defined.

Examples:

- `` **fix**(`STable`): remove unnecessary border ``
- `**feat**: add pagination component`

More info: https://www.conventionalcommits.org/en/v1.0.0/

## Linting & Format
### Linting & Format

Available scripts:

Expand All @@ -119,13 +118,13 @@ Available scripts:
- `lint:format:fix`- calls prettier and then eslint to fix formatting errors
- `lint:check` - calls `lint:es` and then `lint:format:check`

To use "Format On Save" feature you should setup your (I)DE to run:
To use "Format On Save" feature you should set up your (I)DE to run:

```bash
# From the project root
./node_modules/.bin/prettier-eslint --write <target file name>
```

Maybe you will also need to specify paths for prettier config, prettier binary, eslint config or eslint binary. See all list of options with `yarn prettier-eslint -h`.
Maybe you will also need to specify paths for prettier config, prettier binary, eslint config or eslint binary. See all list of options with `pnpm prettier-eslint -h`.

> If you are using VSCode, take a lot at [Prettier ESLint](https://marketplace.visualstudio.com/items?itemName=rvest.vs-code-prettier-eslint) extension, it may help with auto formatting.
18 changes: 0 additions & 18 deletions lerna.json

This file was deleted.

19 changes: 10 additions & 9 deletions next.Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
@Library('jenkins-library')
@Library('jenkins-library') _

def pipeline = new org.js.LibPipeline(
steps: this,
packageManager: 'yarn',
buildDockerImage: 'build-tools/node:14-ubuntu-cypress',
packageManager: 'pnpm',
buildDockerImage: 'build-tools/node:16-cypress-corepack',
npmLoginEmail: '[email protected]',
dockerFileName: 'next.Dockerfile',
dockerImageName: 'soramitsu/soramitsu-js-ui-library',
testCmds: ['yarn test:all'],
pushCmds: ['yarn publish-workspaces --no-verify-access'],
libPushBranches: ['next'],
dockerImageTags: ['next':'next-serve'],
libExamplesBuildCmds: ['yarn sb:build']
testCmds: ['pnpm test:all'],
pushCmds: ['pnpm publish-workspaces'],
libPushBranches: ['master', 'next'],
dockerImageTags: ['master':'latest', 'next':'next'],
libExamplesBuildCmds: ['pnpm sb:build'],
corepack: true
)
pipeline.runPipeline()
Loading