Skip to content

Commit

Permalink
feat: first blood, should just work
Browse files Browse the repository at this point in the history
  • Loading branch information
JounQin committed Oct 10, 2021
1 parent 0713151 commit 5687c48
Show file tree
Hide file tree
Showing 24 changed files with 14,494 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
15 changes: 15 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": [
"@changesets/changelog-github",
{
"repo": "rx-ts/lib-boilerplate"
}
],
"commit": false,
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
4 changes: 4 additions & 0 deletions .codesandbox/ci.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"node": "14",
"sandboxes": []
}
3 changes: 3 additions & 0 deletions .commitlintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "@1stg"
}
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
coverage
lib
CHANGELOG.md
!/.*.js
6 changes: 6 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": "@1stg",
"rules": {
"unicorn/require-post-message-target-origin": 0
}
}
2 changes: 2 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
github: [JounQin]
open_collective: rxts
51 changes: 51 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: CI

on:
- push
- pull_request

jobs:
ci:
name: Lint and Test with Node.js ${{ matrix.node }}
strategy:
matrix:
node:
- 12
- 14
- 16
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@master

- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: latest

- name: Setup Node.js ${{ matrix.node }}
uses: actions/setup-node@master
with:
node-version: ${{ matrix.node }}
cache: pnpm

- name: Install Dependencies
run: pnpm i --frozen-lockfile --prefer-offline

- name: Build, Lint and test
run: |
pnpm test
pnpm lint
env:
EFF_NO_LINK_RULES: true
PARSER_NO_WATCH: true

- name: Codecov
run: |
pnpm add --global codecov codacy-coverage
codecov
cat ./coverage/lcov.info | codacy-coverage -u rx-ts -n lib-boilerplate
env:
CI: 'true'
CODACY_ACCOUNT_TOKEN: ${{ secrets.CODACY_ACCOUNT_TOKEN }}
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
43 changes: 43 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Release

on:
push:
branches:
- main

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v2
with:
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
fetch-depth: 0

- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: latest

- name: Setup Node.js 14.x
uses: actions/setup-node@v2
with:
node-version: 14.x
cache: pnpm

- name: Install Dependencies
run: pnpm i --frozen-lockfile --prefer-offline

- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@master
with:
# This expects you to have a script called release which does a build for your packages and calls changeset publish
publish: pnpm release
commit: 'chore: release package(s)'
title: 'chore: release package(s)'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.*cache
.type-coverage
coverage
lib
node_modules
1 change: 1 addition & 0 deletions .lintstagedrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('@1stg/lint-staged/tsc')
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
shamefully-hoist=true
1 change: 1 addition & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"@1stg/prettier-config"
5 changes: 5 additions & 0 deletions .remarkrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"plugins": [
"@1stg/remark-config"
]
}
5 changes: 5 additions & 0 deletions .renovaterc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": [
"@1stg"
]
}
1 change: 1 addition & 0 deletions .simple-git-hooks.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('@1stg/simple-git-hooks')
58 changes: 58 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,60 @@
# lib-boilerplate

