Skip to content

Commit

Permalink
Merge pull request #27 from react18-tools/rewrite
Browse files Browse the repository at this point in the history
Rewrite
  • Loading branch information
mayank1513 committed Jun 17, 2024
2 parents 0039c34 + 2d40e92 commit fd4dc02
Show file tree
Hide file tree
Showing 259 changed files with 17,796 additions and 4,471 deletions.
8 changes: 4 additions & 4 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -1,11 +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": false,
"commit": ["@changesets/cli/commit", { "skipCI": false }],
"fixed": [],
"linked": [],
"access": "restricted",
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
"ignore": ["@example/*"]
}
8 changes: 4 additions & 4 deletions .deepsource.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
version = 1

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

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

exclude_patterns = ["docs/**"]

[[analyzers]]
name = "javascript"

Expand Down
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 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
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ jobs:
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 "[email protected]"
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 "react18-tools"
git config --global user.email "[email protected]"
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 "[email protected]"
- 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 }}
56 changes: 13 additions & 43 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,20 @@ name: Publish to NPM

# publish only when package json has changed - assuming version upgrade
on:
workflow_dispatch:
push:
branches: [main]
paths: "lib/r18gs/package.json"
paths: "lib/package.json"

jobs:
publish:
# Don't run just after creating repo from template
# Also avoid running after merging set-up PR
if: github.event.repository.owner.login == 'react18-tools'
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/r18gs

steps:
- uses: actions/checkout@v4
with:
Expand All @@ -31,46 +25,22 @@ jobs:
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 "[email protected]"
- 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: publish to NPM
run: pnpm build && pnpm publish-package
continue-on-error: true
- 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 }}
TOKEN: ${{ secrets.GITHUB_TOKEN }}
OWNER: ${{ github.event.repository.owner.login }}
REPO: ${{ github.event.repository.name }}

- name: Create GitHub release
run: |
v=$(node -p -e "require('./package.json').version")
gh release create $v --generate-notes --latest -n "$(sed '1,/^## /d;/^## /,$d' CHANGELOG.md)" --title "Release $v"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Publish canonical packages
continue-on-error: true
run: |
sed -i -e "s/.*name.*/\t\"name\": \"@mayank1513\/r18gs\",/" package.json
npm publish --provenance --access public
sed -i -e "s/.*name.*/\t\"name\": \"react18-global-store\",/" package.json
npm publish --provenance --access public
sed -i -e "s/.*name.*/\t\"name\": \"react18-store\",/" package.json
npm publish --provenance --access public
sed -i -e "s/.*name.*/\t\"name\": \"react19-global-store\",/" package.json
npm publish --provenance --access public
sed -i -e "s/.*name.*/\t\"name\": \"react19-store\",/" package.json
npm publish --provenance --access public
sed -i -e "s/.*name.*/\t\"name\": \"r19gs\",/" package.json
npm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}

- name: Mark scoped package as deprecated
run: npm deprecate @mayank1513/r18gs "Please use https://www.npmjs.com/package/r18gs 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."
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
token: ${{ secrets.GITHUB_TOKEN }}
8 changes: 3 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ on:
- cron: "5 */8 * * *"
jobs:
test:
if: github.run_number != 1
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
Expand All @@ -23,12 +22,11 @@ jobs:
continue-on-error: true
uses: codecov/codecov-action@v4
with:
directory: ./lib/r18gs
directory: ./lib
token: ${{ secrets.CODECOV_TOKEN }}
flags: r18gs
- uses: paambaati/[email protected]
continue-on-error: true
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
with:
coverageLocations: ./lib/r18gs/coverage/*.xml:clover
coverageLocations: ./lib/coverage/*.xml:clover
47 changes: 12 additions & 35 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,39 +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
*.log
.next
dist
dist-ssr
*.local
.env
.cache

# vercel
.vercel
# test coverage
coverage

# lock files
*lock*
# temporary files
tsup.config.bundled*
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
# ignore hbs files as prettier removes all spaces and makes it ugly
*hbs
docs
.vscode
3 changes: 1 addition & 2 deletions .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@
"tabWidth": 2,
"arrowParens": "avoid",
"jsxBracketSameLine": true,
"bracketSameLine": true,
"useTabs": true
"bracketSameLine": true
}
12 changes: 2 additions & 10 deletions .tkb
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
{
"scope": "Workspace",
"tasks": {
"task-oQKhoVOKYhYaRYGvlDMj5": {
"id": "task-oQKhoVOKYhYaRYGvlDMj5",
"description": "Add support for persist and sync",
"columnId": "column-todo"
}
},
"tasks": {},
"columns": [
{
"id": "column-todo",
"title": "To do",
"tasksIds": [
"task-oQKhoVOKYhYaRYGvlDMj5"
]
"tasksIds": []
},
{
"id": "column-doing",
Expand Down
15 changes: 0 additions & 15 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,13 @@
{
// Formatting using Prettier by default for all languages
"editor.defaultFormatter": "esbenp.prettier-vscode",
// Formatting using Prettier for JavaScript, overrides VSCode default.
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},

// Ensure enough terminal history is preserved when running tests.
"terminal.integrated.scrollback": 10000,

// Configure todo-tree to exclude node_modules, dist, and compiled.
"todo-tree.filtering.excludeGlobs": ["**/node_modules", "**/dist", "**/compiled"],
// Match TODO-APP in addition to other TODOs.
"todo-tree.general.tags": ["BUG", "HACK", "FIXME", "TODO", "XXX", "[ ]", "[x]", "TODO-APP"],

