Skip to content
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

Upgrade #5

Merged
merged 6 commits into from
Oct 11, 2023
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 README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# React 18 Themes [![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)](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) [![Get help](codementor.svg)](https://www.codementor.io/@mayank1513?refer=badge)
# React 18 Themes [![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)](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) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react18-themes) [![Get help](codementor.svg)](https://www.codementor.io/@mayank1513?refer=badge)

🤟 👉 [Unleash the Power of React Server Components](https://medium.com/javascript-in-plain-english/unleash-the-power-of-react-server-components-eb3fe7201231)

Expand Down
7 changes: 7 additions & 0 deletions examples/nextjs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# nextjs-example

## 0.0.3

### Patch Changes

- Updated dependencies
- [email protected]

## 0.0.2

### Patch Changes
Expand Down
14 changes: 7 additions & 7 deletions examples/nextjs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nextjs-example",
"version": "0.0.2",
"version": "0.0.3",
"private": true,
"scripts": {
"dev": "next dev",
Expand All @@ -9,17 +9,17 @@
"lint": "next lint"
},
"dependencies": {
"@mayank1513/fork-me": "^1.0.0",
"next": "^13.4.19",
"@mayank1513/fork-me": "^1.1.2",
"next": "^13.5.4",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react18-themes": "workspace:*"
},
"devDependencies": {
"@next/eslint-plugin-next": "^13.4.19",
"@types/node": "^20.6.2",
"@types/react": "^18.2.21",
"@types/react-dom": "^18.2.7",
"@next/eslint-plugin-next": "^13.5.4",
"@types/node": "^20.8.4",
"@types/react": "^18.2.28",
"@types/react-dom": "^18.2.13",
"eslint-config-custom": "workspace:*",
"tsconfig": "workspace:*",
"typescript": "^5.2.2"
Expand Down
7 changes: 7 additions & 0 deletions examples/vite/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# vite-example

## 0.0.3

### Patch Changes

- Updated dependencies
- [email protected]

## 0.0.2

### Patch Changes
Expand Down
18 changes: 9 additions & 9 deletions examples/vite/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "vite-example",
"private": true,
"version": "0.0.2",
"version": "0.0.3",
"type": "module",
"scripts": {
"dev": "vite --port 3001",
Expand All @@ -10,21 +10,21 @@
"preview": "vite preview"
},
"dependencies": {
"@mayank1513/fork-me": "^1.0.0",
"@mayank1513/fork-me": "^1.1.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react18-themes": "workspace:*"
},
"devDependencies": {
"@types/react": "^18.2.21",
"@types/react-dom": "^18.2.7",
"@typescript-eslint/eslint-plugin": "^6.7.0",
"@typescript-eslint/parser": "^6.7.0",
"@vitejs/plugin-react-swc": "^3.3.2",
"eslint": "^8.49.0",
"@types/react": "^18.2.28",
"@types/react-dom": "^18.2.13",
"@typescript-eslint/eslint-plugin": "^6.7.5",
"@typescript-eslint/parser": "^6.7.5",
"@vitejs/plugin-react-swc": "^3.4.0",
"eslint": "^8.51.0",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.3",
"typescript": "^5.2.2",
"vite": "^4.4.9"
"vite": "^4.4.11"
}
}
1 change: 0 additions & 1 deletion examples/vite/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { useState } from "react";
import reactLogo from "./assets/react.svg";
import viteLogo from "/vite.svg";
import { ThemeSwitcher } from "react18-themes";
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
},
"devDependencies": {
"@changesets/cli": "^2.26.2",
"eslint": "^8.49.0",
"eslint": "^8.51.0",
"prettier": "^3.0.3",
"tsconfig": "workspace:*",
"turbo": "^1.10.14"
"turbo": "^1.10.15"
},
"packageManager": "[email protected]",
"name": "react18-themes"
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-config-custom/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
"private": true,
"devDependencies": {
"@vercel/style-guide": "^5.0.1",
"eslint-config-turbo": "^1.10.14"
"eslint-config-turbo": "^1.10.15"
}
}
6 changes: 6 additions & 0 deletions packages/react18-themes/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# react18-themes

