Skip to content

Commit

Permalink
docs: initialize
Browse files Browse the repository at this point in the history
  • Loading branch information
moontai0724 committed Apr 22, 2024
1 parent 4a5784e commit 78926f3
Show file tree
Hide file tree
Showing 5 changed files with 5,729 additions and 77 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cd-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: moontai0724/package-template
slug: moontai0724/flickr-sdk
files: ./coverage/cobertura-coverage.xml
verbose: true

Expand Down
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 moontai0724

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
79 changes: 9 additions & 70 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,94 +1,33 @@
# @moontai0724/package-template
# @moontai0724/flickr-sdk

[![NPM Version](https://img.shields.io/npm/v/@moontai0724/package-template)](https://www.npmjs.com/package/@moontai0724/package-template)
[![NPM Downloads](https://img.shields.io/npm/d18m/@moontai0724/package-template)](https://www.npmjs.com/package/@moontai0724/package-template)
[![Codecov](https://codecov.io/gh/moontai0724/package-template/graph/badge.svg)](https://codecov.io/gh/moontai0724/package-template)

## Features

- [x] TypeScript
- [x] [ESLint](https://eslint.org) + [Prettier](https://prettier.io): Coding Style & Formatter
- [Husky](https://github.com/typicode/husky) + [Lint-staged](https://github.com/okonet/lint-staged): Pre-commit hooks
- [Airbnb Coding Style](https://github.com/airbnb/javascript)
- Auto [organize imports](https://github.com/import-js/eslint-plugin-import).
- Auto sort [imports](https://github.com/lydell/eslint-plugin-simple-import-sort) and [object keys](https://github.com/infctr/eslint-plugin-typescript-sort-keys).
- [x] [Rollup](https://rollupjs.org/): Bundle the package
- [Babel](https://github.com/rollup/plugins/tree/master/packages/babel): Compile the code to ES5 compatible
- [Terser](https://github.com/rollup/plugins/tree/master/packages/terser): Minify the code
- [x] [Vitest](https://github.com/vitest-dev/vitest): Tests and [Coverage](https://github.com/vitest-dev/vitest/tree/main/packages/coverage-v8)
- [x] [Semantic Release](https://github.com/semantic-release/semantic-release): Auto versioning, Changelog and Release
- [@semantic-release/changelog](https://github.com/semantic-release/changelog): Generate changelog based on the commit messages
- [@semantic-release/github](https://github.com/semantic-release/github): Create a release on GitHub
- [@semantic-release/npm](https://github.com/semantic-release/npm): Publish the package to npm & update the package version
- [@semantic-release/git](https://github.com/semantic-release/git): Commit the version change back to the repository
- [x] [CodeCov](https://codecov.io): Code coverage
- [x] [Typedoc](https://github.com/TypeStrong/typedoc): API documentation
- [x] GitHub Actions: CI/CD

## Getting Started

### 1. Use this template to create a new repository.

Click the [`Use this template`](https://github.com/new?template_name=package-template&template_owner=moontai0724) button on the top right corner of the repository page.

### 2. Clone the repository, and install the dependencies.

Just clone your repo and install the dependencies with any package manager you like. This template does not strong bind to any package manager, but the used package manager in GitHub Actions workflow is `pnpm`. You may need to modify the workflow file if you use other package managers.

### 3. Modify the package content to fit your project.

There are few places you need to modify to fit your project, like `package.json`, `README.md`. You can use the following command to replace most of the content:

```bash
YOUR_GITHUB_USER="your-user-name"
YOUR_REPO_NAME="your-awesome-package-name"
sed -i "s/moontai0724/${YOUR_GITHUB_USER}/g" package.json README.md .github/workflows/*
sed -i "s/package-template/${YOUR_REPO_NAME}/g" package.json README.md .github/workflows/*
```

### 4. Start coding!

## Publish

This template uses [CodeCov](https://docs.codecov.com/docs/quick-start) to check the code coverage. You can remove the CodeCov badge and the related scripts in `package.json` if you don't need it.
If you want to use CodeCov, you need to set the `CODECOV_TOKEN` in the [repository secrets](https://github.com/moontai0724/package-template/settings/secrets/actions).

Once you done, you can push your codes to the `release` branch.

The actions in this template will auto perform following steps when you push the code to the `release` branch:

- Test: Run tests and generate coverage report
- Build: Generate bundled and minified esm, cjs version (for browser), and unminified esm version (for node).
- Release: Bump Version & Generate Changelog
- [Publish the package to npm](https://www.npmjs.com/package/@moontai0724/package-template/)
- [Publish docs to GitHub Pages](https://moontai0724.github.io/package-template/): You may need to setup the GitHub Pages in the repository settings.

You can modify the workflow file to fit your needs.
[![NPM Version](https://img.shields.io/npm/v/@moontai0724/flickr-sdk)](https://www.npmjs.com/package/@moontai0724/flickr-sdk)
[![NPM Downloads](https://img.shields.io/npm/d18m/@moontai0724/flickr-sdk)](https://www.npmjs.com/package/@moontai0724/flickr-sdk)
[![Codecov](https://codecov.io/gh/moontai0724/flickr-sdk/graph/badge.svg)](https://codecov.io/gh/moontai0724/flickr-sdk)

## Install

### NPM

```bash
npm install @moontai0724/package-template
npm install @moontai0724/flickr-sdk
```

### Yarn

```bash
yarn add @moontai0724/package-template
yarn add @moontai0724/flickr-sdk
```

### PNPM

```bash
pnpm add @moontai0724/package-template
pnpm add @moontai0724/flickr-sdk
```

## Usage

```typescript
import { add, divide, max } from "@moontai0724/package-template";
import { add, divide, max } from "@moontai0724/flickr-sdk";

add(1, 2); // 3
divide(1, 2); // 0.5
Expand All @@ -97,4 +36,4 @@ max(1, 2); // 2

## API Document

See the [API documentation](https://moontai0724.github.io/package-template/).
See the [API documentation](https://moontai0724.github.io/flickr-sdk/).
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
{
"name": "@moontai0724/package-template",
"name": "@moontai0724/flickr-sdk",
"private": false,
"publishConfig": {
"access": "public"
},
"version": "0.0.0-pre",
"description": "An npm package template.",
"description": "A TypeScript SDK for Flickr API",
"author": "moontai0724",
"license": "UNLICENSED",
"homepage": "https://moontai0724.github.io/package-template",
"license": "MIT",
"homepage": "https://moontai0724.github.io/flickr-sdk",
"bugs": {
"url": "https://github.com/moontai0724/package-template/issues"
"url": "https://github.com/moontai0724/flickr-sdk/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/moontai0724/package-template.git"
"url": "https://github.com/moontai0724/flickr-sdk.git"
},
"keywords": [
"package",
Expand Down
Loading

0 comments on commit 78926f3

Please sign in to comment.