Skip to content

Commit

Permalink
Merge pull request #1 from DiFuks/prepare-to-publish
Browse files Browse the repository at this point in the history
Prepare to publish
  • Loading branch information
DiFuks authored Jun 20, 2024
2 parents 766ac63 + 0bb2ef1 commit ac9c50b
Show file tree
Hide file tree
Showing 33 changed files with 5,049 additions and 1,840 deletions.
1 change: 1 addition & 0 deletions .github/README.md
89 changes: 89 additions & 0 deletions .github/workflows/build-and-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Build and Publish

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:
- uses: actions/checkout@v4
with:
token: ${{ secrets.PERSONAL_TOKEN }}

# for yarn version check
- if: github.ref != 'refs/heads/main'
run: |
git fetch --unshallow origin main
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: yarn
cache-dependency-path: yarn.lock

- name: Install modules
run: yarn

- name: Build plugin
run: yarn build

- name: Lint plugin
run: yarn lint

- name: Check packages versions
if: github.ref != 'refs/heads/main'
run: yarn version check

- name: Apply versions
if: github.ref == 'refs/heads/main'
run: yarn version apply

- name: Publish package
if: github.ref == 'refs/heads/main'
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/[email protected]
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/[email protected]
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 }}
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
.idea

.yarn/*
!.yarn/patches
!.yarn/plugins
Expand Down
10 changes: 10 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/jsLinters/eslint.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions .idea/ts-overrides-plugin-example.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v20.13.0
5 changes: 5 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"recommendations": [
"arcanis.vscode-zipfs"
]
}
8 changes: 8 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"search.exclude": {
"**/.yarn": true,
"**/.pnp.*": true
},
"typescript.tsdk": ".yarn/sdks/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true
}
893 changes: 0 additions & 893 deletions .yarn/releases/yarn-4.0.2.cjs

This file was deleted.

894 changes: 894 additions & 0 deletions .yarn/releases/yarn-4.3.0.cjs

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions .yarn/versions/420531ed.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
declined:
- ts-overrides-plugin
18 changes: 17 additions & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
enableGlobalCache: true

nodeLinker: node-modules

npmAuthToken: "${NPM_DIFUKS_TOKEN:-}"

npmPublishAccess: public

npmRegistryServer: "https://registry.npmjs.com/"

packageExtensions:
eslint-module-utils@*:
dependencies:
eslint-import-resolver-typescript: 3.6.1
ts-patch@*:
peerDependencies:
typescript: "*"

tsEnableAutoTypes: true

yarnPath: .yarn/releases/yarn-4.0.2.cjs
yarnPath: .yarn/releases/yarn-4.3.0.cjs
19 changes: 0 additions & 19 deletions README.md

This file was deleted.

14 changes: 9 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,18 @@
"packages/*"
],
"scripts": {
"lint:plugin": "yarn workspace ts-overrides-plugin lint",
"build:plugin": "yarn workspace ts-overrides-plugin build",
"watch:plugin": "yarn workspace ts-overrides-plugin watch",
"build:tspc": "yarn workspace example tspc",
"build:tspc": "yarn workspace example build:tspc",
"build:ts-loader": "yarn workspace example build:ts-loader",
"build:fork-ts": "yarn workspace example build:fork-ts",
"watch:tspc": "yarn workspace example tspc --watch",
"watch:ts-loader": "yarn workspace example build:ts-loader --watch",
"watch:fork-ts": "yarn workspace example build:fork-ts --watch"
"watch:tspc": "yarn workspace example watch:tspc",
"watch:ts-loader": "yarn workspace example watch:ts-loader",
"watch:fork-ts": "yarn workspace example watch:fork-ts"
},
"packageManager": "[email protected]"
"devDependencies": {
"typescript": "5.5.1-rc"
},
"packageManager": "[email protected]"
}
12 changes: 12 additions & 0 deletions packages/example/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# ts-overrides-plugin example

Commands:

