Skip to content

Commit

Permalink
⚙️ Chore(bundler,package.json,Readme.md)!: change webpack => tsup
Browse files Browse the repository at this point in the history
… + remove unnecessary packages + Fix Readme.md and add minified readme.md for build
  • Loading branch information
INeedJobToStartWork committed Mar 3, 2024
1 parent 0068d4c commit eb1528e
Show file tree
Hide file tree
Showing 14 changed files with 459 additions and 1,552 deletions.
48 changes: 48 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# Visual Studio Code #
.vscode/
**/.vscode/
**/.vscode/*
**/.vscode/**

# dependencies
node_modules
.pnp
.pnp.js

# testing
coverage

# next.js
.next/
out/

# production
build
dist
**/dist/**
lib

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts

# turbo
.turbo
.vscode/settings.json
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@

- [Install](#install)
- [Types](#types)
- [Functions](#existing-functions)
- [myErrorWrapper](#custom-file-path)
- [myErrorCatcher](#init-config)
- [myErrorHandler](#init-config)
- [Objects](#new-functions)
- [MyErrorList](#init-config)
- [MyErrorHandlerList](#init-config)
- [Functions](#functions)
- [myErrorWrapper](#myErrorWrapper)
- [myErrorCatcher](#myErrorCatcher)
- [myErrorHandler](#myErrorHandler)
- [Objects](#Objects)
- [MyErrorList](#MyErrorList)
- [MyHandler](#MyHandler)
- [Sample of Code](#sample-of-code)

## Install
Expand Down Expand Up @@ -232,7 +232,7 @@ const ErrorList = {
} as const satisfies TMyErrorList;
```

### TMyHandler
### MyHandler

List of Errors handlers which your function can run.

Expand Down
40 changes: 40 additions & 0 deletions README.npm.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
![image](https://github.com/INeedJobToStartWork/MyError/assets/97305201/03fa3e50-af28-4345-a3f7-f84d091b4eb1)

<h1 align="center">MyError</h1>
<p align="center"><b>Very Clean Error Handler!</b></p>
<p align="center"><b>Rest of the README.md at [Github](https://github.com/INeedJobToStartWork/MyError#readme)</b></p>

<hr/>

## Install

NPM

```bash copy
npm install oh-my-error
```

PNPM

```bash copy
pnpm add oh-my-error
```

Yarn

```bash copy
yarn add oh-my-error
```

# 📜 List of Contest

- [Install](https://github.com/INeedJobToStartWork/MyError?tab=readme-ov-file#install)
- [Types](https://github.com/INeedJobToStartWork/MyError?tab=readme-ov-file#types)
- [Functions](https://github.com/INeedJobToStartWork/MyError?tab=readme-ov-file#functions)
- [myErrorWrapper](https://github.com/INeedJobToStartWork/MyError?tab=readme-ov-file#myErrorWrapper)
- [myErrorCatcher](https://github.com/INeedJobToStartWork/MyError?tab=readme-ov-file#myErrorCatcher)
- [myErrorHandler](https://github.com/INeedJobToStartWork/MyError?tab=readme-ov-file#myErrorHandler)
- [Objects](https://github.com/INeedJobToStartWork/MyError?tab=readme-ov-file#Objects)
- [MyErrorList](https://github.com/INeedJobToStartWork/MyError?tab=readme-ov-file#MyErrorList)
- [MyHandler](https://github.com/INeedJobToStartWork/MyError?tab=readme-ov-file#MyHandler)
- [Sample of Code](https://github.com/INeedJobToStartWork/MyError?tab=readme-ov-file#sample-of-code)
3 changes: 1 addition & 2 deletions clean-package.config.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"indent": 4,
"remove": ["devDependencies", "dependencies", "lint-staged", "bin", "module"],
"remove": ["devDependencies", "dependencies", "lint-staged", "bin", "module", "main"],
"replace": {
"main": "index.mjs",
"scripts": {
"npm:postpack": "clean-package restore"
}
Expand Down
1 change: 1 addition & 0 deletions config/tsconfig/base.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"$schema": "https://json.schemastore.org/tsconfig",
"compilerOptions": {
"declaration": true,
"isolatedModules": true,
"lib": ["esnext", "dom"],
"module": "ESNext",
"moduleResolution": "Bundler",
Expand Down
8 changes: 8 additions & 0 deletions config/tsuprc/tsup.base.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { defineConfig } from "tsup";

export default defineConfig({
entry: ["src/index.ts"],
sourcemap: true,
clean: true,
format: ["cjs", "esm"]
});
8 changes: 8 additions & 0 deletions config/tsuprc/tsup.dev.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import config from "./tsup.base";
import { defineConfig } from "tsup";

export default defineConfig({
...config,
outDir: "lib",
watch: ["src"]
});
22 changes: 22 additions & 0 deletions config/tsuprc/tsup.prod.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { copy } from "esbuild-plugin-copy";
import config from "./tsup.base";
import { defineConfig } from "tsup";

export default defineConfig({
...config,
splitting: true,
sourcemap: true,
minify: true,
shims: true,
outDir: "dist",
dts: true,
format: ["cjs", "esm"],
esbuildPlugins: [
copy({
assets: [
{ from: "./package.json", to: "./package.json" },
{ from: "./README.npm.md", to: "./README.md" }
]
})
]
});
48 changes: 0 additions & 48 deletions config/webpack/webpack.base.js

This file was deleted.

10 changes: 0 additions & 10 deletions config/webpack/webpack.dev.js

This file was deleted.

47 changes: 0 additions & 47 deletions config/webpack/webpack.prod.js

This file was deleted.

22 changes: 7 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@
".": {
"types": {
"import": "./index.d.ts",
"require": "./index.d.ts"
"require": "./index.d.cts"
},
"import": "./index.mjs",
"require": "./index.cjs",
"*": "./*"
}
},
"scripts": {
"build": "webpack --config ./config/webpack/webpack.prod.js && gen-esm-wrapper ./dist/index.cjs ./dist/index.mjs",
"build:npm": "pnpm npm:prepack && webpack --config ./config/webpack/webpack.prod.js && pnpm npm:postpack && gen-esm-wrapper ./dist/index.cjs ./dist/index.mjs",
"dev": "webpack --config ./config/webpack/webpack.dev.js",
"build": "pnpm tsup --config ./config/tsuprc/tsup.prod.ts",
"build:npm": "pnpm npm:prepack && pnpm tsup --config ./config/tsuprc/tsup.prod.ts && pnpm npm:postpack",
"dev": "pnpm tsup --config ./config/tsuprc/tsup.dev.ts",
"format": "pnpm prettier . --write && pnpm prettier . --check",
"preinstall": "husky install",
"link-cli": "pnpm unlink --global && pnpm link --global",
Expand Down Expand Up @@ -51,32 +51,24 @@
"devDependencies": {
"@changesets/cli": "^2.27.1",
"@stylistic/eslint-plugin": "^1.6.0",
"@swc/cli": "^0.1.65",
"@swc/core": "^1.4.0",
"@types/node": "^20.11.16",
"@typescript-eslint/eslint-plugin": "^6.21.0",
"bundle-declarations-webpack-plugin": "^5.0.1",
"clean-package": "^2.2.0",
"commitsmile": "^0.5.0",
"copy-webpack-plugin": "^12.0.2",
"esbuild-plugin-copy": "^2.1.1",
"eslint-plugin-optimize-regex": "^1.2.1",
"eslint-plugin-pii": "^1.0.2",
"eslint-plugin-security": "^2.1.0",
"eslint-plugin-sort-keys-fix": "^1.1.2",
"gen-esm-wrapper": "^1.1.3",
"globals": "^13.24.0",
"husky": "^8.0.3",
"json-minimizer-webpack-plugin": "^5.0.0",
"lint-staged": "^15.2.2",
"prettier": "^3.2.5",
"prettier-plugin-packagejson": "^2.4.10",
"swc-loader": "^0.2.6",
"ts-loader": "^9.5.1",
"tsup": "^8.0.2",
"typescript": "^5.3.3",
"vitest": "^1.2.2",
"webpack": "^5.90.1",
"webpack-cli": "^5.1.4",
"webpack-merge": "^5.10.0"
"vitest": "^1.2.2"
},
"packageManager": "[email protected]",
"engines": {
Expand Down
Loading

0 comments on commit eb1528e

Please sign in to comment.