## 1.0.9

### Patch Changes

- Add `data-color-scheme` attribute -> we will be simplifying the library use in near future

## 1.0.7

### Patch Changes
Expand Down
32 changes: 15 additions & 17 deletions packages/react18-themes/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "react18-themes",
"author": "Mayank Kumar Chaudhari <https://mayank-chaudhari.vercel.app>",
"private": false,
"version": "1.0.8",
"version": "1.0.9",
"description": "Unleash the Power of React Server Components! Use multiple themes on your site with confidence, without losing any advantages of React Server Components.",
"main": "./index.ts",
"types": "./index.ts",
Expand All @@ -24,32 +24,30 @@
},
"devDependencies": {
"@testing-library/react": "^14.0.0",
"@turbo/gen": "^1.10.14",
"@types/node": "^20.6.2",
"@types/react": "^18.2.21",
"@types/react-dom": "^18.2.7",
"@vitejs/plugin-react": "^4.0.4",
"@vitest/coverage-v8": "^0.34.4",
"esbuild-plugin-ignoretests": "^0.0.3",
"esbuild-plugin-removetestid": "^0.0.3",
"esbuild-react18-useclient": "^1.0.5",
"@turbo/gen": "^1.10.15",
"@types/node": "^20.8.4",
"@types/react": "^18.2.28",
"@types/react-dom": "^18.2.13",
"@vitejs/plugin-react": "^4.1.0",
"@vitest/coverage-v8": "^0.34.6",
"esbuild-plugin-react18": "^0.0.5",
"eslint-config-custom": "workspace:*",
"jsdom": "^22.1.0",
"next": "^13.4.19",
"octokit": "^3.1.0",
"next": "^13.5.4",
"octokit": "^3.1.1",
"persist-and-sync": "^0.1.1",
"react": "^18.2.0",
"tsconfig": "workspace:*",
"tsup": "^7.2.0",
"typescript": "5.2.2",
"vite-tsconfig-paths": "^4.2.1",
"vitest": "^0.34.4",
"zustand": "^4.4.1"
"vitest": "^0.34.6",
"zustand": "^4.4.3"
},
"peerDependencies": {
"@types/react": "^16.8 || ^17 || ^18",
"next": "^8",
"react": "^16.8 || ^17 || ^18"
"@types/react": "16.8 - 18",
"next": "10 - 13",
"react": "16.8 - 18"
},
"peerDependenciesMeta": {
"next": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export function ThemeSwitcher(props: {
}
newTheme = newTheme === undefined ? theme : newTheme;
document.documentElement.setAttribute("data-theme", newTheme);
document.documentElement.setAttribute("data-color-scheme", colorScheme);
/** do not create cookie for forced page as they will interfere with normal prefs */
if (!forcedColorScheme && forcedTheme === undefined)
document.cookie = `data-theme=${newTheme}`;
Expand Down
6 changes: 2 additions & 4 deletions packages/react18-themes/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { defineConfig } from "tsup";
import reactUseClientPlugin from "esbuild-react18-useclient";
import ignoretestsPlugin from "esbuild-plugin-ignoretests";
import removeTestidPluging from "esbuild-plugin-removetestid";
import react18Plugin from "esbuild-plugin-react18";

// eslint-disable-next-line import/no-default-export -- export default is required for config files
export default defineConfig(options => ({
Expand All @@ -10,6 +8,6 @@ export default defineConfig(options => ({
sourcemap: false,
clean: true,
minify: !options.watch,
esbuildPlugins: [reactUseClientPlugin, ignoretestsPlugin(), removeTestidPluging()],
esbuildPlugins: [react18Plugin()],
legacyOutput: true,
}));
2 changes: 1 addition & 1 deletion turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"pipeline": {
"build": {
"dependsOn": ["^build"],
"outputs": [".next/**", "!.next/cache/**"]
"outputs": [".next/**", "!.next/cache/**", "dist/**", "build/**", "public/build/**"]
},
"lint": {},
"test": {},
Expand Down