```bash
yarn build:tspc
yarn build:ts-loader
yarn build:fork-ts
yarn watch:tspc
yarn watch:ts-loader
yarn watch:fork-ts
```
10 changes: 7 additions & 3 deletions packages/example/package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
{
"name": "example",
"type": "module",
"scripts": {
"build:tspc": "tspc",
"build:ts-loader": "webpack --config webpack.config.ts-loader.js",
"build:fork-ts": "webpack --config webpack.config.fork-ts.js"
"build:fork-ts": "webpack --config webpack.config.fork-ts.js",
"watch:tspc": "tspc --watch",
"watch:ts-loader": "webpack --config webpack.config.ts-loader.js --watch",
"watch:fork-ts": "webpack --config webpack.config.fork-ts.js --watch"
},
"devDependencies": {
"@babel/core": "^7.23.6",
Expand All @@ -16,8 +20,8 @@
"ts-loader": "^9.5.1",
"ts-node": "^10.9.2",
"ts-overrides-plugin": "workspce:*",
"ts-patch": "3.1.1",
"typescript": "^5.3.3",
"ts-patch": "3.2.0",
"typescript": "5.5.1-rc",
"webpack": "^5.89.0",
"webpack-cli": "^5.1.4"
},
Expand Down
5 changes: 4 additions & 1 deletion packages/example/src/legacy/getDate.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// ok with strict: false
export const getDate = (date) => {
const modern: string | undefined = 123;
const modern: string | undefined = undefined;

// ok with strict: false
modern.split('');

return date.toLocaleDateString('ru-RU', {
Expand All @@ -10,4 +12,5 @@ export const getDate = (date) => {
});
}

// show `string` on hover in IDE
export const someVar: string | undefined = undefined;
2 changes: 2 additions & 0 deletions packages/example/src/modern/getDate.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { someVar } from '../legacy/getDate';

// Parameter 'date' implicitly has an 'any' type.
export const getDate = (date) => {
const modern: string | undefined = undefined;

// Show `string | undefined` on hover in IDE
console.log(someVar);

// 'modern' is possibly 'undefined'
modern.split('');

return date.toLocaleDateString('ru-RU', {
Expand Down
20 changes: 11 additions & 9 deletions packages/example/webpack.config.fork-ts.js
Original file line number Diff line number Diff line change
@@ -1,31 +1,33 @@
const path = require("path");
const path = require('path');
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');

module.exports = [
{
mode: "production",
entry: "./src/index.ts",
mode: 'production',
entry: './src/index.ts',
output: {
path: path.join(__dirname, "build"),
filename: "main.js",
path: path.join(__dirname, 'build'),
filename: 'main.js',
},
module: {
rules: [
{
test: /\.ts$/,
exclude: /node_modules/,
loader: "babel-loader",
loader: 'babel-loader',
},
],
},
plugins: [new ForkTsCheckerWebpackPlugin({
plugins: [
new ForkTsCheckerWebpackPlugin({
typescript: {
typescriptPath: require.resolve('ts-patch/compiler'),
}
})],
}),
],
resolve: {
extensions: ['.ts', '.js'],
},
target: "web",
target: 'web',
}
];
19 changes: 9 additions & 10 deletions packages/example/webpack.config.ts-loader.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,28 @@
const path = require("path");
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
const path = require('path');

module.exports = [
{
mode: "production",
entry: "./src/index.ts",
mode: 'production',
entry: './src/index.ts',
output: {
path: path.join(__dirname, "build"),
filename: "main.js",
path: path.join(__dirname, 'build'),
filename: 'main.js',
},
module: {
rules: [
{
test: /\.ts$/,
exclude: /node_modules/,
loader: "ts-loader",
loader: 'ts-loader',
options: {
compiler: 'ts-patch/compiler'
compiler: require.resolve('ts-patch/compiler'),
}
},
],
},
resolve: {
extensions: ['.ts', '.js'],
},
target: "web",
target: 'web',
}
];
];
Loading

0 comments on commit ac9c50b

Please sign in to comment.