Skip to content

Commit

Permalink
build: add automate release
Browse files Browse the repository at this point in the history
  • Loading branch information
Kikobeats committed Nov 12, 2022
1 parent f6913c7 commit 6a0d76a
Show file tree
Hide file tree
Showing 9 changed files with 100 additions and 30 deletions.
18 changes: 0 additions & 18 deletions .bumpedrc

This file was deleted.

37 changes: 37 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: test

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
token: ${{ secrets.GH_TOKEN || secrets.GITHUB_TOKEN }}
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: lts/*
- name: Install
run: npm install --no-package-lock
- name: Test
run: npm test
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Release
if: ${{ github.ref == 'refs/heads/master' && !startsWith(github.event.head_commit.message, 'chore(release):') && !startsWith(github.event.head_commit.message, 'docs:') }}
shell: 'script -q -e -c "bash {0}" > /dev/null'
env:
CONVENTIONAL_GITHUB_RELEASER_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
git config --global user.email ${{ secrets.GIT_EMAIL }}
git config --global user.name ${{ secrets.GIT_USERNAME }}
npm run release
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ dist
.envrc
stats.html
storybook-static
.vercel
13 changes: 13 additions & 0 deletions .storybook/manager.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { addons } from '@storybook/addons'
import { create } from '@storybook/theming'

const theme = create({
base: 'light',
brandTitle: 'nanoclamp',
brandUrl: 'https://github.com/microlinkhq/nanoclamp',
appBg: 'white',
appContentBg: 'white',
appBorderColor: 'white'
})

addons.setConfig({ theme })
3 changes: 0 additions & 3 deletions .travis.yml

This file was deleted.

File renamed without changes.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import NanoClamp from 'nanoclamp';

## License

**nanoclamp** © [Microlink](https://microlink.io), released under the [MIT](https://github.com/microlinkhq/nanoclamp/blob/master/LICENSE) License.<br>
**nanoclamp** © [Microlink](https://microlink.io), released under the [MIT](https://github.com/microlinkhq/nanoclamp/blob/master/LICENSE.md) License.<br>
Adapted from [`react-clamp-lines`](https://github.com/zoltantothcom/react-clamp-lines) by Brad Adams with help from [contributors](https://github.com/microlinkhq/nanoclamp/contributors).

> [microlink.io](https://microlink.io) · GitHub [microlinkhq](https://github.com/microlinkhq) · Twitter [@microlinkhq](https://twitter.com/microlinkhq)
53 changes: 47 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,24 @@
"author": {
"name": "Brad Adams"
},
"contributors": [
{
"name": "Kiko Beats",
"email": "[email protected]"
},
{
"name": "Brad Adams",
"email": "[email protected]"
},
{
"name": "Zoltan Toth",
"email": "[email protected]"
},
{
"name": "Axel Hernández Ferrera",
"email": "[email protected]"
}
],
"repository": {
"type": "git",
"url": "git+https://github.com/microlinkhq/nanoclamp.git"
Expand All @@ -28,17 +46,24 @@
"@babel/plugin-transform-react-constant-elements": "latest",
"@babel/preset-env": "latest",
"@babel/preset-react": "latest",
"@commitlint/cli": "latest",
"@commitlint/config-conventional": "latest",
"@rollup/plugin-babel": "latest",
"@rollup/plugin-terser": "latest",
"@rollup/plugin-typescript": "latest",
"@storybook/addons": "latest",
"@storybook/builder-webpack5": "latest",
"@storybook/manager-webpack5": "latest",
"@storybook/react": "latest",
"@types/node": "latest",
"@storybook/theming": "latest",
"@types/react": "^18",
"babel-loader": "latest",
"ci-publish": "latest",
"conventional-github-releaser": "latest",
"finepack": "latest",
"git-authors-cli": "latest",
"nano-staged": "latest",
"npm-check-updates": "latest",
"prettier-standard": "latest",
"prop-types": "latest",
"react": "^18",
Expand All @@ -48,7 +73,6 @@
"rollup-plugin-peer-deps-external": "latest",
"rollup-plugin-visualizer": "latest",
"simple-git-hooks": "latest",
"standard": "latest",
"standard-markdown": "latest",
"ts-standard": "latest",
"typescript": "latest"
Expand All @@ -63,18 +87,34 @@
"scripts": {
"build": "NODE_ENV=production rollup -c rollup.config.js --bundleConfigAsCjs",
"build-storybook": "NODE_ENV=production build-storybook",
"contributors": "(git-authors-cli && finepack && git add package.json && git commit -m 'build: contributors' --no-verify) || true",
"dev": "start-storybook -p 6006",
"lint": "standard-markdown && ts-standard src && standard stories",
"postrelease": "npm run release:tags && npm run release:github && (ci-publish || npm publish --access=public)",
"prepare": "npx simple-git-hooks",
"prepublishOnly": "npm run build",
"prerelease": "npm run update:check && npm run contributors",
"pretest": "npm run lint",
"test": "exit 0"
"release": "standard-version -a",
"release:github": "conventional-github-releaser -p angular",
"release:tags": "git push --follow-tags origin HEAD:master",
"test": "exit 0",
"update": "ncu -u",
"update:check": "ncu -- --error-level 2"
},
"license": "MIT",
"commitlint": {
"extends": [
"@commitlint/config-conventional"
]
},
"nano-staged": {
"*.js": [
"*.js,!*.min.js,": [
"prettier-standard"
],
"*.md": [
"standard-markdown"
],
"package.json": [
"finepack"
]
Expand All @@ -83,9 +123,10 @@
"react": "^18"
},
"simple-git-hooks": {
"pre-commit": "./node_modules/.bin/nano-staged"
"commit-msg": "npx commitlint --edit",
"pre-commit": "npx nano-staged"
},
"standard": {
"ts-standard": {
"globals": [
"React"
],
Expand Down
3 changes: 1 addition & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const DEFAULT_ELLIPSIS = '…'
const DEFAULT_TEXT = '.'

const debounceFn = (func: () => void, timeoutMs: number): () => void => {
let timeout: NodeJS.Timeout | undefined
let timeout: ReturnType<typeof setTimeout> | undefined

const later = (): void => {
timeout = undefined
Expand All @@ -28,7 +28,6 @@ const debounceFn = (func: () => void, timeoutMs: number): () => void => {
}
}


const NanoClamp = ({
accessibility = true,
debounce = 300,
Expand Down

0 comments on commit 6a0d76a

Please sign in to comment.