[![GitHub Actions](https://github.com/rx-ts/lib-boilerplate/workflows/CI/badge.svg)](https://github.com/rx-ts/lib-boilerplate/actions/workflows/ci.yml)
[![Codecov](https://img.shields.io/codecov/c/github/rx-ts/lib-boilerplate.svg)](https://codecov.io/gh/rx-ts/lib-boilerplate)
[![Codacy Grade](https://img.shields.io/codacy/grade/f2cec506ecf446aca3769c402e0a104e)](https://www.codacy.com/gh/rx-ts/lib-boilerplate)
[![type-coverage](https://img.shields.io/badge/dynamic/json.svg?label=type-coverage&prefix=%E2%89%A5&suffix=%&query=$.typeCoverage.atLeast&uri=https%3A%2F%2Fraw.githubusercontent.com%2Frx-ts%2Flib-boilerplate%2Fmain%2Fpackage.json)](https://github.com/plantain-00/type-coverage)
[![npm](https://img.shields.io/npm/v/lib-boilerplate.svg)](https://www.npmjs.com/package/lib-boilerplate)
[![GitHub Release](https://img.shields.io/github/release/rx-ts/lib-boilerplate)](https://github.com/rx-ts/lib-boilerplate/releases)

[![David Peer](https://img.shields.io/david/peer/rx-ts/lib-boilerplate.svg)](https://david-dm.org/rx-ts/lib-boilerplate?type=peer)
[![David](https://img.shields.io/david/rx-ts/lib-boilerplate.svg)](https://david-dm.org/rx-ts/lib-boilerplate)
[![David Dev](https://img.shields.io/david/dev/rx-ts/lib-boilerplate.svg)](https://david-dm.org/rx-ts/lib-boilerplate?type=dev)

[![Conventional Commits](https://img.shields.io/badge/conventional%20commits-1.0.0-yellow.svg)](https://conventionalcommits.org)
[![Renovate enabled](https://img.shields.io/badge/renovate-enabled-brightgreen.svg)](https://renovatebot.com)
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
[![Code Style: Prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
[![changesets](https://img.shields.io/badge/maintained%20with-changesets-176de3.svg)](https://github.com/atlassian/changesets)

A simple library boilerplate.

## TOC <!-- omit in toc -->

- [Usage](#usage)
- [Install](#install)
- [API](#api)
- [Changelog](#changelog)
- [License](#license)

## Usage

### Install

```sh
# yarn
yarn add pkg

# npm
npm i pkg
```

### API

```js
import echo from 'pkg'

echo()
```

## Changelog

Detailed changes for each release are documented in [CHANGELOG.md](./CHANGELOG.md).

## License

[MIT][] © [JounQin][]@[1stG.me][]

[1stg.me]: https://www.1stg.me
[jounqin]: https://GitHub.com/JounQin
[mit]: http://opensource.org/licenses/MIT
22 changes: 22 additions & 0 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { Config } from '@jest/types'

const config: Config.InitialOptions = {
preset: 'ts-jest',
testEnvironment: 'node',
collectCoverage: true,
extensionsToTreatAsEsm: ['.ts'],
moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1',
'^pkg$': '<rootDir>/src',
},
globals: {
'ts-jest': {
useESM: true,
tsconfig: {
importHelpers: false,
},
},
},
}

export default config
60 changes: 60 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"name": "pkg",
"version": "0.0.0",
"type": "module",
"description": "A simple library boilerplate.",
"repository": "git+https://github.com/rx-ts/lib-boilerplate.git",
"author": "JounQin <[email protected]>",
"license": "MIT",
"engines": {
"node": ">=v12.0.0"
},
"exports": {
"import": "./lib/index.js",
"require": "./lib/index.cjs"
},
"types": "lib",
"files": [
"lib",
"!*.tsbuildinfo"
],
"scripts": {
"build": "run-p build:*",
"build:r": "r -f cjs",
"build:ts": "tsc -p src",
"lint": "run-p lint:*",
"lint:es": "eslint . --cache -f friendly --max-warnings 10",
"lint:tsc": "tsc --noEmit",
"prepare": "simple-git-hooks",
"prerelease": "pnpm build",
"release": "changeset publish",
"test": "pnpm jest",
"typecov": "type-coverage"
},
"dependencies": {
"tslib": "^2.3.1"
},
"devDependencies": {
"@1stg/lib-config": "^4.1.0",
"@changesets/changelog-github": "^0.4.1",
"@changesets/cli": "^2.17.0",
"@types/jest": "^27.0.2",
"@types/node": "^16.10.3",
"ts-jest": "^27.0.5",
"type-coverage": "^2.18.2",
"typescript": "^4.4.3"
},
"resolutions": {
"prettier": "^2.4.1"
},
"typeCoverage": {
"atLeast": 100,
"cache": true,
"detail": true,
"ignoreAsAssertion": true,
"ignoreNonNullAssertion": true,
"showRelativePath": true,
"strict": true,
"update": true
}
}
Loading

0 comments on commit 5687c48

Please sign in to comment.