From b1a779cc1ecaf52b7138b77d86e34dae6cfb8465 Mon Sep 17 00:00:00 2001 From: Dmitry Fuks Date: Thu, 20 Jun 2024 23:12:55 +0300 Subject: [PATCH] add release action --- .github/workflows/build-and-publish.yml | 45 +++++++++++++-- README.md | 0 package.json | 2 +- packages/plugin/README.md | 74 +++++++++++++------------ yarn.lock | 22 +------- 5 files changed, 79 insertions(+), 64 deletions(-) delete mode 100644 README.md diff --git a/.github/workflows/build-and-publish.yml b/.github/workflows/build-and-publish.yml index 84a8d49..3239129 100644 --- a/.github/workflows/build-and-publish.yml +++ b/.github/workflows/build-and-publish.yml @@ -5,6 +5,9 @@ on: push jobs: build-and-publish: runs-on: ubuntu-latest + defaults: + run: + working-directory: ./packages/plugin env: NPM_DIFUKS_TOKEN: ${{ secrets.NPM_DIFUKS_TOKEN }} steps: @@ -27,13 +30,10 @@ jobs: run: yarn - name: Build plugin - run: yarn build:plugin + run: yarn build - name: Lint plugin - run: yarn lint:plugin - - - name: Run example - run: yarn build:tspc + run: yarn lint - name: Check packages versions if: github.ref != 'refs/heads/main' @@ -45,12 +45,45 @@ jobs: - name: Publish package if: github.ref == 'refs/heads/main' - run: yarn workspace ts-overrides-plugin npm publish --tolerate-republish + run: yarn npm publish --tolerate-republish + + - uses: stefanzweifel/git-auto-commit-action@v5 + if: github.ref == 'refs/heads/main' + with: + commit_message: | + ci: Release packages + + [skip ci] + + - name: Get package version + if: github.ref == 'refs/heads/main' + id: package-version + uses: martinbeentjes/npm-get-version-action@v1.3.1 + with: + path: packages/plugin - uses: stefanzweifel/git-auto-commit-action@v5 if: github.ref == 'refs/heads/main' with: + tagging_message: v${{ steps.package-version.outputs.current-version }} commit_message: | ci: Release packages [skip ci] + + - name: Get pull request info + if: github.ref == 'refs/heads/main' + id: pull-request-info + uses: actions-ecosystem/action-get-merged-pull-request@v1.0.1 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + + - uses: ncipollo/release-action@v1 + id: create-release + if: github.ref == 'refs/heads/main' + with: + skipIfReleaseExists: true + makeLatest: true + name: Release ${{ steps.package-version.outputs.current-version }} + body: ${{ steps.pull-request-info.outputs.body }} + tag: v${{ steps.package-version.outputs.current-version }} diff --git a/README.md b/README.md deleted file mode 100644 index e69de29..0000000 diff --git a/package.json b/package.json index bdb4723..a629b02 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "watch:fork-ts": "yarn workspace example watch:fork-ts" }, "devDependencies": { - "typescript": "5.2.2" + "typescript": "5.5.1-rc" }, "packageManager": "yarn@4.3.0" } diff --git a/packages/plugin/README.md b/packages/plugin/README.md index cd18337..88b25a9 100644 --- a/packages/plugin/README.md +++ b/packages/plugin/README.md @@ -1,52 +1,59 @@ # ts-overrides-plugin -Плагин для `TypeScript`, который позволяет переопределять `tsconfig` для определенных файлов +A plugin for `TypeScript` that allows overriding `tsconfig` for specific files [![typedoc-theme-hierarchy (latest)](https://img.shields.io/npm/v/ts-overrides-plugin)](https://www.npmjs.com/package/ts-overrides-plugin) [![typedoc-theme-hierarchy (downloads)](https://img.shields.io/npm/dw/ts-overrides-plugin)](https://www.npmjs.com/package/ts-overrides-plugin) [![typedoc-theme-hierarchy (stars)](https://img.shields.io/github/stars/difuks/ts-overrides-plugin?style=social)](https://github.com/DiFuks/ts-overrides-plugin) -## Зачем нужен? +## Why is it needed? -Самый популярный вариант использования – перевод проекта с `strict: false` на `strict: true`, но также подходит для -любых других случаев, когда нужно переопределить настройки `tsconfig` для определенных файлов. +The most popular use case is transitioning a project from `strict: false` to `strict: true`, but it can also be used for +any other cases where you need to override the `tsconfig` settings for specific files. -## Что умеет? +## What can it do? -- Переопределять диагностику для файлов в `IDE` -- Переопределять подсказки о типах при наведении на переменные в `IDE` -- Переопределять диагностику для файлов в `webpack`, `tsc` и других сборщиках, где можно использовать `ts-patch` +- Override diagnostics for files in the `IDE` +- Override type hints when hovering over variables in the `IDE` +- Override diagnostics for files in `webpack`, `tsc`, and other builders that use `ts-patch` -## Установка и настройка -Примеры можно увидеть в папке [`example`](https://github.com/DiFuks/ts-overrides-plugin/tree/main/packages/example). +## Known issues -### Для использования плагина только в IDE +- Paths in `tsconfig` should not start with `./` +- The plugin does not work in `WebStorm` when using `yarn pnp` +- Some issues may be caused by incompatibility of the latest TypeScript version with ts-patch. For example: [issue](https://github.com/nonara/ts-patch/issues/152), [issue](https://github.com/nonara/ts-patch/issues/140), [issue](https://github.com/nonara/ts-patch/issues/159) -Выполнить в терминале: +## Installation and setup + +Examples can be seen in the [`example`](https://github.com/DiFuks/ts-overrides-plugin/tree/main/packages/example) folder. + +### For using the plugin only in the IDE + +Execute in the terminal: ```bash yarn add -D ts-overrides-plugin ``` -В файле `tsconfig.json` добавить: +In the `tsconfig.json` file, add: ```json5 { "compilerOptions": { - "strict": false, // Настройки по умолчанию + "strict": false, // Default settings "plugins": [ { "name": "ts-overrides-plugin", "config": { "overrides": [ { - "files": ["src/modern/**/*.{ts,tsx}"], // Путь к файлам (glob), для которых нужно переопределить настройки. Не должен начинаться с './' - "compilerOptions": { // Настройки для этих файлов + "files": ["src/modern/**/*.{ts,tsx}"], // Path to files (glob) for which settings need to be overridden. Should not start with './' + "compilerOptions": { // Settings for these files "strict": true } }, { "files": ["src/legacy/**/*.{ts,tsx}"], - "compilerOptions": { // Настройки наследуются только от настроек по умолчанию + "compilerOptions": { // Settings are inherited only from the default settings "strict": true, "strictNullChecks": false } @@ -59,22 +66,22 @@ yarn add -D ts-overrides-plugin } ``` -### Для использования в `webpack`, `tsc` +### For use in `webpack`, `tsc` -Для корректной работы плагина в `webpack`, `tsc` необходимо использовать библиотеку [`ts-patch`](https://github.com/nonara/ts-patch). +For the plugin to work correctly in `webpack`, `tsc`, it's necessary to use the [`ts-patch`](https://github.com/nonara/ts-patch) library. -Выполнить в терминале: +Execute in the terminal: ```bash yarn add -D ts-overrides-plugin ts-patch ``` -В файле `tsconfig.json` добавить: +In the `tsconfig.json` file, add: ```json5 { "compilerOptions": { - "strict": false, // Настройки по умолчанию + "strict": false, // Default settings "plugins": [ { "name": "ts-overrides-plugin", @@ -82,14 +89,14 @@ yarn add -D ts-overrides-plugin ts-patch "transformProgram": true, "overrides": [ { - "files": ["src/modern/**/*.{ts,tsx}"], // Путь к файлам (glob), для которых нужно переопределить настройки. Не должен начинаться с './' - "compilerOptions": { // Настройки для этих файлов + "files": ["src/modern/**/*.{ts,tsx}"], // Path to files (glob) for which settings need to be overridden. Should not start with './' + "compilerOptions": { // Settings for these files "strict": true, }, }, { "files": ["src/legacy/**/*.{ts,tsx}"], - "compilerOptions": { // Настройки наследуются только от настроек по умолчанию + "compilerOptions": { // Settings are inherited only from the default settings "strict": true, "strictNullChecks": false } @@ -101,11 +108,11 @@ yarn add -D ts-overrides-plugin ts-patch } ``` -Если вы используете [`Persistent Patch`](https://github.com/nonara/ts-patch?tab=readme-ov-file#method-2-persistent-patch) -в `ts-patch`, то больше ничего делать не нужно, если же [`Live Compiler`](https://github.com/nonara/ts-patch?tab=readme-ov-file#method-1-live-compiler), то -необходимо выполнить следующие действия: +If you are using [`Persistent Patch`](https://github.com/nonara/ts-patch?tab=readme-ov-file#method-2-persistent-patch) +with `ts-patch`, then there is nothing more to do. If, however, you are using [`Live Compiler`](https://github.com/nonara/ts-patch?tab=readme-ov-file#method-1-live-compiler), the +following steps are necessary: -Для команды `tsc` – заменить на `tspc` в `package.json`: +For the `tsc` command – replace it with `tspc` in `package.json`: ```json5 { @@ -115,7 +122,7 @@ yarn add -D ts-overrides-plugin ts-patch } ``` -Для `ForkTsCheckerWebpackPlugin` в файле `webpack.config.js` добавить: +For `ForkTsCheckerWebpackPlugin` in the `webpack.config.js` file, add: ```js const path = require('path'); @@ -131,7 +138,7 @@ module.exports = { }; ``` -Для `ts-loader` в файле `webpack.config.js` добавить: +For `ts-loader` in the `webpack.config.js` file, add: ```js const path = require('path'); @@ -151,8 +158,3 @@ module.exports = { }, }; ``` - -## Известные проблемы - -- Пути в `tsconfig` не должны начинаться с `./` -- Плагин не работает в `WebStorm` при использовании `yarn pnp` diff --git a/yarn.lock b/yarn.lock index ee5f471..3900e93 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6721,7 +6721,7 @@ __metadata: version: 0.0.0-use.local resolution: "ts-overrides-plugin-sample@workspace:." dependencies: - typescript: "npm:5.2.2" + typescript: "npm:5.5.1-rc" languageName: unknown linkType: soft @@ -6865,16 +6865,6 @@ __metadata: languageName: node linkType: hard -"typescript@npm:5.2.2": - version: 5.2.2 - resolution: "typescript@npm:5.2.2" - bin: - tsc: bin/tsc - tsserver: bin/tsserver - checksum: 10c0/91ae3e6193d0ddb8656d4c418a033f0f75dec5e077ebbc2bd6d76439b93f35683936ee1bdc0e9cf94ec76863aa49f27159b5788219b50e1cd0cd6d110aa34b07 - languageName: node - linkType: hard - "typescript@npm:5.5.1-rc": version: 5.5.1-rc resolution: "typescript@npm:5.5.1-rc::__archiveUrl=https%3A%2F%2Fregistry.npmjs.org%2Ftypescript%2F-%2Ftypescript-5.5.1-rc.tgz" @@ -6885,16 +6875,6 @@ __metadata: languageName: node linkType: hard -"typescript@patch:typescript@npm%3A5.2.2#optional!builtin": - version: 5.2.2 - resolution: "typescript@patch:typescript@npm%3A5.2.2#optional!builtin::version=5.2.2&hash=f3b441" - bin: - tsc: bin/tsc - tsserver: bin/tsserver - checksum: 10c0/062c1cee1990e6b9419ce8a55162b8dc917eb87f807e4de0327dbc1c2fa4e5f61bc0dd4e034d38ff541d1ed0479b53bcee8e4de3a4075c51a1724eb6216cb6f5 - languageName: node - linkType: hard - "typescript@patch:typescript@npm%3A5.5.1-rc#optional!builtin": version: 5.5.1-rc resolution: "typescript@patch:typescript@npm%3A5.5.1-rc%3A%3A__archiveUrl=https%253A%252F%252Fregistry.npmjs.org%252Ftypescript%252F-%252Ftypescript-5.5.1-rc.tgz#optional!builtin::version=5.5.1-rc&hash=b45daf"