Skip to content

Commit

Permalink
🎉 open source
Browse files Browse the repository at this point in the history
  • Loading branch information
levy committed Jul 29, 2019
0 parents commit 5c38a88
Show file tree
Hide file tree
Showing 26 changed files with 11,158 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"projectName": "count-down",
"projectOwner": "FEMessage",
"repoType": "github",
"repoHost": "https://github.com",
"files": [
"README.md"
],
"imageSize": 100,
"commit": false,
"commitConvention": "angular",
"contributors": [
{
"login": "donaldshen",
"name": "Donald Shen",
"avatar_url": "https://avatars3.githubusercontent.com/u/19591950?v=4",
"profile": "https://donaldshen.github.io/portfolio",
"contributions": [
"code",
"doc",
"test"
]
}
],
"contributorsPerLine": 7
}
13 changes: 13 additions & 0 deletions .babelrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module.exports = api => {
return {
presets: [['@babel/env', {modules: api.env('test') ? 'commonjs' : false}]],
plugins: [
[
'@babel/transform-runtime',
{
regenerator: true,
}
]
]
}
}
14 changes: 14 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# editorconfig.org
root = true

[*]
charset = utf-8
end_of_line = lf
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
insert_final_newline = false
trim_trailing_whitespace = false
10 changes: 10 additions & 0 deletions .github/badge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
types:
feat: 'enhancement'
fix: 'bug'
docs: 'documentation'
refactor: 'refactor'
test: 'test'
perf: 'performance'
chore:
deps: 'dependencies'
default: 'chore'
19 changes: 19 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
.DS_Store
node_modules/
npm-debug.log*
yarn-debug.log*
yarn-error.log*
dist
docs/build
docs/index.html
docs/*.woff
docs/*.ttf

# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
.env
30 changes: 30 additions & 0 deletions .grenrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
module.exports = {
dataSource: 'prs',
prefix: '',
ignoreLabels: ['duplicate', 'help wanted', 'invalid', 'question', 'wontfix'],
ignoreIssuesWith: [
'duplicate',
'help wanted',
'invalid',
'question',
'wontfix'
],
onlyMilestones: false,
changelogFilename: 'CHANGELOG.md',
template: {
issue: '- {{name}} [{{text}}]({{url}})',
group: "\n### {{heading}}\n"
},
// https://github.com/nuxt/nuxt.js/releases
// https://gitmoji.carloscuesta.me
groupBy: {
'✨ New Features:': ['enhancement'],
'🐛 Bug Fixes:': ['bug'],
'📖 Documentation:': ['documentation'],
'💅 Refactors:': ['refactor'],
'♻️ Tests:': ['test'],
'🚀 Performance:': ['performance'],
'⚓ Dependency upgrades:': ['dependencies'],
'🏡 Chore:': ['chore']
}
}
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
docs
dist
3 changes: 3 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
semi: false
singleQuote: true
bracketSpacing: false
27 changes: 27 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
branches:
only:
- master
language: node_js
node_js:
- lts/*
git:
depth: 3
install:
- yarn --frozen-lockfile
script:
- ./build.sh
after_success:
- GREN_GITHUB_TOKEN=$GITHUB_TOKEN yarn release
after_script:
- ./notify.sh
cache: yarn
deploy:
- provider: pages
local-dir: docs
github-token: $GITHUB_TOKEN
skip-cleanup: true
keep-history: true
- provider: npm
email: levy9527@qq.com
api_key: $NPM_TOKEN
skip-cleanup: true
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) 2019 FEMessage

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.
83 changes: 83 additions & 0 deletions README-zh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# count-down

[![Build Status](https://travis-ci.com/FEMessage/count-down.svg?branch=master)](https://travis-ci.com/FEMessage/count-down)
[![NPM Download](https://img.shields.io/npm/dm/@femessage/count-down.svg)](https://www.npmjs.com/package/@femessage/count-down)
[![NPM Version](https://img.shields.io/npm/v/@femessage/count-down.svg)](https://www.npmjs.com/package/@femessage/count-down)
[![NPM License](https://img.shields.io/npm/l/@femessage/count-down.svg)](https://github.com/FEMessage/count-down/blob/master/LICENSE)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/FEMessage/count-down/pulls)
[![Automated Release Notes by gren](https://img.shields.io/badge/%F0%9F%A4%96-release%20notes-00B2EE.svg)](https://github-tools.github.io/github-release-notes/)

极易使用的倒计时组件 😃

![示例](https://cdn.nlark.com/yuque/0/2019/gif/304775/1564112303450-9cbd89cf-c170-4ffe-a905-5890b9948858.gif)

## Table of Contents

* [Introduction](#introduction)
* [Use requestAnimationFrame](#use-requestanimationframe)
* [支持毫秒级计时](#支持毫秒级计时)
* [智能的默认 format](#智能的默认-format)
* [Links](#links)
* [Install](#install)
* [Inspiration](#inspiration)
* [Contributors](#contributors)
* [License](#license)

## Introduction

### Use requestAnimationFrame

count-down 内部使用 requestAnimationFrame 计时,无论是浏览器进程任务繁忙亦或是页面在后台被挂起过,count-down 都依然能保持精确。

### 支持毫秒级计时

通过 slot 支持

### 智能的默认 format

默认 format 会根据传入的 days, hours, minutes, seconds 动态调整。比如传入 hours=1 时,默认 format 就是 `hh 时 mm 分 ss 秒`

[⬆ Back to Top](#table-of-contents)

## Links

* [API文档](https://femessage.github.io/count-down/)

[⬆ Back to Top](#table-of-contents)

## Install

```sh
yarn add @femessage/count-down
```

[⬆ Back to Top](#table-of-contents)

## Inspiration

api 设计和实现参考了

* [taro-ui](https://taro-ui.aotu.io/#/docs/countdown)
* [vant](https://youzan.github.io/vant/#/zh-CN/count-down)

[⬆ Back to Top](#table-of-contents)

## Contributors

Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<table><tr><td align="center"><a href="https://donaldshen.github.io/portfolio"><img src="https://avatars3.githubusercontent.com/u/19591950?v=4" width="100px;" alt="Donald Shen"/><br /><sub><b>Donald Shen</b></sub></a><br /><a href="https://github.com/FEMessage/count-down/commits?author=donaldshen" title="Code">💻</a> <a href="https://github.com/FEMessage/count-down/commits?author=donaldshen" title="Documentation">📖</a> <a href="https://github.com/FEMessage/count-down/commits?author=donaldshen" title="Tests">⚠️</a></td></tr></table>

<!-- prettier-ignore -->
<!-- ALL-CONTRIBUTORS-LIST:END -->

This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!

[⬆ Back to Top](#table-of-contents)

## License

[MIT](./LICENSE)

[⬆ Back to Top](#table-of-contents)
85 changes: 85 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# count-down

[![Build Status](https://travis-ci.com/FEMessage/count-down.svg?branch=master)](https://travis-ci.com/FEMessage/count-down)
[![NPM Download](https://img.shields.io/npm/dm/@femessage/count-down.svg)](https://www.npmjs.com/package/@femessage/count-down)
[![NPM Version](https://img.shields.io/npm/v/@femessage/count-down.svg)](https://www.npmjs.com/package/@femessage/count-down)
[![NPM License](https://img.shields.io/npm/l/@femessage/count-down.svg)](https://github.com/FEMessage/count-down/blob/master/LICENSE)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/FEMessage/count-down/pulls)
[![Automated Release Notes by gren](https://img.shields.io/badge/%F0%9F%A4%96-release%20notes-00B2EE.svg)](https://github-tools.github.io/github-release-notes/)

A user friendly vue count-down component 😃

![demo](https://cdn.nlark.com/yuque/0/2019/gif/304775/1564112303450-9cbd89cf-c170-4ffe-a905-5890b9948858.gif)

[中文文档](./README-zh.md)

## Table of Contents

* [Introduction](#introduction)
* [Use requestAnimationFrame](#use-requestanimationframe)
* [Millisecond](#millisecond)
* [Smart default format](#smart-default-format)
* [Links](#links)
* [Install](#install)
* [Inspiration](#inspiration)
* [Contributors](#contributors)
* [License](#license)

## Introduction

### Use requestAnimationFrame

The `count-down` use `requestAnimationFrame` inside, so it can handle any browser situation whether is busy or not, and still works.

### Millisecond

Use slot to get milliseconds in countdown

### Smart default format

The default format will adjust by the props which are days, hours, minutes & seconds. e.g., when hours=1, the default format will be `hh 时 mm 分 ss 秒`

[⬆ Back to Top](#table-of-contents)

## Links

* [docs](https://femessage.github.io/count-down/)

[⬆ Back to Top](#table-of-contents)

## Install

```sh
yarn add @femessage/count-down
```

[⬆ Back to Top](#table-of-contents)

## Inspiration

The api & implementation designs are inspired by

* [taro-ui](https://taro-ui.aotu.io/#/docs/countdown)
* [vant](https://youzan.github.io/vant/#/zh-CN/count-down)

[⬆ Back to Top](#table-of-contents)

## Contributors

Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore -->
<table><tr><td align="center"><a href="https://donaldshen.github.io/portfolio"><img src="https://avatars3.githubusercontent.com/u/19591950?v=4" width="100px;" alt="Donald Shen"/><br /><sub><b>Donald Shen</b></sub></a><br /><a href="https://github.com/FEMessage/count-down/commits?author=donaldshen" title="Code">💻</a> <a href="https://github.com/FEMessage/count-down/commits?author=donaldshen" title="Documentation">📖</a> <a href="https://github.com/FEMessage/count-down/commits?author=donaldshen" title="Tests">⚠️</a></td></tr></table>

<!-- ALL-CONTRIBUTORS-LIST:END -->

This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!

[⬆ Back to Top](#table-of-contents)

## License

[MIT](./LICENSE)

[⬆ Back to Top](#table-of-contents)
7 changes: 7 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh
yarn stdver

yarn build

git remote add github https://$GITHUB_TOKEN@github.com/FEMessage/count-down.git > /dev/null 2>&1
git push github HEAD:master --follow-tags
34 changes: 34 additions & 0 deletions build/rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// rollup.config.js
import vue from 'rollup-plugin-vue'
import babel from 'rollup-plugin-babel'
import commonjs from 'rollup-plugin-commonjs'
import {terser} from 'rollup-plugin-terser'
import minimist from 'minimist'

const argv = minimist(process.argv.slice(2))

const config = {
input: 'src/index.js',
output: {
name: 'CountDown',
exports: 'named'
},
plugins: [
commonjs(),
vue({
css: true,
compileTemplate: true
}),
babel({
runtimeHelpers: true,
exclude: 'node_modules/**'
})
]
}

// Only minify browser (iife) version
if (argv.format === 'iife') {
config.plugins.push(terser())
}

export default config
5 changes: 5 additions & 0 deletions docs/basic.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
```vue
<template>
<count-down :seconds="59" :hours="1" />
</template>
```
Loading

0 comments on commit 5c38a88

Please sign in to comment.