From f3f5cd0c6c4222712ecd819b0ab94baae7215b10 Mon Sep 17 00:00:00 2001 From: Mayank Kumar Chaudhari Date: Mon, 25 Sep 2023 17:24:43 +0530 Subject: [PATCH 1/3] fix: add scope.js update readme --- .github/workflows/publish.yml | 2 +- README.md | 40 +++++++---------- .../esbuild-plugin-react18-example/touchup.js | 43 ------------------- .../scope.js | 0 packages/esbuild-plugin-react18/touchup.js | 4 +- 5 files changed, 19 insertions(+), 70 deletions(-) rename packages/{esbuild-plugin-react18-example => esbuild-plugin-react18}/scope.js (100%) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index b836ffab..5b0d9c2a 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -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 diff --git a/README.md b/README.md index fd6f630c..6505ecc3 100644 --- a/README.md +++ b/README.md @@ -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/turborepo-react18-template/turborepo-react18-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). @@ -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. diff --git a/packages/esbuild-plugin-react18-example/touchup.js b/packages/esbuild-plugin-react18-example/touchup.js index 3ab95c7d..8a9063ab 100644 --- a/packages/esbuild-plugin-react18-example/touchup.js +++ b/packages/esbuild-plugin-react18-example/touchup.js @@ -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; @@ -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); -// } -// }); -// } diff --git a/packages/esbuild-plugin-react18-example/scope.js b/packages/esbuild-plugin-react18/scope.js similarity index 100% rename from packages/esbuild-plugin-react18-example/scope.js rename to packages/esbuild-plugin-react18/scope.js diff --git a/packages/esbuild-plugin-react18/touchup.js b/packages/esbuild-plugin-react18/touchup.js index 9c7e32b6..25a9c3e2 100644 --- a/packages/esbuild-plugin-react18/touchup.js +++ b/packages/esbuild-plugin-react18/touchup.js @@ -51,5 +51,7 @@ if (process.env.TOKEN) { "X-GitHub-Api-Version": "2022-11-28", }, }); - } catch {} + } catch (e) { + console.log("octokit error", e); + } } From c18390bf27b69d7f6847b92aea77b064373cd42f Mon Sep 17 00:00:00 2001 From: Mayank Kumar Chaudhari Date: Mon, 25 Sep 2023 17:38:59 +0530 Subject: [PATCH 2/3] changeset --- packages/esbuild-plugin-react18/CHANGELOG.md | 6 ++++++ packages/esbuild-plugin-react18/package.json | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/esbuild-plugin-react18/CHANGELOG.md b/packages/esbuild-plugin-react18/CHANGELOG.md index eeec39e5..ac75acde 100644 --- a/packages/esbuild-plugin-react18/CHANGELOG.md +++ b/packages/esbuild-plugin-react18/CHANGELOG.md @@ -1,5 +1,11 @@ # esbuild-plugin-react18 +## 0.0.2 + +### Patch Changes + +- Update scritps + ## 0.0.1 ### Patch Changes diff --git a/packages/esbuild-plugin-react18/package.json b/packages/esbuild-plugin-react18/package.json index d66b8428..f6663a75 100644 --- a/packages/esbuild-plugin-react18/package.json +++ b/packages/esbuild-plugin-react18/package.json @@ -2,7 +2,7 @@ "name": "esbuild-plugin-react18", "author": "Mayank Kumar Chaudhari ", "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", From 54798e5a159cd74cac72feb4a0b43dd121e05cab Mon Sep 17 00:00:00 2001 From: Mayank Kumar Chaudhari Date: Mon, 25 Sep 2023 17:41:18 +0530 Subject: [PATCH 3/3] fix: template lint --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6505ecc3..520acd62 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ This is an `esbuild` plugin for compiling libraries compatible with React 18 ser ✅ 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/turborepo-react18-template/turborepo-react18-template.git) to create your next react18 library\ +✅ 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).