Skip to content

Optimize build #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .changeset/pre.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"mode": "exit",
"tag": "tsup",
"initialVersions": {
"@example/nextjs": "0.0.0",
"@example/vite": "0.0.0",
"react-markdown-autolink": "0.0.1-tsup.0",
"@repo/eslint-config": "0.0.0",
"@repo/typescript-config": "0.0.0",
"@repo/shared": "0.0.1-tsup.0",
"@repo/scripts": "0.0.0"
},
"changesets": [
"tough-glasses-design",
"wet-cows-occur"
]
}
5 changes: 5 additions & 0 deletions .changeset/tough-glasses-design.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"react-markdown-autolink": patch
---

Optimize vite build
5 changes: 5 additions & 0 deletions .changeset/wet-cows-occur.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"react-markdown-autolink": patch
---

Build with tsup
13 changes: 13 additions & 0 deletions lib/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# react-markdown-autolink

## 0.0.1-tsup.1

### Patch Changes

- d8d358d: Optimize vite build

## 0.0.1-tsup.0

### Patch Changes

- bc244c3: Build with tsup
8 changes: 5 additions & 3 deletions lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "react-markdown-autolink",
"author": "Mayank Kumar Chaudhari <https://mayank-chaudhari.vercel.app>",
"private": false,
"version": "0.0.0",
"version": "0.0.1-tsup.1",
"description": "A highly lightweight utility that automatically detects and makes links clickable in Markdown.",
"license": "MPL-2.0",
"main": "./dist/index.js",
Expand All @@ -28,10 +28,12 @@
"@repo/typescript-config": "workspace:*",
"@types/node": "^20.14.10",
"@vitest/coverage-v8": "^2.0.2",
"esbuild-plugin-react18": "^0.2.4",
"tsup": "^8.1.0",
"typescript": "^5.5.3",
"vite": "^5.3.3",
"vite-tsconfig-paths": "^4.3.2",
"vitest": "^2.0.2",
"vite": "^5.3.3"
"vitest": "^2.0.2"
},
"funding": [
{
Expand Down
13 changes: 13 additions & 0 deletions lib/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { defineConfig } from "tsup";
import react18Plugin from "esbuild-plugin-react18";

export default defineConfig(options => ({
format: ["cjs", "esm"],
target: "es2015",
entry: ["./src"],
sourcemap: false,
clean: !options.watch,
bundle: true,
minify: !options.watch,
esbuildPlugins: [react18Plugin()],
}));
15 changes: 15 additions & 0 deletions packages/shared/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# @repo/shared

## 0.0.1-tsup.1

### Patch Changes

- Updated dependencies [d8d358d]
- react-markdown-autolink@0.0.1-tsup.1

## 0.0.1-tsup.0

### Patch Changes

- Updated dependencies [bc244c3]
- react-markdown-autolink@0.0.1-tsup.0
2 changes: 1 addition & 1 deletion packages/shared/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@repo/shared",
"version": "0.0.0",
"version": "0.0.1-tsup.1",
"private": true,
"sideEffects": false,
"main": "./dist/index.js",
Expand Down
76 changes: 66 additions & 10 deletions pnpm-lock.yaml

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

4 changes: 4 additions & 0 deletions scripts/manual-publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,7 @@ execSync(`cd lib && pnpm build && npm publish --provenance --access public --tag
execSync(
`gh release create ${NEW_VERSION} --generate-notes${isLatestRelease ? " --latest" : ""} -n "$(sed '1,/^## /d;/^## /,$d' CHANGELOG.md)" --title "Release v${NEW_VERSION}"`,
);

// Publish canonical packages
const { publishCanonicals } = require("./publish-canonical");
publishCanonicals(tag);
11 changes: 11 additions & 0 deletions scripts/publish-canonical.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const { execSync } = require("child_process");

const publishCanonicals = tag => {
// Publish canonical packages
["markdown-autolink"].forEach(pkg => {
execSync(`sed -i -e "s/name.*/name\\": \\"${pkg}\\",/" lib/package.json`);
execSync(`cd lib && npm publish --provenance --access public --tag ${tag ?? "latest"}`);
});
};

module.exports = { publishCanonicals };
4 changes: 4 additions & 0 deletions scripts/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,7 @@ execSync("cd lib && pnpm build && npm publish --provenance --access public");
execSync(
`gh release create ${VERSION} --generate-notes --latest -n "$(sed '1,/^## /d;/^## /,$d' CHANGELOG.md)" --title "Release v${VERSION}"`,
);

// Publish canonical packages
const { publishCanonicals } = require("./publish-canonical");
publishCanonicals();