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

Rewrite #30

Merged
merged 96 commits into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
96 commits
Select commit Hold shift + click to select a range
f1da84a
docs(changeset): Update peer dependencies to include React 19 and Nex…
mayank1513 Jun 14, 2024
c519f55
update peer dependencies
mayank1513 Jun 14, 2024
ab3671c
docs(changeset): Fix: Add `targetId` to ColorSwitch to properly handl…
mayank1513 Jun 15, 2024
7ef208d
fix: Add `targetId` to ColorSwitch to properly handle contenarized th…
mayank1513 Jun 15, 2024
8a20067
fix: deprecate targetSelector and use targetId
mayank1513 Jun 15, 2024
4f4255c
fix: use useStore in place recreating RGS
mayank1513 Jun 15, 2024
f787d4b
refactor: add type specifier for import statement
mayank1513 Jun 15, 2024
1222536
fix: fix tests
mayank1513 Jun 15, 2024
687e140
RELEASING: Releasing 6 package(s)
mayank1513 Jun 15, 2024
c46ac24
fix: fix selectors
mayank1513 Jun 15, 2024
da0c594
fix: Update downloads link for lite-version
mayank1513 Jun 16, 2024
865b412
remove cookie from theme-switcher
mayank1513 Jun 16, 2024
8bbf926
docs(changeset): Remove cookies
mayank1513 Jun 16, 2024
7feb476
Clean up server side wrapper
mayank1513 Jun 16, 2024
6a9c9e6
Do not export internal constants
mayank1513 Jun 16, 2024
e6e91a3
remove forcedTheme and forcedColorScheme from store as there is no wa…
mayank1513 Jun 16, 2024
d37fbcd
tmp
mayank1513 Jun 16, 2024
d61d31f
Cleanup: Clean up entire repo
mayank1513 Jun 16, 2024
bc43050
Create new scaffold from turborepo-template
mayank1513 Jun 16, 2024
8a1fe93
update pm
mayank1513 Jun 16, 2024
3971d44
Rebrand 💖 <a href=https://mayank-chaudhari.vercel.app target=_blank>M…
mayank1513 Jun 16, 2024
c7dd39a
Create server target
mayank1513 Jun 16, 2024
2dd5814
create color-switch
mayank1513 Jun 16, 2024
6f89d21
Update index to export client components
mayank1513 Jun 16, 2024
bceb30c
create force-color-scheme
mayank1513 Jun 16, 2024
6acbe1e
create force-theme
mayank1513 Jun 16, 2024
5882ea4
create theme-switcher
mayank1513 Jun 16, 2024
98e7188
Create hook
mayank1513 Jun 16, 2024
e62bb77
Update props to match the old versions APIs exposed to users -- color…
mayank1513 Jun 16, 2024
a2409ec
Update props to match the old versions APIs exposed to users -- force…
mayank1513 Jun 16, 2024
6c34815
Update props to match the old versions APIs exposed to users -- force…
mayank1513 Jun 16, 2024
da439c1
Update props to match the old versions APIs exposed to users -- theme…
mayank1513 Jun 16, 2024
26194ea
deprecate server-site-wrappers
mayank1513 Jun 16, 2024
3fbc9c7
Set up no FOUC script and theme-switcher
mayank1513 Jun 17, 2024
e49eec8
Remove force-theme and force-color-scheme components as it is not viable
mayank1513 Jun 17, 2024
ae673f6
Include hooks and types in global exports
mayank1513 Jun 17, 2024
0b85547
use theme hook
mayank1513 Jun 17, 2024
0286672
Implement color-switch
mayank1513 Jun 17, 2024
b4f13d0
remove unnecessary nesting
mayank1513 Jun 17, 2024
f3fd1d1
Add exports
mayank1513 Jun 17, 2024
db8d112
Fix build
mayank1513 Jun 17, 2024
1d5724a
fix: hook rendering
mayank1513 Jun 17, 2024
97c0271
update shared package
mayank1513 Jun 17, 2024
43d3c64
Update nextjs example
mayank1513 Jun 17, 2024
c87a1c7
Fix: m undefined error
mayank1513 Jun 17, 2024
17a3815
supressHydrationWarning for script
mayank1513 Jun 17, 2024
6c2439c
suppressHydrationWarning for theme-switch
mayank1513 Jun 17, 2024
b512e31
suppressHydrationWarning for nextjs html element
mayank1513 Jun 17, 2024
b2ef943
Fix colorSchemePref
mayank1513 Jun 17, 2024
33f0c08
Fix moile view
mayank1513 Jun 17, 2024
e3121f1
Add targetSelector to color-switch
mayank1513 Jun 17, 2024
09c4819
fix: Apply fixes to work with vite
mayank1513 Jun 17, 2024
5659e2c
chore: update vite production port
mayank1513 Jun 17, 2024
142f9fb
Add pages router example
mayank1513 Jun 17, 2024
65ed69e
Update dependencies to fix issues with pages router
mayank1513 Jun 17, 2024
45d6db5
Move pages to src and add styles
mayank1513 Jun 17, 2024
387587f
Add changeset
mayank1513 Jun 17, 2024
bdbf4d6
docs(changeset): Update peer-dependency next.js to 10-15
mayank1513 Jun 17, 2024
4b10902
docs(changeset): Remove next from peer dependency as we no longer dep…
mayank1513 Jun 17, 2024
55fc7a6
Update keywords
mayank1513 Jun 17, 2024
1c00b2a
Update Readme
mayank1513 Jun 17, 2024
b0921a4
update README
mayank1513 Jun 17, 2024
6878ed0
style: format code with Prettier
deepsource-autofix[bot] Jun 17, 2024
3d3cf46
create color-switch tests
mayank1513 Jun 17, 2024
a3d193e
Update example
mayank1513 Jun 17, 2024
4e56277
update example - add page navigator
mayank1513 Jun 17, 2024
e929839
fix: remove forced pages from app-router
mayank1513 Jun 17, 2024
827075b
update example - add page navigator
mayank1513 Jun 17, 2024
a2524a2
add dynamic routes
mayank1513 Jun 17, 2024
64571a1
dynamic theme with static props not working
mayank1513 Jun 18, 2024
6354d17
introduce forcedState for dynamic forced pages
mayank1513 Jun 18, 2024
9af4847
Add forced-color-scheme
mayank1513 Jun 18, 2024
02acb44
add forced-theme
mayank1513 Jun 18, 2024
8d47bd4
add forced components
mayank1513 Jun 18, 2024
d32880b
dynamic routes
mayank1513 Jun 18, 2024
c0f3e54
Provide Link component to logo for client side navigation
mayank1513 Jun 18, 2024
2f69578
refactor: keep cards list in the shared component
mayank1513 Jun 18, 2024
551a945
Add router to vite
mayank1513 Jun 18, 2024
718e565
Complete vite example
mayank1513 Jun 18, 2024
64e58c7
Add linkComponents for examples
mayank1513 Jun 18, 2024
f82bb59
Remove express example
mayank1513 Jun 18, 2024
c55bebc
Remove remix example. Remix example is broken and need to be recreated
mayank1513 Jun 18, 2024
a757976
updated nextjs app-router
mayank1513 Jun 18, 2024
cf91d9c
touch up pages router examples
mayank1513 Jun 18, 2024
1ab70ae
Add tests for the forced components
mayank1513 Jun 18, 2024
3bb7dad
Update unit tests
mayank1513 Jun 18, 2024
97a43bb
update lock file
mayank1513 Jun 18, 2024
10e37c8
publish alpha and fix examples build
mayank1513 Jun 18, 2024
025e864
rename to app-router
mayank1513 Jun 18, 2024
d08b98d
Refactor: make more interactive
mayank1513 Jun 18, 2024
e962c7d
RELEASING: Releasing 2 package(s)
mayank1513 Jun 18, 2024
189ce41
downgrade version to 3.1.3 as no breaking changes
mayank1513 Jun 18, 2024
f7deaec
update readme
mayank1513 Jun 18, 2024
ff2df36
Add setForced states to useTheme
mayank1513 Jun 18, 2024
0cd4139
Fix test coverage
mayank1513 Jun 18, 2024
6cffb28
remove unused variables
mayank1513 Jun 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
7 changes: 4 additions & 3 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/config@2.3.1/schema.json",
"$schema": "https://unpkg.com/@changesets/config@3.0.0/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": ["@changesets/cli/commit", { "skipCI": false }],
"fixed": [],
"linked": [],
"access": "restricted",
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
"ignore": ["@example/*"]
}
16 changes: 13 additions & 3 deletions .deepsource.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
version = 1

