Skip to content

Commit 9df0695

Browse files
authored
Merge pull request #2 from react18-tools/tsup
Optimize build
2 parents 4340472 + e423462 commit 9df0695

File tree

12 files changed

+159
-14
lines changed

12 files changed

+159
-14
lines changed

.changeset/pre.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"mode": "exit",
3+
"tag": "tsup",
4+
"initialVersions": {
5+
"@example/nextjs": "0.0.0",
6+
"@example/vite": "0.0.0",
7+
"react-markdown-autolink": "0.0.1-tsup.0",
8+
"@repo/eslint-config": "0.0.0",
9+
"@repo/typescript-config": "0.0.0",
10+
"@repo/shared": "0.0.1-tsup.0",
11+
"@repo/scripts": "0.0.0"
12+
},
13+
"changesets": [
14+
"tough-glasses-design",
15+
"wet-cows-occur"
16+
]
17+
}

.changeset/tough-glasses-design.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"react-markdown-autolink": patch
3+
---
4+
5+
Optimize vite build

.changeset/wet-cows-occur.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"react-markdown-autolink": patch
3+
---
4+
5+
Build with tsup

lib/CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# react-markdown-autolink
2+
3+
## 0.0.1-tsup.1
4+
5+
### Patch Changes
6+
7+
- d8d358d: Optimize vite build
8+
9+
## 0.0.1-tsup.0
10+
11+
### Patch Changes
12+
13+
- bc244c3: Build with tsup

lib/package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "react-markdown-autolink",
33
"author": "Mayank Kumar Chaudhari <https://mayank-chaudhari.vercel.app>",
44
"private": false,
5-
"version": "0.0.0",
5+
"version": "0.0.1-tsup.1",
66
"description": "A highly lightweight utility that automatically detects and makes links clickable in Markdown.",
77
"license": "MPL-2.0",
88
"main": "./dist/index.js",
@@ -28,10 +28,12 @@
2828
"@repo/typescript-config": "workspace:*",
2929
"@types/node": "^20.14.10",
3030
"@vitest/coverage-v8": "^2.0.2",
31+
"esbuild-plugin-react18": "^0.2.4",
32+
"tsup": "^8.1.0",
3133
"typescript": "^5.5.3",
34+
"vite": "^5.3.3",
3235
"vite-tsconfig-paths": "^4.3.2",
33-
"vitest": "^2.0.2",
34-
"vite": "^5.3.3"
36+
"vitest": "^2.0.2"
3537
},
3638
"funding": [
3739
{

lib/tsup.config.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { defineConfig } from "tsup";
2+
import react18Plugin from "esbuild-plugin-react18";
3+
4+
export default defineConfig(options => ({
5+
format: ["cjs", "esm"],
6+
target: "es2015",
7+
entry: ["./src"],
8+
sourcemap: false,
9+
clean: !options.watch,
10+
bundle: true,
11+
minify: !options.watch,
12+
esbuildPlugins: [react18Plugin()],
13+
}));

packages/shared/CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# @repo/shared
2+
3+
## 0.0.1-tsup.1
4+
5+
### Patch Changes
6+
7+
- Updated dependencies [d8d358d]
8+
- react-markdown-autolink@0.0.1-tsup.1
9+
10+
## 0.0.1-tsup.0
11+
12+
### Patch Changes
13+
14+
- Updated dependencies [bc244c3]
15+
- react-markdown-autolink@0.0.1-tsup.0

packages/shared/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@repo/shared",
3-
"version": "0.0.0",
3+
"version": "0.0.1-tsup.1",
44
"private": true,
55
"sideEffects": false,
66
"main": "./dist/index.js",

pnpm-lock.yaml

Lines changed: 66 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/manual-publish.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,7 @@ execSync(`cd lib && pnpm build && npm publish --provenance --access public --tag
7575
execSync(
7676
`gh release create ${NEW_VERSION} --generate-notes${isLatestRelease ? " --latest" : ""} -n "$(sed '1,/^## /d;/^## /,$d' CHANGELOG.md)" --title "Release v${NEW_VERSION}"`,
7777
);
78+
79+
// Publish canonical packages
80+
const { publishCanonicals } = require("./publish-canonical");
81+
publishCanonicals(tag);

scripts/publish-canonical.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
const { execSync } = require("child_process");
2+
3+
const publishCanonicals = tag => {
4+
// Publish canonical packages
5+
["markdown-autolink"].forEach(pkg => {
6+
execSync(`sed -i -e "s/name.*/name\\": \\"${pkg}\\",/" lib/package.json`);
7+
execSync(`cd lib && npm publish --provenance --access public --tag ${tag ?? "latest"}`);
8+
});
9+
};
10+
11+
module.exports = { publishCanonicals };

scripts/publish.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,7 @@ execSync("cd lib && pnpm build && npm publish --provenance --access public");
4646
execSync(
4747
`gh release create ${VERSION} --generate-notes --latest -n "$(sed '1,/^## /d;/^## /,$d' CHANGELOG.md)" --title "Release v${VERSION}"`,
4848
);
49+
50+
// Publish canonical packages
51+
const { publishCanonicals } = require("./publish-canonical");
52+
publishCanonicals();

0 commit comments

Comments
 (0)