Skip to content

Commit f544653

Browse files
committed
create scaffolds
1 parent 2328922 commit f544653

File tree

9 files changed

+67
-27
lines changed

9 files changed

+67
-27
lines changed

README.md

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# nthul
1+
# Nextjs-Themes-Ultralight
22

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

@@ -64,35 +64,9 @@ or
6464
$ yarn add nthul
6565
```
6666

67-
68-
69-
70-
## Getting started:
71-
72-
Click on the `"Use this template"` button to customize it for your next JavaScript/TypeScript/React/Vue/Next.js library or project.
73-
74-
## What's Different?
75-
76-
Compared to the default scaffold from create-turbo, this template offers:
77-
78-
- Unit tests with `vitest`
79-
- Build setup with `tsup` and `esbuild-react18-useclient` Supports React Server components out of the box
80-
- **Automatic file generation**
81-
- just run `yarn turbo gen` and follow the prompts to auto generate your new component with test file and dependency linking
82-
- follow best practices automatically
83-
- GitHub actions/workflows to auto publish your package when version changes
84-
- GitHub action/workflow + preinstall scripts to automatically rebrand your repo on creation
85-
8667
## Step by Step Instructions and Checklist
8768

88-
- [ ] Star [this repo](https://github.com/mayank1513/nthul/) so that you and others can find it more easily for your next projects. It also helps me understand that people are using this repo so that I can maintain the repo and the documentation well.
89-
90-
- [ ] Install and setup Node.js and IDE (I prefer VSCode)
91-
- [ ] Install the recommended VSCode extensions - [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode), [Trello Kanban](https://marketplace.visualstudio.com/items?itemName=mayank1513.trello-kanban-task-board)
9269
- [ ] Install dependencies using `pnpm`
93-
- [ ] If you don't have `pnpm` installed, run `npm i -g pnpm` to install `pnpm` -> run `pnpm setup` to set up `pnpm` for global installations
94-
- [ ] Run `pnpm i` to install dependencies and `preinstall` script will automatically touch up workflows and create a commit
95-
- [ ] Run `pnpm i -g turbo` to install `turbo` globally (Sometime due to `TypeScript` and `Plop` version conflicts code generation requires global `turbo`).
9670
- [ ] Run `turbo gen react-component`, and follow prompts to generate server or client components for your library
9771
- [ ] Use `snake-case` for your component name - it will be automatically converted to `PascalCase`
9872
- [ ] Your component and test files will be created in `**/src/client/` or `**/src/server/` directory depending on whether you choose `client` or `server` component

lib/nthul/src/client/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@
66
* */
77

88
// client component exports
9+
export * from "./theme-switcher";
910
export * from "./star-me";
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
"use client";
2+
3+
export * from "./theme-switcher";
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { cleanup, render, screen } from "@testing-library/react";
2+
import { afterEach, describe, test } from "vitest";
3+
import { ThemeSwitcher } from "./theme-switcher";
4+
5+
describe.concurrent("theme-switcher", () => {
6+
afterEach(cleanup);
7+
8+
test("check if h1 heading exists", ({ expect }) => {
9+
render(<ThemeSwitcher />);
10+
expect(screen.getByTestId("theme-switcher-h1").textContent).toBe("theme-switcher");
11+
});
12+
});
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import * as React from "react";
2+
3+
interface ThemeSwitcherProps {
4+
children?: React.ReactNode;
5+
}
6+
7+
/**
8+
* # ThemeSwitcher
9+
*
10+
*/
11+
export function ThemeSwitcher({ children }: ThemeSwitcherProps) {
12+
return (
13+
<div>
14+
<h1 data-testid="theme-switcher-h1">theme-switcher</h1>
15+
{children}
16+
</div>
17+
);
18+
}

lib/nthul/src/server/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@
55
* */
66

77
// server component exports
8+
export * from "./server-target";
89
export * from "./fork-me";
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from "./server-target";
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { cleanup, render, screen } from "@testing-library/react";
2+
import { afterEach, describe, test } from "vitest";
3+
import { ServerTarget } from "./server-target";
4+
5+
describe.concurrent("server-target", () => {
6+
afterEach(cleanup);
7+
8+
test("check if h1 heading exists", ({ expect }) => {
9+
render(<ServerTarget />);
10+
expect(screen.getByTestId("server-target-h1").textContent).toBe("server-target");
11+
});
12+
});
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import * as React from "react";
2+
3+
interface ServerTargetProps {
4+
children?: React.ReactNode;
5+
}
6+
7+
/**
8+
* # ServerTarget
9+
*
10+
*/
11+
export function ServerTarget({ children }: ServerTargetProps) {
12+
return (
13+
<div>
14+
<h1 data-testid="server-target-h1">server-target</h1>
15+
{children}
16+
</div>
17+
);
18+
}

0 commit comments

Comments
 (0)