Skip to content

Commit

Permalink
feat: refactor with TypeScript
Browse files Browse the repository at this point in the history
BREAKING CHANGE: drop Node.js < 14 support

eggjs/egg#5257
  • Loading branch information
fengmk2 committed Dec 12, 2024
1 parent d9cdffe commit 5b89f78
Show file tree
Hide file tree
Showing 22 changed files with 250 additions and 311 deletions.
13 changes: 0 additions & 13 deletions .editorconfig

This file was deleted.

6 changes: 6 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": [
"eslint-config-egg/typescript",
"eslint-config-egg/lib/rules/enforce-node-prefix"
]
}
20 changes: 20 additions & 0 deletions .github/workflows/nodejs-14.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Node.js 14 CI

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: irby/setup-node-nvm@master
with:
node-version: '16.x'
- run: npm install
- run: . /home/runner/mynvm/nvm.sh && nvm install 14 && nvm use 14 && node -v && npm run test-local
15 changes: 15 additions & 0 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: CI

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
Job:
name: Node.js
uses: node-modules/github-actions/.github/workflows/node-test.yml@master
with:
os: 'ubuntu-latest'
version: '16, 18, 18, 20, 22'
23 changes: 23 additions & 0 deletions .github/workflows/pkg.pr.new.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Publish Any Commit
on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- run: corepack enable
- uses: actions/setup-node@v4
with:
node-version: 20

- name: Install dependencies
run: npm install

- name: Build
run: npm run prepublishOnly

- run: npx pkg-pr-new publish
13 changes: 13 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Release

on:
push:
branches: [ master ]

jobs:
release:
name: Node.js
uses: node-modules/github-actions/.github/workflows/node-release.yml@master
secrets:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GIT_TOKEN: ${{ secrets.GIT_TOKEN }}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,7 @@ node_modules

dump.rdb
.DS_Store
package-lock.json
.tshy*
.eslintcache
dist
3 changes: 0 additions & 3 deletions .jshintignore

This file was deleted.

95 changes: 0 additions & 95 deletions .jshintrc

This file was deleted.

8 changes: 0 additions & 8 deletions .travis.yml

This file was deleted.

File renamed without changes.
5 changes: 5 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
MIT License

Copyright(c) 2011 - 2017 dead-horse and other contributors.
Copyright(c) 2024 - present node-modules and other contributors.

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
Expand Down
43 changes: 0 additions & 43 deletions Makefile

This file was deleted.

41 changes: 22 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,43 @@
humanize-ms
---------------
# humanize-ms

[![NPM version][npm-image]][npm-url]
[![build status][travis-image]][travis-url]
[![Test coverage][coveralls-image]][coveralls-url]
[![Gittip][gittip-image]][gittip-url]
[![David deps][david-image]][david-url]
[![Node.js CI](https://github.com/node-modules/humanize-ms/actions/workflows/nodejs.yml/badge.svg)](https://github.com/node-modules/humanize-ms/actions/workflows/nodejs.yml)
[![Test coverage][codecov-image]][codecov-url]
[![Known Vulnerabilities][snyk-image]][snyk-url]
[![npm download][download-image]][download-url]

[npm-image]: https://img.shields.io/npm/v/humanize-ms.svg?style=flat
[npm-image]: https://img.shields.io/npm/v/humanize-ms.svg?style=flat-square
[npm-url]: https://npmjs.org/package/humanize-ms
[travis-image]: https://img.shields.io/travis/node-modules/humanize-ms.svg?style=flat
[travis-url]: https://travis-ci.org/node-modules/humanize-ms
[coveralls-image]: https://img.shields.io/coveralls/node-modules/humanize-ms.svg?style=flat
[coveralls-url]: https://coveralls.io/r/node-modules/humanize-ms?branch=master
[gittip-image]: https://img.shields.io/gittip/dead-horse.svg?style=flat
[gittip-url]: https://www.gittip.com/dead-horse/
[david-image]: https://img.shields.io/david/node-modules/humanize-ms.svg?style=flat
[david-url]: https://david-dm.org/node-modules/humanize-ms
[codecov-image]: https://codecov.io/gh/node-modules/humanize-ms/branch/master/graph/badge.svg
[codecov-url]: https://codecov.io/gh/node-modules/humanize-ms
[snyk-image]: https://snyk.io/test/npm/humanize-ms/badge.svg?style=flat-square
[snyk-url]: https://snyk.io/test/npm/humanize-ms
[download-image]: https://img.shields.io/npm/dm/humanize-ms.svg?style=flat-square
[download-url]: https://npmjs.org/package/humanize-ms

transform humanize time to ms

## Installation

```bash
$ npm install humanize-ms
npm install humanize-ms
```

## Examples

```js
var ms = require('humanize-ms');
```typescript
import { ms } from 'humanize-ms';

ms('1s') // 1000
ms(1000) // 1000
```

### License

MIT
[MIT](LICENSE)

## Contributors

[![Contributors](https://contrib.rocks/image?repo=node-modules/humanize-ms)](https://github.com/node-modules/humanize-ms/graphs/contributors)

Made with [contributors-img](https://contrib.rocks).
24 changes: 0 additions & 24 deletions index.js

This file was deleted.

Loading

0 comments on commit 5b89f78

Please sign in to comment.