test_patterns = ["**/*.test.*"]

exclude_patterns = [
"docs/**",
"**/*.test.*"
]

[[analyzers]]
name = "javascript"

[analyzers.meta]
plugins = ["react"]
environment = [
"nodejs",
"browser",
"vitest"
]
"vitest",
"browser"
]

[[transformers]]
name = "prettier"
10 changes: 0 additions & 10 deletions .eslintrc.js

This file was deleted.

3 changes: 2 additions & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# These are supported funding model platforms

github: [mayank1513] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
github: [react18-tools, mayank1513] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
polar: mayank1513
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name: Bug report
about: Create a report to help us improve
title: ""
labels: bug
labels: ""
assignees: ""
---

Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name: Feature request
about: Suggest an idea for this project
title: ""
labels: enhancement
labels: ""
assignees: ""
---

Expand Down
22 changes: 11 additions & 11 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@ on:
push:
branches: [main]
schedule:
- cron: "0 0 */2 * *"
- cron: "0 */8 * * *"
jobs:
doc:
generate-docs:
if: github.event.repository.owner.login == 'react18-tools'
runs-on: ubuntu-latest
permissions:
packages: write
contents: write
steps:
- uses: actions/checkout@v4
Expand All @@ -21,25 +20,26 @@ jobs:
with:
registry-url: https://registry.npmjs.org
node-version: 20
- name: Setup Git
run: |
git config --global user.name "mayank1513"
git config --global user.email "mayank.srmu@gmail.com"
git fetch
git checkout main
git pull
- run: npm i -g pnpm && pnpm i
name: Install dependencies
- name: Test
run: npm test
- run: git status && git clean -f -d && git status
- run: git stash --include-untracked
name: clean up working directory
- run: npx @turbo/codemod update . && pnpm update --latest -w
- run: npx @turbo/codemod update . && pnpm update --latest -r
name: Update dependencies
- run: pnpm build
name: Build all apps to make sure it is not broken due to dependency upgrades
- name: Run unit tests
run: pnpm test
- name: Generate/update docs
run: pnpm doc
- name: Setup Git
run: |
git config --global user.name "mayank1513"
git config --global user.email "mayank.srmu@gmail.com"
git fetch
git checkout main
- name: Save upgraded packages back to repo
run: git add . && git commit -m "upgrade deps && docs" && git push origin main
44 changes: 44 additions & 0 deletions .github/workflows/manual-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Manually publish to NPM - Apply changeset in the workflow.

