Skip to content

Commit

Permalink
feat[v1]: first version
Browse files Browse the repository at this point in the history
  • Loading branch information
sylvainmouquet committed Sep 24, 2024
0 parents commit 6304108
Show file tree
Hide file tree
Showing 13 changed files with 2,335 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"env": {
"browser": true,
"es2021": true
},
"overrides": [
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": [
"@typescript-eslint"
],
"rules": {
}
}
27 changes: 27 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Release

on:
push:
tags:
- '*'

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org'
- run: rm package-lock.json
- run: npm install
- run: npm run build
- run: npm test
- name: Extract version from tag
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- run: npm version $VERSION --no-git-tag-version
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
23 changes: 23 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Run Tests

on:
push:
branches:
- '*'
pull_request:
branches:
- '*'
workflow_dispatch:

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- run: rm package-lock.json
- run: npm install
- run: npm test
19 changes: 19 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# IDE files
.idea/

# Build output
dist/

# Dependencies
node_modules/

# Logs
*.log

# Environment variables
.env
.env.local

# OS generated files
.DS_Store
Thumbs.db
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) 2024 TWindMerge

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.
36 changes: 36 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Git workflow commands
wip:
git add .
git commit -m "WIP: Work in progress"
git push

# Install command
install:
npm install

# Build command
build:
npm run build

# Deploy command
deploy:
npm run deploy

# Test command
test:
npm run test

# Lint command
lint:
npm run lint

# Display all available commands
help:
@echo "Available commands:"
@echo " wip - Commit and push work in progress"
@echo " install - Install dependencies"
@echo " build - Build the project"
@echo " deploy - Deploy the project"
@echo " test - Run tests"
@echo " lint - Run linter"
@echo " help - Display this help message"
55 changes: 55 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# TWindMerge

TWindMerge is a utility for merging Tailwind CSS classes, keeping only the latest class when conflicts occur.

### Demonstration:


```typescript
merge("text-gray-100 text-gray-50")
-> "text-gray-50"
merge(clsx("text-gray-100", "text-gray-50"))
-> "text-gray-50"
```

## Table of Contents

- [TWindMerge](#TWindMerge)
- [Table of Contents](#table-of-contents)
- [Description](#description)
- [Installation](#installation)
- [Usage](#usage)
- [License](#license)
- [Contact](#contact)

## Description

TWindMerge provides a powerful solution for managing Tailwind CSS classes in dynamic environments.
By keeping only the latest conflicting class, TWindMerge ensures that your styles are applied as intended, reducing unexpected visual outcomes and improving the maintainability of your codebase.


## Installation

```bash
# Install the dependency
npm install --save twindmerge

```

## Usage

```bash
# Import and call the merge function
import {merge} from 'twindmerge'
<div className={merge("bg-red-200 bg-green-200")}></div>
```


## License

TWindMerge is released under the MIT License. See the [LICENSE](LICENSE) file for more details.

## Contact

For questions, suggestions, or issues related to TWindMerge, please open an issue on the GitHub repository.

Loading

0 comments on commit 6304108

Please sign in to comment.