Skip to content

Commit

Permalink
documentation(publish/eslint): describe new autopublish workflow and …
Browse files Browse the repository at this point in the history
…add documentation for packages/eslint-config

Co-Authored-By: Florian Wendelborn <1133858+FlorianWendelborn@users.noreply.github.com>
  • Loading branch information
Isokaeder and FlorianWendelborn committed May 14, 2024
1 parent d43ee32 commit 2ee7efc
Show file tree
Hide file tree
Showing 4 changed files with 125 additions and 74 deletions.
101 changes: 29 additions & 72 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,111 +150,68 @@ yarn run test

### Publishing

This monorepo supports a semi-automatic release workflow. To trigger an automatic release:

- make sure that the package that should be auto-released is mentioned in `packagesToConsider` of [this file](internals/scripts/source/publish.ts)
- bump the package's version in the relevant `package.json`
- merge this change to `master`. This will trigger the repo's `publish` workflow which publishes any new versions it finds.

#### Kotti

1. Prepare a new release draft [here](https://github.com/3YOURMIND/kotti/releases/new)

a. Tag format: `v1.2.3` (select `Create new tag: v1.2.3 on publish`)
a. Tag format: `versions/kotti-ui/1.2.3` (select `Create new tag: versions/kotti-ui/1.2.3 on publish`)

b. Title format: `1.2.3: tldr of what's happening`

c. Release notes: Follow guidelines of previous releases

d. Click on `Save draft`

2. Checkout the master branch in the Kotti repository and pull latest changes

```bash
git checkout master
git pull --rebase
```

3. Install/update dependencies

```bash
yarn install
```

4. Build Kotti. Make sure it builds successfully.
2. Optional: If you haven't already, make sure to functionally test:

```bash
yarn run turbo run --filter=@3yourmind/kotti-ui build
yarn run watch # or if already merged to master, go to <https://3yourmind.github.io/kotti/>
```

5. Optional: If you haven't already, make sure to functionally test:

```bash
yarn run watch
```

6. Login into NPM with your credentials. Make sure you have publishing rights and 2FA on your npmjs.com account enabled.

```bash
npm login
```

7. Update the version in `package.json` in `packages/kotti-ui` and all `@3yourmind/kotti-ui` dependencies in:

a. `packages/documentation`

b. `packages/test-app`
3. Create a pull request that bumps the version:
a. Update the version in `packages/kotti-ui/package.json`
b. Commit message format: `version(kotti-ui@1.2.3): tldr of what's happening`

8. Make a version commit, **DO NOT PUSH** yet.
4. Merge the pull request and publish the release draft from `step 1` [here](https://github.com/3YOURMIND/kotti/releases)

a. Commit message format: `version(1.2.3): tldr of what's happening`

9. Publish. Lerna will auto-detect the packages whose versions got updated in `package.json` and ask you to confirm the packages to be updated and their corresponding versions.

```bash
yarn run lerna publish from-package
```

10. Push the version commit to remote

```bash
git push
```

11. Find the release draft from `step 1` [here](https://github.com/3YOURMIND/kotti/releases), edit it and click on `Publish release`

12. Announce the new version in the `#kotti` slack channel
5. Announce the new version in the `#kotti` slack channel

#### Yoco

1. Create a version bump branch out of master

2. Update the version in `packages/yoco`
1. Prepare a new release draft [here](https://github.com/3YOURMIND/kotti/releases/new)

3. Commit and push
a. Tag format: `versions/yoco/1.2.3` (select `Create new tag: versions/yoco/1.2.3 on publish`)

4. Create a PR and get it merged
b. Title format: `Yoco 1.2.3: tldr of what's happening`

5. Checkout the master branch in the Kotti repository and pull latest changes
c. Release notes: Follow guidelines of previous releases

```bash
git checkout master
git pull --rebase
```
d. Click on `Save draft`

6. Login into NPM with your credentials. Make sure you have publishing rights and 2FA on your npmjs.com account enabled.
2. Optional: If you haven't already, make sure to functionally test:

```bash
npm login
yarn run watch # or if already merged to master, go to <https://3yourmind.github.io/kotti/>
```

7. Build yoco
3. Create a pull request that bumps the version:
a. Update the version in `packages/yoco/package.json`
b. Update the version in `packages/kotti-ui/package.json` (consider bumping kotti-ui, if the changes need to be used there as well)
c. Commit message format: `version(yoco@1.2.3): tldr of what's happening`

```bash
yarn run turbo run --filter=@3yourmind/yoco build
```
4. Merge the pull request and publish the release draft from `step 1` [here](https://github.com/3YOURMIND/kotti/releases)

8. Publish. Lerna will auto-detect the packages whose versions got updated in `package.json` and ask you to confirm the packages to be updated and their corresponding versions.
5. Announce the new version in the `#kotti` slack channel

```bash
yarn run lerna publish from-package
```
#### Debugging

9. If any new icon is needed in Kotti, create a PR updating the `@3yourmind/yoco` version in `package.json` in `kotti-ui`
In case this does not work as expected, you want to check out the [publish script](internals/scripts/source/publish.ts) and the [github workflow definition](.github/workflows/publish.yml) that drive this action

### Build

Expand Down
6 changes: 5 additions & 1 deletion internals/scripts/source/publish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
import { $, semver } from 'bun'
import { z } from 'zod'

const packagesToConsider = ['packages/eslint-config', 'packages/yoco']
const packagesToConsider = [
'packages/eslint-config',
'packages/vue-use-tippy',
'packages/yoco',
]

const packageJsonSchema = z.object({ name: z.string(), version: z.string() })

Expand Down
90 changes: 90 additions & 0 deletions packages/eslint-config/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# @3yourmind/eslint-config

## Usage

```ts
import tseslint from 'typescript-eslint'
import eslintConfig3YD from '@3yourmind/eslint-config'

const config = tseslint.config(
/**
* DO NOT ADD ANY OTHER KEYS TO THIS FIRST OBJECT
*
* @see {@link https://eslint.org/docs/latest/use/configure/ignore#ignoring-files}
*/
{
ignores: ['**/dist/**', '**/.nuxt/**', '**/.turbo/**'], // global ignores
},
...eslintConfig3YD.configs.global, // enables recommended eslint settings globally
{
languageOptions: {
ecmaVersion: 2022,
parserOptions: {
debugLevel: 'typescript-eslint',
project: [
'./tsconfig.json',
// FIXME: Change these to your `tsconfig.json`s
// './packages/*/tsconfig.json',
],
tsconfigRootDir: 'FIXME: You may want to specify this directory',
},
sourceType: 'module',
},
},
...eslintConfig3YD.configs.default.map((config) => ({
...config,
// Example: apply config to only these files
files: ['packages/**/*.ts', 'packages/**/*.tsx'],
})),
// Example: apply config to all default files
...eslintConfig3YD.configs.untyped,
...eslintConfig3YD.configs.json,
...eslintConfig3YD.configs.tests.map((config) => ({
...config,
// FIXME: Add your custom test files here
files: [.
..config.files,
// 'packages/*/source/test-utils/**/*.ts'
]
})),
...eslintConfig3YD.configs.vue,
{
rules: {
// add your overrides here
// '@typescript-eslint/no-restricted-imports': 'off',
},
},
)

export default config
```

## Installation & Requirements

`@3yourmind/eslint-config` requires `eslint>=9` and its new FlatConfig format

```sh
npm add --save @3yourmind/eslint-config
# or
yarn add @3yourmind/eslint-config
```

## Configurations

- `eslintConfig3YD.configs.default`
- Should be used on .ts and .tsx files. This enables rules that rely on type checking.
- `eslintConfig3YD.configs.global`
- Registers plugins and settings that should be globally enabled.
- `eslintConfig3YD.configs.json`
- Should be used only on JSON files. Treats some files (e.g. tsconfig) as jsonc.
- `eslintConfig3YD.configs.tests`
- Should be used on test files. It includes vitest-specific rules and turns off rules that would be unhelpful/annoying when writing tests.
- `eslintConfig3YD.configs.untyped`
- Enables basic rules for javascript files. Use a more specific config if possible

## Custom Rules

- `vue-consistent-ref-names`: <https://github.com/3YOURMIND/kotti/blob/master/packages/eslint-config/source/rules/vue-consistent-ref-names.ts>
- `vue-no-v-model-deep`: <https://github.com/3YOURMIND/kotti/blob/master/packages/eslint-config/source/rules/vue-no-v-model-deep.ts>
- `vue-no-v-t-on-components`: <https://github.com/3YOURMIND/kotti/blob/master/packages/eslint-config/source/rules/vue-no-v-t-on-components.ts>
- `vue-no-v-t-without-translation`: <https://github.com/3YOURMIND/kotti/blob/master/packages/eslint-config/source/rules/vue-no-v-t-without-translation.ts>
2 changes: 1 addition & 1 deletion packages/eslint-config/source/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ export default {
},
),
/**
* Should be used on test files. It includes vitest-specific rules and tuns off rules that
* Should be used on test files. It includes vitest-specific rules and turns off rules that
* would be unhelpful/annoying when writing tests.
*/
tests: tseslint.config({
Expand Down

0 comments on commit 2ee7efc

Please sign in to comment.