Skip to content
This repository was archived by the owner on Aug 21, 2023. It is now read-only.

Commit 540684b

Browse files
committed
fix: add usage info to README and fix linting issues
1 parent c99cf80 commit 540684b

File tree

4 files changed

+93
-7
lines changed

4 files changed

+93
-7
lines changed

README.md

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,92 @@
1313

1414
A boilerplate repo for publishing typescript packages to npm
1515

16+
## Usage
17+
18+
Some notes on how to use this repo. Some day I'll hopefully automate the biggest part of this.
19+
20+
### Clone the repo:
21+
22+
```shell script
23+
npx degit https://github.com/beeman/template-typescript-package my-new-package
24+
```
25+
26+
### Initialize the new project
27+
28+
29+
```shell script
30+
cd my-new-package
31+
yarn # to install the deps
32+
git init # to initialize a new Git repo
33+
# Manually create a remote repo and follow the instructions OR:
34+
hub create # Use this amazing tool called 'hub': https://github.com/github/hub
35+
```
36+
37+
#### Update meta data:
38+
39+
Update the following fields in `package.json`:
40+
41+
- name
42+
- description
43+
- repository
44+
- keywords
45+
- author
46+
- license
47+
- bugs
48+
- homepage
49+
50+
Make sure to don't change the `version` property, versioning this package is handled by `semantic-release`!
51+
52+
#### Update README
53+
54+
Basically you want to search/replace the repo and package name to match your repo/package name and add any new info.
55+
56+
### Getting the GitHub and NPM tokens
57+
58+
#### GitHub
59+
60+
- Log in to GitHub.
61+
- Navigate to [https://github.com/settings/tokens](https://github.com/settings/tokens).
62+
- Click `Generate new token`.
63+
- Fill in the `note` field so you remember what the token is for.
64+
- Select the `write:packages` scope. This will also enable the `repo` and `read:packages` scopes.
65+
- Click `Generate token`.
66+
- Copy the code and store it to use in the next step.
67+
68+
#### NPM
69+
70+
- Log in to NPM.
71+
- Click the Tokens link from the top-right menu.
72+
- Click Create New Token
73+
- Select `Read and Publish` then click `Create Token`.
74+
- Copy the code and store it to use in the next step.
75+
76+
### Setting the GitHub and NPM tokens
77+
78+
- Open your new repo on GitHub.
79+
- Navigate to `Settings` then `Secrets`.
80+
- Click `Add a new secret`.
81+
- Add the `GH_TOKEN` secret with the GitHub token.
82+
- Click `Add a new secret` again.
83+
- Add the `NPM_TOKEN` secret with the NPM token.
84+
85+
Your repo is now set up to publish packages to NPM and the GitHub Package Registry.
86+
87+
### Write your code
88+
89+
Write your amazing new code and make sure to update the tests!
90+
91+
You can run `yarn lint` and `yarn test` to check if your project will pass CI.
92+
93+
### Publish it
94+
95+
With a `git push` you will create a new version and publish it to `npm`.
96+
97+
```shell script
98+
git commit -m "feat: initial commit"
99+
git push origin master
100+
```
101+
16102
## Credits
17103

18104
Based on [npm-typescript-package-boilerplate](https://github.com/93v/npm-typescript-package-boilerplate) with a few changes.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"name": "template-typescript-package",
2+
"name": "search-replace",
33
"version": "0.0.0-development",
4-
"description": "A boilerplate repo for publishing typescript packages to npm",
4+
"description": "A simple tool to help you search/replace throughout a codebase",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",
77
"scripts": {

src/__tests__/greet.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { greet } from "..";
1+
import { greet } from '..'
22

3-
test("My Greeter", () => {
4-
expect(greet("Carl")).toBe("Hello Carl");
5-
});
3+
test('My Greeter', () => {
4+
expect(greet('Carl')).toBe('Hello Carl')
5+
})

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export const greet = (name: string) => `Hello ${name}`;
1+
export const greet = (name: string) => `Hello ${name}`

0 commit comments

Comments
 (0)