Skip to content
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
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
# fail and not publish if any of the unit tests are failing
- name: Test
run: pnpm test
- name: Update topics and Publish to NPM
- name: Create release and Publish to NPM
run: pnpm publish-package
# continue on error to publish scoped package name <- by default repo is setup for a non-scoped + scoped package name
continue-on-error: true
Expand Down
40 changes: 15 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,19 @@ This is an `esbuild` plugin for compiling libraries compatible with React 18 ser

## Why?

✅ Unleash the full power of React18 Server components

✅ Build libraries for all build systems/tools/frameworks supporting React18

✅ Unleash the power of combining react client and server components in your libraries

✅ Full TypeScript support out of the box

✅ Simple and tiny

✅ Easy to use — just add the plugin, and you are good to go

✅ All in one plugin for building react18 libraries with `tsup` or `esbuild`

✅ add "use client" directive to indicate client component and the plugin will do the rest

✅ Automatically ignore test files during build

✅ Automatically remove `data-testid` attributes

✅ Add `ignorePatterns` and `replacePatterns` to achieve much more control over your build

✅ Fully Documented

✅ Ready to use [GitHub repository template](https://github.com/mayank1513/turborepo-template) to create your next react18 library
✅ Unleash the full power of React18 Server components\
✅ Build libraries for all build systems/tools/frameworks supporting React18\
✅ Unleash the power of combining react client and server components in your libraries\
✅ Full TypeScript support out of the box\
✅ Simple and tiny\
✅ Easy to use — just add the plugin, and you are good to go\
✅ All in one plugin for building react18 libraries with `tsup` or `esbuild`\
✅ add "use client" directive to indicate client component and the plugin will do the rest\
✅ Automatically ignore test files during build\
✅ Automatically remove `data-testid` attributes\
✅ Add `ignorePatterns` and `replacePatterns` to achieve much more control over your build\
✅ Fully Documented\
✅ Ready to use [GitHub repository template](https://github.com/mayank1513/turborepo-template.git) to create your next react18 library\

Introduction of React server components in React 18 has unlocked immense possibilities. However, library authors are not yet able to fully encash upon this potential. Many libraries, like `chakra-ui`, simply add “use client” for each component. However, much more can be unleashed when we can use both server and client components to build libraries. Also check-out this [blog](https://mayank1513.medium.com/unleash-the-power-of-react-server-components-eb3fe7201231).

Expand Down Expand Up @@ -129,6 +117,8 @@ type React18PluginOptions = {

Want handson course for getting started with Turborepo? Check out [React and Next.js with TypeScript](https://www.udemy.com/course/react-and-next-js-with-typescript/?referralCode=7202184A1E57C3DCA8B2) and [The Game of Chess with Next.js, React and TypeScrypt](https://www.udemy.com/course/game-of-chess-with-nextjs-react-and-typescrypt/?referralCode=851A28F10B254A8523FE)

![Alt](https://repobeats.axiom.co/api/embed/798673e15cf0802fe4e2470f946b64b551b5536d.svg "Repobeats analytics image")

## License

Licensed as MIT open source.
Expand Down
43 changes: 0 additions & 43 deletions packages/esbuild-plugin-react18-example/touchup.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,37 +4,7 @@
const fs = require("fs");
const path = require("path");
const packageJson = require(path.resolve(__dirname, "package.json"));
if (process.env.TOKEN) {
const { Octokit } = require("octokit");
// Octokit.js
// https://github.com/octokit/core.js#readme
const octokit = new Octokit({
auth: process.env.TOKEN,
});

const octoOptions = {
owner: process.env.OWNER,
repo: process.env.REPO,
headers: {
"X-GitHub-Api-Version": "2022-11-28",
},
};
const tag_name = `v${packageJson.version}`;
const name = `Release ${tag_name}`;
/** Create a release */
octokit.request("POST /repos/{owner}/{repo}/releases", {
...octoOptions,
tag_name,
target_commitish: "main",
name,
draft: false,
prerelease: false,
generate_release_notes: true,
headers: {
"X-GitHub-Api-Version": "2022-11-28",
},
});
}
delete packageJson.devDependencies;
delete packageJson.scripts;

Expand All @@ -50,16 +20,3 @@ fs.copyFileSync(
path.resolve(__dirname, "..", "..", "README.md"),
path.resolve(__dirname, "dist", "README.md"),
);

// const dirs = [path.resolve(__dirname, "dist")];

// while (dirs.length) {
// const dir = dirs.shift();
// fs.readdirSync(dir).forEach(f => {
// const f1 = path.resolve(dir, f);
// if (f.includes(".test.")) fs.unlink(f1, () => {});
// else if (fs.lstatSync(f1).isDirectory()) {
// dirs.push(f1);
// }
// });
// }
6 changes: 6 additions & 0 deletions packages/esbuild-plugin-react18/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# esbuild-plugin-react18

## 0.0.2

### Patch Changes

- Update scritps

## 0.0.1

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/esbuild-plugin-react18/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "esbuild-plugin-react18",
"author": "Mayank Kumar Chaudhari <https://mayank-chaudhari.vercel.app>",
"private": false,
"version": "0.0.1",
"version": "0.0.2",
"description": "Unleash the Power of React Server Components! ESBuild plugin to build RSC (React18 Server Components) compatible libraries.",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
4 changes: 3 additions & 1 deletion packages/esbuild-plugin-react18/touchup.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,7 @@ if (process.env.TOKEN) {
"X-GitHub-Api-Version": "2022-11-28",
},
});
} catch {}
} catch (e) {
console.log("octokit error", e);
}
}