Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update repository #30

Merged
merged 10 commits into from
Oct 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8

[*.js]
indent_style = space
indent_size = 2

[{package.json,*.yml,*.cjson}]
indent_style = space
indent_size = 2
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
node_modules
coverage
dist
4 changes: 1 addition & 3 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{
"extends": [
"@nuxtjs/eslint-config-typescript"
]
"extends": ["eslint-config-unjs"]
}
Empty file removed .github/ISSUE_TEMPLATE.md
Empty file.
47 changes: 14 additions & 33 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,24 @@ name: ci
on:
push:
branches:
- master
- main
pull_request:
branches:
- master
- main

jobs:
ci:
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [ubuntu-latest]
node: [12]

runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}

- name: checkout
uses: actions/checkout@master

- name: cache node_modules
uses: actions/cache@v1
- uses: actions/checkout@v4
- run: corepack enable
- uses: actions/setup-node@v4
with:
path: node_modules
key: ${{ matrix.os }}-node-v${{ matrix.node }}-deps-${{ hashFiles(format('{0}{1}', github.workspace, '/yarn.lock')) }}

- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: yarn

- name: Lint
run: yarn lint

- name: Test
run: yarn jest -i

- name: Coverage
uses: codecov/codecov-action@v1
node-version: 18
cache: "pnpm"
- run: pnpm install
- run: pnpm lint
- run: pnpm test:types
- run: pnpm build
- run: pnpm vitest --coverage
- uses: codecov/codecov-action@v2
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
node_modules
coverage
dist
types
.vscode
.DS_Store
.eslintcache
*.log*
coverage
*.conf*
*.env*
1 change: 1 addition & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
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) Pooya Parsa <[email protected]>

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.
73 changes: 45 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,46 @@
# theme-colors

> Easily generate color shades for themes
[![npm version][npm-version-src]][npm-version-href]
[![npm downloads][npm-downloads-src]][npm-downloads-href]
[![bundle][bundle-src]][bundle-href]
[![Codecov][codecov-src]][codecov-href]

[![npm version][npm-v-src]][npm-v-href]
[![npm downloads][npm-dm-src]][npm-dm-href]
[![codecov][codecov-src]][codecov-href]
[![package phobia][packagephobia-src]][packagephobia-href]
[![bundle phobia][bundlephobia-src]][bundlephobia-href]
Easily generate color shades for themes

Install:
## Usage

```bash
Install package:

```sh
# npm
npm install theme-colors

# yarn
yarn add theme-colors

# or
# pnpm
pnpm install theme-colors

npm i theme-colors
# bun
bun install theme-colors
```

Usage:
Import:

```js
import { getColors } from 'theme-colors'
// ESM
import { getColors } from "theme-colors";

const theme = getColors('#ABABAB')
// CommonJS
const { getColors } = require("theme-colors");

// Using rgb
const theme = getColors('172,172,172')
const theme = getColors("#ABABAB");
// Or using RGB
const theme = getColors("172,172,172");
```

This will generate the following shades:

```js
{
50: '#FBFBFB',
Expand All @@ -44,24 +56,29 @@ const theme = getColors('172,172,172')
}
```

## License
## Development

Inspired by [javisperez/tailwindcolorshades](https://github.com/javisperez/tailwindcolorshades)
- Clone this repository
- Install latest LTS version of [Node.js](https://nodejs.org/en/)
- Enable [Corepack](https://github.com/nodejs/corepack) using `corepack enable`
- Install dependencies using `pnpm install`
- Run interactive tests using `pnpm dev`

MIT. Made with πŸ’–
## License

<!-- Refs -->
[npm-v-src]: https://flat.badgen.net/npm/v/theme-colors/latest
[npm-v-href]: https://npmjs.com/package/theme-colors
Inspired by [javisperez/tailwindcolorshades](https://github.com/javisperez/tailwindcolorshades)

[npm-dm-src]: https://flat.badgen.net/npm/dm/theme-colors
[npm-dm-href]: https://npmjs.com/package/theme-colors
Made with πŸ’›

[packagephobia-src]: https://flat.badgen.net/packagephobia/install/theme-colors
[packagephobia-href]: https://packagephobia.now.sh/result?p=theme-colors
Published under [MIT License](./LICENSE).

[bundlephobia-src]: https://flat.badgen.net/bundlephobia/min/theme-colors
[bundlephobia-href]: https://bundlephobia.com/result?p=theme-colors
<!-- Badges -->

[codecov-src]: https://flat.badgen.net/codecov/c/github/unjs/theme-colors/master
[npm-version-src]: https://img.shields.io/npm/v/theme-colors?style=flat&colorA=18181B&colorB=F0DB4F
[npm-version-href]: https://npmjs.com/package/theme-colors
[npm-downloads-src]: https://img.shields.io/npm/dm/theme-colors?style=flat&colorA=18181B&colorB=F0DB4F
[npm-downloads-href]: https://npmjs.com/package/theme-colors
[codecov-src]: https://img.shields.io/codecov/c/gh/unjs/theme-colors/main?style=flat&colorA=18181B&colorB=F0DB4F
[codecov-href]: https://codecov.io/gh/unjs/theme-colors
[bundle-src]: https://img.shields.io/bundlephobia/minzip/theme-colors?style=flat&colorA=18181B&colorB=F0DB4F
[bundle-href]: https://bundlephobia.com/result?p=theme-colors
5 changes: 0 additions & 5 deletions jest.config.js

This file was deleted.

45 changes: 31 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,34 +1,51 @@
{
"name": "theme-colors",
"version": "0.0.5",
"description": "easily generate color shades for themes",
"description": "Easily generate color shades for themes",
"keywords": [
"theme",
"colors",
"shades",
"tailwind",
"tailwindcss"
],
"repository": "nuxt-contrib/theme-colors",
"repository": "unjs/theme-colors",
"license": "MIT",
"main": "dist/index.js",
"sideEffects": false,
"type": "module",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/index.cjs"
}
},
"main": "dist/index.cjs",
"module": "./dist/index.mjs",
"types": "dist/index.d.ts",
"files": [
"dist"
],
"scripts": {
"build": "tsc",
"lint": "eslint --ext .ts .",
"release": "yarn test && yarn build && standard-version && git push --follow-tags && npm publish",
"test": "yarn lint && jest"
"build": "unbuild",
"dev": "vitest dev",
"lint": "eslint --cache --ext .ts,.js,.mjs,.cjs . && prettier -c src test",
"lint:fix": "eslint --cache --ext .ts,.js,.mjs,.cjs . --fix && prettier -c src test -w",
"prepack": "pnpm run build",
"release": "pnpm test && changelogen --release && npm publish && git push --follow-tags",
"test": "pnpm lint && pnpm test:types && vitest run --coverage",
"test:types": "tsc --noEmit --skipLibCheck"
},
"devDependencies": {
"@nuxtjs/eslint-config-typescript": "^3.0.0",
"eslint": "^7.9.0",
"jest": "^26.4.2",
"standard-version": "^9.0.0",
"ts-jest": "^26.4.0",
"tsc": "^1.20150623.0",
"typescript": "^4.0.3"
"@types/node": "^20.8.9",
"@vitest/coverage-v8": "^0.34.6",
"changelogen": "^0.5.5",
"eslint": "^8.52.0",
"eslint-config-unjs": "^0.2.1",
"jiti": "^1.20.0",
"prettier": "^3.0.3",
"typescript": "^5.2.2",
"unbuild": "^2.0.0",
"vitest": "^0.34.6"
}
}
Loading
Loading