Skip to content

Commit 203af6e

Browse files
authored
Merge pull request #5 from react18-tools/lite
Add even lighter version
2 parents f117f85 + 6da0129 commit 203af6e

File tree

12 files changed

+92
-13
lines changed

12 files changed

+92
-13
lines changed

.github/workflows/publish.yml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
- name: Test
3535
run: pnpm test
3636
- name: Create release and publish to NPM
37-
run: pnpm build && pnpm publish-package
37+
run: pnpm build && pnpm publish-package && node scope.js && pnpm publish-package
3838
# continue on error to publish scoped package name <- by default repo is setup for a non-scoped + scoped package name
3939
continue-on-error: true
4040
env:
@@ -43,16 +43,10 @@ jobs:
4343
OWNER: ${{ github.event.repository.owner.login }}
4444
REPO: ${{ github.event.repository.name }}
4545

46-
- name: Publish Scoped package to NPM
47-
# continue on error - expecing npm to trow error if scoping is done twice
48-
continue-on-error: true
49-
id: publish_scoped
50-
run: cd dist && node ../scope.js && npm publish --provenance --access public
46+
# Publish lite version
47+
- run: node lite.js && pnpm build && pnpm publish-package && node scope.js && pnpm publish-package
5148
env:
5249
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
53-
TOKEN: ${{ secrets.GITHUB_TOKEN }}
54-
OWNER: ${{ github.event.repository.owner.login }}
55-
REPO: ${{ github.event.repository.name }}
5650

5751
- name: Publish package with long name for better SEO
5852
continue-on-error: true

README.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,26 @@ or
7272
$ yarn add nthul
7373
```
7474

75+
## Want Lite Version? [![npm bundle size](https://img.shields.io/bundlephobia/minzip/nthul-lite)](https://www.npmjs.com/package/nthul-lite) [![Version](https://img.shields.io/npm/v/nthul-lite.svg?colorB=green)](https://www.npmjs.com/package/nthul-lite) [![Downloads](https://img.jsdelivr.com/img.shields.io/npm/dt/nthul-lite.svg)](https://www.npmjs.com/package/nthul-lite)
76+
77+
```bash
78+
$ pnpm add nthul-lite
79+
```
80+
81+
**or**
82+
83+
```bash
84+
$ npm install nthul-lite
85+
```
86+
87+
**or**
88+
89+
```bash
90+
$ yarn add nthul-lite
91+
```
92+
93+
> You need r18gs as a peer-dependency
94+
7595
## Usage
7696

7797
> Please explore `examples` and `packages/shared-ui` for working examples. (updates coming soon...)
@@ -397,7 +417,7 @@ cd nthul
397417
pnpm dev
398418
```
399419

400-
### 🤩 Don't forger to start [this repo](https://github.com/react18-tools/nthul)!
420+
### 🤩 Don't forger to start [this repo](https://github.com/react18-tools/nextjs-themes-ultralight)!
401421

402422
Want hands-on course for getting started with Turborepo? Check out [React and Next.js with TypeScript](https://mayank-chaudhari.vercel.app/courses/react-and-next-js-with-typescript) 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)
403423

examples/nextjs/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# nextjs-example
22

3+
## 0.0.1
4+
5+
### Patch Changes
6+
7+
- Updated dependencies
8+
9+
10+
311
## 1.0.5
412

513
### Patch Changes

examples/nextjs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nextjs-example",
3-
"version": "0.0.0",
3+
"version": "0.0.1",
44
"private": true,
55
"scripts": {
66
"dev": "next dev",

examples/vite/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# vite-example
22

3+
## 0.0.1
4+
5+
### Patch Changes
6+
7+
- Updated dependencies
8+
9+
10+
311
## 0.0.5
412

513
### Patch Changes

examples/vite/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "vite-example",
33
"private": true,
4-
"version": "0.0.0",
4+
"version": "0.0.1",
55
"type": "module",
66
"scripts": {
77
"dev": "vite --port 3001",

lib/nthul/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# @mayank1513/fork-me
22

3+
## 0.0.1
4+
5+
### Patch Changes
6+
7+
- Add lite version and fix README
8+
39
## 2.0.1
410

511
### Patch Changes

lib/nthul/lite.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
"use strict";
2+
3+
const fs = require("node:fs");
4+
const path = require("node:path");
5+
6+
const packageJson = require(path.resolve(__dirname, "package.json"));
7+
8+
const ref = packageJson.name;
9+
packageJson.peerDependencies.r18gs = "^0";
10+
packageJson.name = `${packageJson.name}-lite`;
11+
12+
fs.writeFileSync(path.resolve(__dirname, "package.json"), JSON.stringify(packageJson, null, 2));
13+
14+
const readMePath = path.resolve(__dirname, "..", "..", "README.md");
15+
let readMe = fs.readFileSync(readMePath, { encoding: "utf8" });
16+
const tmp = "!--|--!";
17+
const owner = process.env.OWNER;
18+
readMe = readMe.replace(new RegExp(`$${owner}/${ref}`, "g"), tmp);
19+
readMe = readMe.replace(new RegExp(ref, "g"), packageJson.name);
20+
readMe = readMe.replace(new RegExp(tmp, "g"), `$${owner}/${ref}`);
21+
readMe = readMe.replace(/## Want Lite Version.*> You need r18gs as a peer-dependency/m, "");
22+
fs.writeFileSync(readMePath, readMe);

lib/nthul/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "nthul",
33
"author": "Mayank Kumar Chaudhari <https://mayank-chaudhari.vercel.app>",
44
"private": false,
5-
"version": "0.0.0",
5+
"version": "0.0.1",
66
"description": "Unleash the Power of React Server Components! Use multiple themes on your site with confidence, without losing any advantages of React Server Components.",
77
"main": "./index.ts",
88
"types": "./index.ts",
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { Logo } from "../common/logo";
2+
import SimpleColorSwitch from "./simple-color-switch";
3+
import ThemeSwitching from "./theme-switching";
4+
5+
export default function LibExamples() {
6+
return (
7+
<div>
8+
<h1>
9+
<Logo /> examples.
10+
</h1>
11+
<SimpleColorSwitch />
12+
<ThemeSwitching />
13+
</div>
14+
);
15+
}

0 commit comments

Comments
 (0)