From 4e5e98fc59e965fb3e3fc9751de88c3381aaeacd Mon Sep 17 00:00:00 2001
From: Moritz Vetter <16950410+Isokaeder@users.noreply.github.com>
Date: Tue, 14 May 2024 17:39:55 +0200
Subject: [PATCH 1/2] documentation(publish/eslint): describe new autopublish
workflow and add documentation for packages/eslint-config
Co-Authored-By: Florian Wendelborn <1133858+FlorianWendelborn@users.noreply.github.com>
---
README.md | 101 +++++++------------------
internals/scripts/source/publish.ts | 6 +-
packages/eslint-config/README.md | 90 ++++++++++++++++++++++
packages/eslint-config/source/index.ts | 2 +-
4 files changed, 125 insertions(+), 74 deletions(-)
create mode 100644 packages/eslint-config/README.md
diff --git a/README.md b/README.md
index 5f49a93cea..f598f1e4bd 100644
--- a/README.md
+++ b/README.md
@@ -150,11 +150,17 @@ 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`
@@ -162,99 +168,50 @@ yarn run test
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
```
-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
```
-7. Build yoco
+3. Create a pull request that bumps the version:
+ a. Update the version in `packages/yoco/package.json`
+ b. Update the yoco 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
diff --git a/internals/scripts/source/publish.ts b/internals/scripts/source/publish.ts
index 7e38a0ea80..2f6daf11f1 100644
--- a/internals/scripts/source/publish.ts
+++ b/internals/scripts/source/publish.ts
@@ -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() })
diff --git a/packages/eslint-config/README.md b/packages/eslint-config/README.md
new file mode 100644
index 0000000000..4ced7214d5
--- /dev/null
+++ b/packages/eslint-config/README.md
@@ -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 install --save-dev @3yourmind/eslint-config
+# or
+yarn add --dev @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`:
+- `vue-no-v-model-deep`:
+- `vue-no-v-t-on-components`:
+- `vue-no-v-t-without-translation`:
diff --git a/packages/eslint-config/source/index.ts b/packages/eslint-config/source/index.ts
index 1af6235422..8e110e3365 100644
--- a/packages/eslint-config/source/index.ts
+++ b/packages/eslint-config/source/index.ts
@@ -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({
From 2710d06905a325acdf58a1c2e018b1b7f1643d47 Mon Sep 17 00:00:00 2001
From: Moritz Vetter <16950410+Isokaeder@users.noreply.github.com>
Date: Tue, 14 May 2024 17:49:35 +0200
Subject: [PATCH 2/2] version(eslint-config@0.0.2): add readme
---
packages/eslint-config/package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/packages/eslint-config/package.json b/packages/eslint-config/package.json
index f70568d2f5..9cb823fb8a 100644
--- a/packages/eslint-config/package.json
+++ b/packages/eslint-config/package.json
@@ -61,5 +61,5 @@
},
"type": "module",
"types": "./dist/mjs/index.d.ts",
- "version": "0.0.1"
+ "version": "0.0.2"
}