Skip to content

Commit

Permalink
feat: publish to npm
Browse files Browse the repository at this point in the history
  • Loading branch information
BIYUEHU committed Aug 19, 2023
1 parent ff843fb commit 65fee91
Show file tree
Hide file tree
Showing 6 changed files with 81 additions and 42 deletions.
15 changes: 15 additions & 0 deletions .versionrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"types": [
{ "type": "feat", "section": "✨ Features" },
{ "type": "fix", "section": "🐛 Bug Fixes" },
{ "type": "docs", "section": "✏️ Documentation" },
{ "type": "style", "section": "💄 Styles" },
{ "type": "refactor", "section": "♻️ Code Refactoring" },
{ "type": "perf", "section": "⚡ Performance Improvements" },
{ "type": "test", "section": "✅ Tests" },
{ "type": "revert", "section": "⏪ Revert", "hidden": true },
{ "type": "build", "section": "📦‍ Build System" },
{ "type": "chore", "section": "🚀 Chore" },
{ "type": "ci", "section": "👷 Continuous Integration" }
]
}
15 changes: 0 additions & 15 deletions .versionrc.js

This file was deleted.

79 changes: 63 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
**Last update: 2023-8-19**

> Main Stack: pnpm, eslint, prettier, commitizen, husky, commitlint
> Secondary Stack:Typescript, git, lint-staged, standard-version
## 1.Initialize project and use pnpm
Expand Down Expand Up @@ -492,23 +493,69 @@ pnpm install standard-version -D
}
```

> .versionrc.js
> .versionrc
```json
module.exports = {
types: [
{ type: 'feat', section: '✨ Features' },
{ type: 'fix', section: '🐛 Bug Fixes' },
{ type: 'docs', section: '✏️ Documentation' },
{ type: 'style', section: '💄 Styles' },
{ type: 'refactor', section: '♻️ Code Refactoring' },
{ type: 'perf', section: '⚡ Performance Improvements' },
{ type: 'test', section: '✅ Tests' },
{ type: 'revert', section: '⏪ Revert', hidden: true },
{ type: 'build', section: '📦‍ Build System' },
{ type: 'chore', section: '🚀 Chore' },
{ type: 'ci', section: '👷 Continuous Integration' },
],
};
{
"types": [
{ "type": "feat", "section": "✨ Features" },
{ "type": "fix", "section": "🐛 Bug Fixes" },
{ "type": "docs", "section": "✏️ Documentation" },
{ "type": "style", "section": "💄 Styles" },
{ "type": "refactor", "section": "♻️ Code Refactoring" },
{ "type": "perf", "section": "⚡ Performance Improvements" },
{ "type": "test", "section": "✅ Tests" },
{ "type": "revert", "section": "⏪ Revert", "hidden": true },
{ "type": "build", "section": "📦‍ Build System" },
{ "type": "chore", "section": "🚀 Chore" },
{ "type": "ci", "section": "👷 Continuous Integration" }
]
}
```

Try a few!

```shel
pnpm run release
```

## 5.Publish to Npm Package

Mange npm's sources:

```shell
npm install nrm -g
nrm ls
# View all sources list
nrm use npm
# Checkout some source
```

> package.json
Added some information for your `package.json`

```json
{
/* ... */
"bugs": {
"url": "https://github.com/biyuehu/standard-dev-demo/issues"
},
"repository": {
"type": "git",
"url": "git@github.com:BIYUEHU/standard-dev-demo.git"
},
"homepage": "https://github.com/biyuehu/standard-dev-demo#readme",
/* ... */
}
```

When Everything is ready:

```shell
npm publish
```

View your package: [https://www.npmjs.com/package/standard-dev-demo](https://www.npmjs.com/package/standard-dev-demo)

> Good!You can develop to a standard project,Now!
8 changes: 0 additions & 8 deletions nest-cli.json

This file was deleted.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "standard-dev-demo",
"version": "1.0.4",
"description": "> Stack: pnpm, eslint, prettier, commitizen, husky, commitlint",
"description": "Stack: pnpm, eslint, prettier, commitizen, husky, commitlint",
"main": "index.ts",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
Expand All @@ -11,7 +11,7 @@
"release": "standard-version"
},
"keywords": [],
"author": "Hotaru",
"author": "hotaru",
"license": "ISC",
"devDependencies": {
"@commitlint/cli": "12.1.4",
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ function test(a: string) {
a: a ? 1 : 3,
};
}
test('ba');
test('good job!');

0 comments on commit 65fee91

Please sign in to comment.