Skip to content

Commit

Permalink
feat: release use tsup
Browse files Browse the repository at this point in the history
  • Loading branch information
sonofmagic committed May 16, 2024
1 parent 1efbd33 commit e47c4ff
Show file tree
Hide file tree
Showing 15 changed files with 722 additions and 792 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

本人用于编写的一个 `npm` 包的一个模板

- 使用 `rollup` 打包 (兼容 `tsc`)
- 使用 ~~`rollup`~~ `tsup`(esbuild) 打包 , `rollup` 打包版本在 [rollup](https://github.com/sonofmagic/npm-lib-rollup-template/tree/rollup) 分支 (兼容 `tsc`)
- 使用 ~~`jest`~~ `vitest` 作为单元测试框架
- 使用 `eslint` 来规范代码风格,默认风格为 `standard`
- 使用 `eslint` 来规范代码风格
- 输出 `dist` -> `cjs`,`esm` and `.d.ts`
- 使用 `semantic-release` 来发布 `npm`/`github`

Expand All @@ -28,4 +28,4 @@

执行 `npm run init:bin`

作用为 `package.json` 添加 `files``bin`,同时生成 `bin/{{pkg.name}}.js``src/cli.ts` 文件
作用为 `package.json` 添加 `files``bin`,同时生成 `bin/{{pkg.name}}.js``src/cli.ts` 文件
52 changes: 26 additions & 26 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,37 @@
"name": "npm-lib-rollup-template",
"version": "0.0.0",
"description": "npm-lib-rollup-template",
"main": "dist/index.js",
"module": "dist/index.mjs",
"types": "types/index.d.ts",
"type": "module",
"main": "dist/index.cjs",
"module": "dist/index.js",
"types": "dist/index.d.ts",
"exports": {
"./package.json": "./package.json",
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js",
"require": "./dist/index.cjs"
},
"./*": "./*"
},
"typesVersions": {
"*": {
"*": [
"./dist/*",
"./dist/index.d.ts"
]
}
},
"scripts": {
"dev": "pnpm clean && pnpm dts && cross-env NODE_ENV=development rollup --config rollup.config.ts --configPlugin typescript -w",
"build": "pnpm clean && pnpm dts && cross-env NODE_ENV=production rollup --config rollup.config.ts --configPlugin typescript",
"build:tsc": "cross-env NODE_ENV=development tsc --build tsconfig.json",
"dts": "tsc --emitDeclarationOnly -p tsconfig.dts.json",
"dev": "tsup --watch --sourcemap",
"build:dev": "tsup --sourcemap",
"build": "tsup",
"test:dev": "vitest",
"test": "vitest run",
"init:rename": "node scripts/init/rename.js",
"init:bin": "node scripts/init/bin.js",
"clean": "node scripts/clean.js",
"format": "pnpm prettier --check \"src/**/*.{ts,js}\" -w",
"ls:pack": "npm pack --dry-run",
"prepare": "ts-patch install -s",
"semantic-release": "semantic-release"
},
"packageManager": "[email protected]",
Expand All @@ -26,8 +41,7 @@
"url": "https://github.com/sonofmagic/npm-lib-rollup-template.git"
},
"files": [
"dist",
"types"
"dist"
],
"publishConfig": {
"access": "public",
Expand All @@ -42,13 +56,6 @@
"homepage": "https://github.com/sonofmagic/npm-lib-rollup-template#readme",
"devDependencies": {
"@icebreakers/eslint-config": "^0.1.0",
"@rollup/plugin-alias": "^5.1.0",
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-replace": "^5.0.5",
"@rollup/plugin-terser": "^0.4.4",
"@rollup/plugin-typescript": "^11.1.6",
"@tsconfig/recommended": "^1.0.6",
"@types/klaw": "^3.0.6",
"@types/lodash": "^4.17.1",
Expand All @@ -63,16 +70,9 @@
"klaw": "^4.1.0",
"lodash": "^4.17.21",
"lodash-es": "^4.17.21",
"only-allow": "^1.2.1",
"rollup": "^4.17.2",
"rollup-plugin-visualizer": "^5.12.0",
"semantic-release": "^23.1.1",
"ts-node": "^10.9.2",
"ts-patch": "^3.1.2",
"tsconfig-paths": "^4.2.0",
"tslib": "^2.6.2",
"tsup": "^8.0.2",
"typescript": "^5.4.5",
"typescript-transform-paths": "^3.4.7",
"vitest": "^1.6.0"
}
}
Loading

0 comments on commit e47c4ff

Please sign in to comment.