Skip to content

Commit

Permalink
Add lite version of the library
Browse files Browse the repository at this point in the history
- Template users may have some other libraries that they want to provide a varient for
  • Loading branch information
mayank1513 committed Jun 8, 2024
1 parent 8fdc1d5 commit 69428fb
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 7 deletions.
20 changes: 13 additions & 7 deletions .tkb
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,22 @@
"T1TbmRqXHguxnJv1g_Ot6": {
"id": "T1TbmRqXHguxnJv1g_Ot6",
"description": "Explore GitHub codespace templates",
"columnId": "column-rHWkySHomUOsd93fyS05p"
"columnId": "column-done"
},
"aCqTM5wgCQC3pY9TA7GtN": {
"id": "aCqTM5wgCQC3pY9TA7GtN",
"description": "Update r18-plugin to minify better - remove multiple jsx imports",
"columnId": "column-rHWkySHomUOsd93fyS05p"
"columnId": "column-done"
},
"KOQ0LhYPWc6ydZDSbZMGe": {
"id": "KOQ0LhYPWc6ydZDSbZMGe",
"description": "Update manual workflow to craete new branch when published from a tag",
"columnId": "column-rHWkySHomUOsd93fyS05p"
"columnId": "column-done"
},
"OUXfu0Fbgy4-8mdT_3xH8": {
"id": "OUXfu0Fbgy4-8mdT_3xH8",
"description": "Create lite version",
"columnId": "column-done"
}
},
"columns": [
Expand All @@ -79,10 +84,7 @@
"tasksIds": [
"5Br6CU2MKWj0R40obK9Nm",
"-DCBBAzTvSWMDb8whog60",
"P92idHa6fbprwBOYEp5uu",
"T1TbmRqXHguxnJv1g_Ot6",
"aCqTM5wgCQC3pY9TA7GtN",
"KOQ0LhYPWc6ydZDSbZMGe"
"P92idHa6fbprwBOYEp5uu"
]
},
{
Expand All @@ -94,7 +96,11 @@
"id": "column-done",
"title": "Done",
"tasksIds": [
"OUXfu0Fbgy4-8mdT_3xH8",
"5FPnfgSKUpHBbORBRtgui",
"T1TbmRqXHguxnJv1g_Ot6",
"KOQ0LhYPWc6ydZDSbZMGe",
"aCqTM5wgCQC3pY9TA7GtN",
"iXE3kCY0L1r_4TD-zRgVh",
"rRkFSIcteEvuq6MRX2BN0",
"mWXPi1Qzt9zNe6cKb8IZ3",
Expand Down
20 changes: 20 additions & 0 deletions lib/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,26 @@ $ npm install react18-loaders
$ yarn add react18-loaders
```

## Want Lite Version? [![npm bundle size](https://img.shields.io/bundlephobia/minzip/react18-loaders-lite)](https://www.npmjs.com/package/react18-loaders-lite) [![Version](https://img.shields.io/npm/v/react18-loaders-lite.svg?colorB=green)](https://www.npmjs.com/package/react18-loaders-lite) [![Downloads](https://img.jsdelivr.com/img.shields.io/npm/dt/react18-loaders-lite.svg)](https://www.npmjs.com/package/react18-loaders-lite)

```bash
$ pnpm add nextjs-themes-lite
```

**or**

```bash
$ npm install nextjs-themes-lite
```

**or**

```bash
$ yarn add nextjs-themes-lite
```

> You need `r18gs` as a peer-dependency
### Import Styles

You can import styles globally or within specific components.
Expand Down
29 changes: 29 additions & 0 deletions scripts/lite.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
"use strict";

const fs = require("node:fs");
const path = require("node:path");
const config = require("./rebrand.config.json");

const packageJson = require("../lib/package.json");

const ref = packageJson.name;
packageJson.peerDependencies.r18gs = `${packageJson.dependencies.r18gs.split(".")[0]}`;
delete packageJson.dependencies.r18gs;
if (Object.keys(packageJson.devDependencies).length === 0) delete packageJson.devDependencies;
packageJson.name = `${ref}-lite`;

fs.writeFileSync(
path.resolve(__dirname, "../lib/package.json"),
JSON.stringify(packageJson, null, 2),
);

const readMePath = path.resolve(__dirname, "../lib", "README.md");

let readMe = fs.readFileSync(readMePath, { encoding: "utf8" });
const tmp = "!---";
const { owner, repo } = config;
readMe = readMe.replace(new RegExp(`${owner}/${repo}`, "g"), tmp);
readMe = readMe.replace(new RegExp(ref, "g"), packageJson.name);
readMe = readMe.replace(new RegExp(tmp, "g"), `${owner}/${repo}`);
readMe = readMe.replace(/## Want Lite Version(.|\n|\r)*You need `r18gs` as a peer-dependency/m, "");
fs.writeFileSync(readMePath, readMe);

0 comments on commit 69428fb

Please sign in to comment.