From b39a93c7141ada031eb444f93d5cbab23e8f95bd Mon Sep 17 00:00:00 2001 From: "Mayank Chaudharihttps://mayank-chaudhari.vercel.app" Date: Fri, 1 Sep 2023 04:22:31 +0000 Subject: [PATCH] =?UTF-8?q?Set=20up=20this=20repo\n\nwith=20=F0=9F=92=96?= =?UTF-8?q?=20by=20Mayank=20Kumar=20Chaudhari?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/setup.yml | 40 ------------------ README.md | 20 ++++++--- examples/nextjs/app/layout.tsx | 2 +- examples/nextjs/package.json | 5 ++- examples/vite/package.json | 3 +- .../{fork-me => react18-themes}/.eslintrc.js | 0 .../{fork-me => react18-themes}/.gitignore | 0 .../{fork-me => react18-themes}/README.md | 0 packages/{fork-me => react18-themes}/index.ts | 0 .../{fork-me => react18-themes}/package.json | 4 +- .../{fork-me => react18-themes}/server.ts | 0 .../src/client/index.tsx | 0 .../src/client/star-me/index.tsx | 0 .../src/client/star-me/star-me.test.tsx | 0 .../src/client/star-me/star-me.tsx | 0 .../{fork-me => react18-themes}/src/index.tsx | 0 .../src/server/fork-me/fork-me.test.tsx | 0 .../src/server/fork-me/fork-me.tsx | 0 .../src/server/fork-me/index.tsx | 0 .../src/server/index.tsx | 0 .../{fork-me => react18-themes}/touchup.js | 2 +- .../{fork-me => react18-themes}/tsconfig.json | 0 .../tsup.config.ts | 0 .../turbo/generators/config.ts | 0 .../turbo/generators/templates/component.hbs | 0 .../generators/templates/component.test.hbs | 0 .../vitest.config.ts | 0 setup.sh | 42 ------------------- 28 files changed, 23 insertions(+), 95 deletions(-) delete mode 100644 .github/workflows/setup.yml rename packages/{fork-me => react18-themes}/.eslintrc.js (100%) rename packages/{fork-me => react18-themes}/.gitignore (100%) rename packages/{fork-me => react18-themes}/README.md (100%) rename packages/{fork-me => react18-themes}/index.ts (100%) rename packages/{fork-me => react18-themes}/package.json (97%) rename packages/{fork-me => react18-themes}/server.ts (100%) rename packages/{fork-me => react18-themes}/src/client/index.tsx (100%) rename packages/{fork-me => react18-themes}/src/client/star-me/index.tsx (100%) rename packages/{fork-me => react18-themes}/src/client/star-me/star-me.test.tsx (100%) rename packages/{fork-me => react18-themes}/src/client/star-me/star-me.tsx (100%) rename packages/{fork-me => react18-themes}/src/index.tsx (100%) rename packages/{fork-me => react18-themes}/src/server/fork-me/fork-me.test.tsx (100%) rename packages/{fork-me => react18-themes}/src/server/fork-me/fork-me.tsx (100%) rename packages/{fork-me => react18-themes}/src/server/fork-me/index.tsx (100%) rename packages/{fork-me => react18-themes}/src/server/index.tsx (100%) rename packages/{fork-me => react18-themes}/touchup.js (90%) rename packages/{fork-me => react18-themes}/tsconfig.json (100%) rename packages/{fork-me => react18-themes}/tsup.config.ts (100%) rename packages/{fork-me => react18-themes}/turbo/generators/config.ts (100%) rename packages/{fork-me => react18-themes}/turbo/generators/templates/component.hbs (100%) rename packages/{fork-me => react18-themes}/turbo/generators/templates/component.test.hbs (100%) rename packages/{fork-me => react18-themes}/vitest.config.ts (100%) delete mode 100644 setup.sh diff --git a/.github/workflows/setup.yml b/.github/workflows/setup.yml deleted file mode 100644 index 79538e22..00000000 --- a/.github/workflows/setup.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: setup repo - -on: - create: - -jobs: - setup: - if: github.ref == 'refs/heads/main' - runs-on: ubuntu-latest - permissions: - contents: write - pull-requests: write - steps: - - uses: actions/checkout@v3 - with: - token: ${{ secrets.GITHUB_TOKEN }} - - uses: actions/setup-node@v3 - with: - node-version: 18 - - name: Setup Git and create PR - run: | - git config --global user.name "Mayank Chaudhari" - git config --global user.email "mayank-automate@noreply.github.com" - git fetch - git checkout main - git checkout -b setup-repo - - name: Set up repo - run: chmod +x ./setup.sh && ./setup.sh ${{ github.event.repository.owner.login }} ${{ github.event.repository.name }} - - name: Push changes back to repo - run: | - git add . - git commit -m 'Set up this repo\n\nwith 💖 by Mayank Kumar Chaudhari' - git push origin setup-repo - - name: create pull request - run: gh pr create -B main -H setup-repo --title 'Merge to Set up this Repo ' --body 'Created by Github action\n\nwith 💖 by Mayank Kumar Chaudhari' - # this step fails because newly created repo does not have permission to create PR from workflow - continue-on-error: true - env: - GH_TOKEN: ${{ github.token }} - \ No newline at end of file diff --git a/README.md b/README.md index b301a26f..cf16ff18 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,23 @@ -# Turborepo template [![test](https://github.com/mayank1513/turborepo-template/actions/workflows/test.yml/badge.svg)](https://github.com/mayank1513/turborepo-template/actions/workflows/test.yml) [![codecov](https://codecov.io/gh/mayank1513/turborepo-template/graph/badge.svg?token=8LX1NLNVRV)](https://codecov.io/gh/mayank1513/turborepo-template) [![Version](https://img.shields.io/npm/v/@mayank1513/fork-me.svg?colorB=green)](https://www.npmjs.com/package/@mayank1513/fork-me) [![Downloads](https://img.jsdelivr.com/img.shields.io/npm/dt/@mayank1513/fork-me.svg)](https://www.npmjs.com/package/@mayank1513/fork-me) [![Unit Tests](https://github.com/mayank1513/turborepo-template/actions/workflows/test.yml/badge.svg)](https://github.com/mayank1513/turborepo-template/actions/workflows/test.yml) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/@mayank1513/fork-me) +# Turborepo template [![test](https://github.com/mayank1513/react18-themes/actions/workflows/test.yml/badge.svg)](https://github.com/mayank1513/react18-themes/actions/workflows/test.yml) [![codecov](https://codecov.io/gh/mayank1513/react18-themes/graph/badge.svg?token=8LX1NLNVRV)](https://codecov.io/gh/mayank1513/react18-themes) [![Version](https://img.shields.io/npm/v/react18-themes.svg?colorB=green)](https://www.npmjs.com/package/react18-themes) [![Downloads](https://img.jsdelivr.com/img.shields.io/npm/dt/react18-themes.svg)](https://www.npmjs.com/package/react18-themes) [![Unit Tests](https://github.com/mayank1513/react18-themes/actions/workflows/test.yml/badge.svg)](https://github.com/mayank1513/react18-themes/actions/workflows/test.yml) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react18-themes) -- ✅ Fully Treeshakable (`import from @mayank1513/fork-me/client/component`) +- ✅ Fully Treeshakable (`import from react18-themes/client/component`) - ✅ Full TypeScript Support - ✅ Unleash the full power of React18 Server components - ✅ Works with all build systems/tools/frameworks for React18 -This is a template created based on official starter Turborepo. +## Install + +```bash +$ pnpm add @react18-themes +# or +$ npm install @react18-themes +# or +$ yarn add @react18-themes +``` > A quick tip: Delete all stale branches `git branch --merged main | grep -v '^[ *]*main$' | xargs git branch -d` -Simply click on `Use this template` button to use and customize this template for your next JavaSctipt / TypeScript / React / Vue / Next.js library or project. + ## What's different from scaffolding turbo-repo by `create-turbo` @@ -42,8 +50,8 @@ Following features make it really cool and useful - [ ] Add `NPM_AUTH_TOKEN` to repository secrets to automate publishing package - [ ] login to your `npm` account and create automation token - [ ] Create a new repository secrets `NPM_AUTH_TOKEN` -- [ ] Update description in `packages/@mayank1513/fork-me/package.json` -- [ ] Imp - update publish workflow - replace `fork-me` with `@mayank1513/fork-me` +- [ ] Update description in `packages/react18-themes/package.json` +- [ ] Imp - update publish workflow - replace `fork-me` with `react18-themes` - [ ] Create your library and update examples - [ ] Update README - [ ] Push your changes/Create PR and see your library being automatically tested and published diff --git a/examples/nextjs/app/layout.tsx b/examples/nextjs/app/layout.tsx index c08b8e44..803bb17b 100644 --- a/examples/nextjs/app/layout.tsx +++ b/examples/nextjs/app/layout.tsx @@ -16,7 +16,7 @@ export default function RootLayout({ children }: { children: React.ReactNode }) ", "private": false, - "version": "1.0.0", + "version": "0.0.0", "description": "An intuitive React.js fork me ribbon component for promoting open source project forks.", "main": "./index.tsx", "types": "./index.tsx", diff --git a/packages/fork-me/server.ts b/packages/react18-themes/server.ts similarity index 100% rename from packages/fork-me/server.ts rename to packages/react18-themes/server.ts diff --git a/packages/fork-me/src/client/index.tsx b/packages/react18-themes/src/client/index.tsx similarity index 100% rename from packages/fork-me/src/client/index.tsx rename to packages/react18-themes/src/client/index.tsx diff --git a/packages/fork-me/src/client/star-me/index.tsx b/packages/react18-themes/src/client/star-me/index.tsx similarity index 100% rename from packages/fork-me/src/client/star-me/index.tsx rename to packages/react18-themes/src/client/star-me/index.tsx diff --git a/packages/fork-me/src/client/star-me/star-me.test.tsx b/packages/react18-themes/src/client/star-me/star-me.test.tsx similarity index 100% rename from packages/fork-me/src/client/star-me/star-me.test.tsx rename to packages/react18-themes/src/client/star-me/star-me.test.tsx diff --git a/packages/fork-me/src/client/star-me/star-me.tsx b/packages/react18-themes/src/client/star-me/star-me.tsx similarity index 100% rename from packages/fork-me/src/client/star-me/star-me.tsx rename to packages/react18-themes/src/client/star-me/star-me.tsx diff --git a/packages/fork-me/src/index.tsx b/packages/react18-themes/src/index.tsx similarity index 100% rename from packages/fork-me/src/index.tsx rename to packages/react18-themes/src/index.tsx diff --git a/packages/fork-me/src/server/fork-me/fork-me.test.tsx b/packages/react18-themes/src/server/fork-me/fork-me.test.tsx similarity index 100% rename from packages/fork-me/src/server/fork-me/fork-me.test.tsx rename to packages/react18-themes/src/server/fork-me/fork-me.test.tsx diff --git a/packages/fork-me/src/server/fork-me/fork-me.tsx b/packages/react18-themes/src/server/fork-me/fork-me.tsx similarity index 100% rename from packages/fork-me/src/server/fork-me/fork-me.tsx rename to packages/react18-themes/src/server/fork-me/fork-me.tsx diff --git a/packages/fork-me/src/server/fork-me/index.tsx b/packages/react18-themes/src/server/fork-me/index.tsx similarity index 100% rename from packages/fork-me/src/server/fork-me/index.tsx rename to packages/react18-themes/src/server/fork-me/index.tsx diff --git a/packages/fork-me/src/server/index.tsx b/packages/react18-themes/src/server/index.tsx similarity index 100% rename from packages/fork-me/src/server/index.tsx rename to packages/react18-themes/src/server/index.tsx diff --git a/packages/fork-me/touchup.js b/packages/react18-themes/touchup.js similarity index 90% rename from packages/fork-me/touchup.js rename to packages/react18-themes/touchup.js index e619c2b3..6065443c 100644 --- a/packages/fork-me/touchup.js +++ b/packages/react18-themes/touchup.js @@ -38,4 +38,4 @@ fs.writeFileSync( JSON.stringify(packageJson, null, 2), ); -fs.copyFileSync(path.resolve(__dirname, "README.md"), path.resolve(__dirname, "dist", "README.md")); +fs.copyFileSync(path.resolve(__dirname, "..", "..", "README.md"), path.resolve(__dirname, "dist", "README.md")); diff --git a/packages/fork-me/tsconfig.json b/packages/react18-themes/tsconfig.json similarity index 100% rename from packages/fork-me/tsconfig.json rename to packages/react18-themes/tsconfig.json diff --git a/packages/fork-me/tsup.config.ts b/packages/react18-themes/tsup.config.ts similarity index 100% rename from packages/fork-me/tsup.config.ts rename to packages/react18-themes/tsup.config.ts diff --git a/packages/fork-me/turbo/generators/config.ts b/packages/react18-themes/turbo/generators/config.ts similarity index 100% rename from packages/fork-me/turbo/generators/config.ts rename to packages/react18-themes/turbo/generators/config.ts diff --git a/packages/fork-me/turbo/generators/templates/component.hbs b/packages/react18-themes/turbo/generators/templates/component.hbs similarity index 100% rename from packages/fork-me/turbo/generators/templates/component.hbs rename to packages/react18-themes/turbo/generators/templates/component.hbs diff --git a/packages/fork-me/turbo/generators/templates/component.test.hbs b/packages/react18-themes/turbo/generators/templates/component.test.hbs similarity index 100% rename from packages/fork-me/turbo/generators/templates/component.test.hbs rename to packages/react18-themes/turbo/generators/templates/component.test.hbs diff --git a/packages/fork-me/vitest.config.ts b/packages/react18-themes/vitest.config.ts similarity index 100% rename from packages/fork-me/vitest.config.ts rename to packages/react18-themes/vitest.config.ts diff --git a/setup.sh b/setup.sh deleted file mode 100644 index ab140e85..00000000 --- a/setup.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/sh - -# Update README -sed -i -e "s/mayank1513\/turborepo-template/$1\/$2/g" README.md -sed -i -e "s/@mayank1513\/fork-me/$2/g" README.md -sed -i -e "s/This is a template created based on official starter Turborepo./## Install\n\n\`\`\`bash\n$ pnpm add @$2\n# or\n$ npm install @$2\n# or\n$ yarn add @$2\n\`\`\`/" README.md -sed -i -e "s/Simply click on \`Use this template\` .*//" README.md -sed -i -e "s/.*Clone this repo.*//" - -# Update forkme link in examples -sed -i -e "s/turbo-template/$2/g" examples/nextjs/app/layout.tsx -sed -i -e "s/turbo-template/$2/g" examples/nextjs/app/page.tsx -sed -i -e "s/turbo-template/$2/g" examples/vite/src/App.tsx - -# Update package.json for all workspaces -sed -i -e "s/turborepo-template/$2/" -cd packages/fork-me -sed -i -e "s/.*version.*/\t\"version\": \"0.0.0\",/" package.json -sed -i -e "s/.*name.*/\t\"name\": \"$2\",/" package.json -sed -i -e "s/mayank1513\/turborepo-template/$1\/$2/" -sed -i -e "s/\/tree\/main\/packages\/fork-me//" -# Update touchup.js to copy readme from root of the repo -sed -i -e "s/__dirname, \"README.md\"/__dirname, \"..\", \"..\", \"README.md\"/" touchup.js - -cd ../../examples/nextjs -sed -i -e "s/.*version.*/\t\"version\": \"0.0.0\",/" package.json -sed -i -e "s/\"@mayank1513\/fork-me\"/\"@mayank1513\/fork-me\": \"latest\",\n\t\t\"$2\"/" package.json - -cd ../vite -sed -i -e "s/.*version.*/\t\"version\": \"0.0.0\",/" package.json -sed -i -e "s/\"@mayank1513\/fork-me\"/\"@mayank1513\/fork-me\": \"latest\",\n\t\t\"$2\"/" package.json - -# rename fork-me to repo-name -cd ../.. -mv packages/fork-me packages/$2 - -# change working directory in publish workflow -- GitHub doesn't allow this -# sed -i -e "s/fork-me/$2/g" .github/workflows/publish.yml - -# delete this file and the setup.yml workflow - no longer needed -rm .github/workflows/setup.yml -rm setup.sh