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 Sep 9, 2021
1 parent 958dbf5 commit c6a9709
Show file tree
Hide file tree
Showing 17 changed files with 10,325 additions and 1 deletion.
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/config@1.6.0/schema.json",
"changelog": [
"@changesets/changelog-github",
{
"repo": "rx-ts/mono-lib-boilerplate"
}
],
"commit": false,
"linked": [],
"access": "restricted",
"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": []
}
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 Node.js ${{ matrix.node }}
uses: actions/setup-node@master
with:
node-version: ${{ matrix.node }}
cache: yarn

- name: Link Yarn global binaries into PATH
run: echo "$(yarn global bin)" >> $GITHUB_PATH

- name: Install Dependencies
run: yarn --frozen-lockfile

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

- name: Codecov
run: |
yarn global add codecov codacy-coverage
codecov
cat ./coverage/lcov.info | codacy-coverage -u rx-ts -n mono-lib-boilerplate
env:
CI: 'true'
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
CODACY_ACCOUNT_TOKEN: ${{ secrets.CODACY_ACCOUNT_TOKEN }}
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
38 changes: 38 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
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 Node.js 14.x
uses: actions/setup-node@v2
with:
node-version: 14.x
cache: yarn

- name: Install Dependencies
run: yarn --frozen-lockfile

- 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: yarn release
commit: 'chore: release package(s)'
title: 'chore: release package(s)'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*.log
.*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 .simple-git-hooks.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('@1stg/simple-git-hooks')
33 changes: 32 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,33 @@
# mono-lib-boilerplate
A simple mono library boilerplate.

[![GitHub Actions](https://github.com/rx-ts/mono-lib-boilerplate/workflows/CI/badge.svg)](https://github.com/rx-ts/mono-lib-boilerplate/actions/workflows/ci.yml)
[![Codacy Grade](https://img.shields.io/codacy/grade/675823db9630419e97c7260b71d6c279)](https://www.codacy.com/gh/rx-ts/mono-lib-boilerplate)
[![Codecov](https://img.shields.io/codecov/c/gh/rx-ts/mono-lib-boilerplate)](https://codecov.io/gh/rx-ts/mono-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%2Fmono-lib-boilerplate%2Fmain%2Fpackage.json)](https://github.com/plantain-00/type-coverage)
[![GitHub release](https://img.shields.io/github/release/rx-ts/mono-lib-boilerplate)](https://github.com/rx-ts/mono-lib-boilerplate/releases)
[![David Dev](https://img.shields.io/david/dev/rx-ts/mono-lib-boilerplate.svg)](https://david-dm.org/rx-ts/mono-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 mono library boilerplate.
## Packages

This repository is a monorepo managed by [changesets][] what means we actually publish several packages to npm from same codebase, including:

| Package | Description | Version | (Peer) Dependencies |
| ---------------------- | ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [`pkg`](/packages/pkg) | A simple package. | [![npm](https://img.shields.io/npm/v/pkg.svg)](https://www.npmjs.com/package/pkg) [![View changelog](https://img.shields.io/badge/changelog-explore-brightgreen)](https://changelogs.xyz/pkg) | [![David Peer](https://img.shields.io/david/peer/rx-ts/mono-lib-boilerplate.svg?path=packages/htm)](https://david-dm.org/rx-ts/mono-lib-boilerplate?path=packages/htm&type=peer) [![David](https://img.shields.io/david/rx-ts/mono-lib-boilerplate.svg?path=packages/htm)](https://david-dm.org/rx-ts/mono-lib-boilerplate?path=packages/htm) |

## License

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

[1stg.me]: https://www.1stg.me
[changesets]: https://GitHub.com/atlassian/changesets
[jounqin]: https://GitHub.com/JounQin
[mit]: http://opensource.org/licenses/MIT
85 changes: 85 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
{
"name": "mono-lib-boilerplate",
"version": "0.0.0",
"type": "module",
"repository": "git+https://github.com/rx-ts/mono-lib-boilerplate.git",
"author": "JounQin <admin@1stg.me>",
"license": "MIT",
"private": true,
"workspaces": [
"packages/*"
],
"scripts": {
"build": "run-p build:*",
"build:r": "r -f cjs",
"build:tsc": "tsc -b",
"jest": "node --experimental-vm-modules node_modules/.bin/jest",
"lint": "run-p lint:*",
"lint:es": "eslint . --cache -f friendly",
"lint:tsc": "tsc --noEmit",
"prepare": "simple-git-hooks && yarn-deduplicate --strategy fewer || exit 0",
"prerelease": "yarn build",
"release": "changeset publish",
"test": "yarn jest",
"ts": "node --loader ts-node/esm",
"typecov": "type-coverage"
},
"devDependencies": {
"@1stg/lib-config": "^4.0.0",
"@changesets/changelog-github": "^0.4.1",
"@changesets/cli": "^2.17.0",
"@types/jest": "^27.0.1",
"@types/node": "^16.7.13",
"ts-jest": "^27.0.5",
"ts-node": "^10.2.1",
"type-coverage": "^2.18.2",
"typescript": "^4.4.2"
},
"resolutions": {
"prettier": "^2.3.2"
},
"commitlint": {
"extends": "@1stg"
},
"eslintConfig": {
"extends": "@1stg"
},
"eslintIgnore": [
"coverage",
"lib"
],
"jest": {
"preset": "ts-jest/presets/default-esm",
"collectCoverage": true,
"globals": {
"ts-jest": {
"useESM": true
}
},
"moduleNameMapper": {
"^(\\.{1,2}/.*)\\.js$": "$1",
"pkg": "<rootDir>/packages/pkg/src"
}
},
"prettier": "@1stg/prettier-config",
"remarkConfig": {
"plugins": [
"@1stg/remark-config"
]
},
"renovate": {
"extends": [
"@1stg"
]
},
"typeCoverage": {
"atLeast": 100,
"cache": true,
"detail": true,
"ignoreAsAssertion": true,
"ignoreNonNullAssertion": true,
"showRelativePath": true,
"strict": true,
"update": true
}
}
23 changes: 23 additions & 0 deletions packages/pkg/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "pkg",
"version": "0.0.0",
"type": "module",
"description": "A simple package.",
"repository": "git+https://github.com/rx-ts/mono-lib-boilerplate.git",
"homepage": "https://github.com/rx-ts/mono-lib-boilerplate/blob/main/packages/pkg",
"author": "JounQin <admin@1stg.me>",
"exports": {
"import": "./lib.index.js",
"require": "./lib/index.cjs"
},
"types": "lib",
"files": [
"lib"
],
"dependencies": {
"tslib": "^2.3.1"
},
"publishConfig": {
"access": "public"
}
}
1 change: 1 addition & 0 deletions packages/pkg/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default () => 'Hello World!'
5 changes: 5 additions & 0 deletions packages/pkg/test/basic.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import echo from 'pkg'

test('it should just work', () => {
expect(echo()).toBe('Hello World!')
})
9 changes: 9 additions & 0 deletions packages/pkg/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "@1stg/tsconfig/lib",
"compilerOptions": {
"composite": true,
"rootDir": "src",
"outDir": "lib"
},
"include": ["src"]
}
14 changes: 14 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"extends": "@1stg/tsconfig/lib",
"compilerOptions": {
"baseUrl": ".",
"paths": {
"pkg": ["packages/pkg/src"]
}
},
"references": [
{
"path": "packages/pkg"
}
]
}
Loading

0 comments on commit c6a9709

Please sign in to comment.