Skip to content

Commit

Permalink
Readme update
Browse files Browse the repository at this point in the history
  • Loading branch information
dcooney committed Aug 30, 2023
1 parent d30eaf8 commit f73ff16
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,11 @@ From the project directory, you can run the following scripts with `npm` or `yar

After the project setup is complete, it's time to select a package name and start developing the package.

Note: Package source files are located in the `src/lib` directory.

### Package Naming

The first thing you to do is to choose a **unique** name for the package.
The first thing to do is to choose a **unique** name for the package.

Go to the [NPM registry](https://www.npmjs.com/) and run a search. Be sure there isn't an exact match to the name you intend to use or you will need to do one of the following:

Expand All @@ -53,21 +55,19 @@ Go to the [NPM registry](https://www.npmjs.com/) and run a search. Be sure there

In the `src/lib` directory of the project is an example component. This is the component we intend to distribute on npm, which happens to be a simple HTML button component.

You can rename this component or create an entirely new component. Either way, this will be the main component for distribution so add your logic to this file entry point in the `src/lib` directory.
You can rename this component or create an entirely new component. Either way, this will be the main component used for distribution so add your component logic to this entry point.

### Component Functionality

Locate the `App.tsx` component found in the root of the `src` directory. This is the file we are using for testing the functionality of the distributed package.

You will notice that we are importing the `Example` component and passing various props to the component.
The `App.tsx` component found in the root of the `src` directory is the file we are using for testing the functionality of the distributed package. You will notice that we are importing the `Example` component from the `libs` directory and passing various props to the component.

Use this as the package demo and import your component/package into this file for testing.
Use this file and import your component for testing when runing the local development server.

### Package.json

The next step is to update the project config found in `package.json` to reference your specific project.
The next step is to update the project config found in `package.json` to reference your project specifics.

It's recommended that you change the following fields:
At minimum you must update the following fields:

| Field | Description |
|--------------: |------------------------------------------ |
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
"description": "A starter project for publishing NPM packages with React and Typescript.",
"homepage": "https://dcooney.github.io/react-npm-starter/",
"source": "src/lib/Example.tsx",
"types": "dist/lib/Example.d.ts",
"main": "dist/index.js",
"module": "dist/index.module.js",
"unpkg": "dist/index.umd.js",
"types": "dist/lib/example.d.ts",
"overrides": {
"typescript": "^5.2.2"
},
Expand Down
5 changes: 0 additions & 5 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@ function App() {
<div className="container">
<header className="py-5 border-b mb-5">
<h1 className="mb-1">React NPM Starter</h1>
<h2 className="text-base text-slate-500 font-normal">
A starter project for rapidly publishing{' '}
<a href="https://www.npmjs.com/">NPM packages</a> with React and
Typescript.
</h2>
</header>
<div className="flex gap-2">
<Example label="Link Button" url="https://github.com/dcooney" />
Expand Down

0 comments on commit f73ff16

Please sign in to comment.