# publish only when package json has changed - assuming version upgrade
on:
workflow_dispatch:

jobs:
publish:
if: github.event.repository.owner.login == 'react18-tools'
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write

steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}

- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://registry.npmjs.org
- name: Setup Git
run: |
git config --global user.name "mayank1513"
git config --global user.email "mayank.srmu@gmail.com"
- run: npm i -g pnpm && pnpm i
name: Install dependencies
# fail and not publish if any of the unit tests are failing
- name: Test
run: pnpm test
- name: clean up working directory
run: git status && git clean -f -d && git status
- name: Copy Readme file
run: cp ./README.md ./lib # todo: uncomment this line while rebranding
- name: Apply changesets, publish and create release, branches and tags
run: node ./scripts/manual-publish.js
env:
BRANCH: ${{ github.ref_name }}
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
token: ${{ secrets.GITHUB_TOKEN }}
44 changes: 17 additions & 27 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,53 +4,43 @@ name: Publish to NPM
on:
push:
branches: [main]
paths: "lib/nextjs-themes/package.json"
workflow_dispatch:
paths: "lib/package.json"

jobs:
publish:
if: github.event.repository.owner.login == 'react18-tools'
# Don't run just after creating repo from template
# Also avoid running after merging set-up PR
if: github.run_number > 2 && github.event.repository.owner.login == 'react18-tools'
runs-on: ubuntu-latest
permissions:
packages: write
contents: write
id-token: write