// Disable TypeScript surveys.
"typescript.surveys.enabled": false,

"grammarly.selectors": [
{
"language": "markdown",
"scheme": "file"
}
],
"editor.tabSize": 2,
"editor.wordWrap": "on",
"editor.formatOnSave": true,
Expand Down
11 changes: 11 additions & 0 deletions FEATURED.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Featured packages built with this template.

> This file is automatically generated. Please refrain from editing it directly. To add your package, update `scripts/featured.json` in alphabetical order.
- [esbuild-plugin-react18](https://github.com/react18-tools/esbuild-plugin-react18) - An esbuild plugin for compiling libraries compatible with React 18 server and client component, Nextjs13, and Nextjs14
- [esbuild-plugin-react18-css](https://github.com/react18-tools/esbuild-plugin-react18-css) - ESBuild plugin to handle CSS/SCSS modules, autoprefixer, etc.
- [Nextjs-Themes](https://github.com/react18-tools/nextjs-themes) - 🤟 👉 Theme with confidence and Unleash the Power of React Server Components
- [Persist-And-Sync](https://github.com/react18-tools/persist-and-sync) - Zustand middleware to easily persist and sync Zustand state between tabs / windows / iframes (Same Origin)
- [React 18 Themes](https://github.com/react18-tools/react18-themes) - 🤟 👉 Unleash the Power of React Server Components
- [React18 Global Store](https://github.com/react18-tools/react18-global-store) - A simple yet elegant, light weight, react18 global store to replace Zustand for better tree shaking.
- [Zustand Sync Tabs](https://github.com/react18-tools/zustand-sync-tabs) - Zustand middleware to easily sync Zustand state between tabs / windows / iframes (Same Origin)
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# React18GlobalStore
# React18GlobalStore <img src="https://github.com/react18-tools/turborepo-template/blob/main/popper.png?raw=true" style="height: 40px"/>

[![test](https://github.com/react18-tools/react18-global-store/actions/workflows/test.yml/badge.svg)](https://github.com/react18-tools/react18-global-store/actions/workflows/test.yml) [![Maintainability](https://api.codeclimate.com/v1/badges/ec3140063acd8df82481/maintainability)](https://codeclimate.com/github/react18-tools/react18-global-store/maintainability) [![codecov](https://codecov.io/gh/react18-tools/react18-global-store/graph/badge.svg)](https://codecov.io/gh/react18-tools/react18-global-store) [![Version](https://img.shields.io/npm/v/r18gs.svg?colorB=green)](https://www.npmjs.com/package/r18gs) [![Downloads](https://img.jsdelivr.com/img.shields.io/npm/d18m/r18gs.svg)](https://www.npmjs.com/package/r18gs) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/r18gs) [![Gitpod ready-to-code](https://img.shields.io/badge/Gitpod-ready--to--code-blue?logo=gitpod)](https://gitpod.io/from-referrer/)

Expand Down Expand Up @@ -68,7 +68,9 @@ Interested in hands-on courses for getting started with Turborepo? Check out [Re

## License

Licensed under the MPL 2.0 open source license.
This library is licensed under the MPL-2.0 open-source license.

> <img src="https://github.com/react18-tools/react18-global-store/blob/main/popper.png?raw=true" style="height: 20px"/> Please consider enrolling in [our courses](https://mayank-chaudhari.vercel.app/courses) or [sponsoring](https://github.com/sponsors/mayank1513) our work.
<hr />

Expand Down
Loading

0 comments on commit fd4dc02

Please sign in to comment.