defaults:
run:
working-directory: ./lib/nextjs-themes

steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}

- uses: actions/setup-node@v4
with:
registry-url: https://registry.npmjs.org
node-version: 20
registry-url: https://registry.npmjs.org
- name: Setup Git
run: |
git config --global user.name "mayank1513"
git config --global user.email "mayank.srmu@gmail.com"
- run: npm i -g pnpm && pnpm i
name: Install dependencies
# fail and not publish if any of the unit tests are failing
- name: Test
run: pnpm test
- name: Create release and Publish to NPM
run: pnpm build && pnpm publish-package && node scope.js && pnpm publish-package
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
TOKEN: ${{ secrets.GITHUB_TOKEN }}
OWNER: ${{ github.event.repository.owner.login }}
REPO: ${{ github.event.repository.name }}

# Publish lite version
- run: node lite.js && pnpm build && pnpm publish-package && node scope.js && pnpm publish-package
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
OWNER: ${{ github.event.repository.owner.login }}

- name: Mark scoped package as deprecated
run: |
npm deprecate @mayank1513/nextjs-themes "Please use https://www.npmjs.com/package/nextjs-themes instead. We initially created scoped packages to have similarities with the GitHub Public Repository (which requires packages to be scoped). We are no longer using GPR and thus deprecating all scoped packages for which corresponding un-scoped packages exist."
npm deprecate @mayank1513/nextjs-themes-lite "Please use https://www.npmjs.com/package/nextjs-themes-lite instead. We initially created scoped packages to have similarities with the GitHub Public Repository (which requires packages to be scoped). We are no longer using GPR and thus deprecating all scoped packages for which corresponding un-scoped packages exist."
- name: Copy Readme file
run: cp ./README.md ./lib # will be uncommented while rebranding
- name: Apply changesets, publish and create release, branches and tags
run: node ./scripts/publish.js
env:
BRANCH: ${{ github.ref_name }}
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
token: ${{ secrets.GITHUB_TOKEN }}
21 changes: 9 additions & 12 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,29 @@ on:
push:
pull_request:
schedule:
- cron: "0 */8 * * *"

- cron: "5 */8 * * *"
jobs:
test:
if: github.run_number != 1
runs-on: ubuntu-latest

defaults:
run:
working-directory: ./lib/nextjs-themes
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://registry.npmjs.org
- run: npm i -g pnpm && pnpm i
name: Install dependencies
- name: Test
run: npm test
- name: Run unit tests
run: pnpm test
- name: Upload coverage reports to Codecov
continue-on-error: true
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
directory: ./lib
token: ${{ secrets.CODECOV_TOKEN }}
- uses: paambaati/codeclimate-action@v5.0.0
continue-on-error: true
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
with:
coverageLocations: ./lib/nextjs-themes/coverage/*.xml:clover
coverageLocations: ./lib/coverage/*.xml:clover
50 changes: 12 additions & 38 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,42 +1,16 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
node_modules
.pnp
.pnp.js

# testing
coverage

# next.js
.next/
out/
build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env
.env.local
.env.development.local
.env.test.local
.env.production.local

# turbo
node_modules
.turbo

# vercel
.vercel

# build
*.log
.next
dist
dist-ssr
*.local
.env
.cache

# test coverage
coverage

# lock files
*lock*
# temporary files
tsup.config.bundled*
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
*lock.*

# ignore hbs files as prettier removes all spaces and makes it ugly
*hbs
docs
.vscode
2 changes: 1 addition & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"singleQuote": false,
"printWidth": 120,
"printWidth": 100,
"tabWidth": 2,
"arrowParens": "avoid",
"jsxBracketSameLine": true,
Expand Down
Loading
Loading