Skip to content

Commit

Permalink
feat: rewrite whole project (#10)
Browse files Browse the repository at this point in the history
* feat: rewrite whole project

* fix: fix Bun version

* ci: add the ability to manually run tests

* feat: add lint-staged scripts (#1)

* fix: fix husky prepare script

* fix: fix pre-push

* fix: fix pre-push

* fix: update pre-push

* feat: add file associations for `.snap` files

* test: ⚡ optimize tests

---------

Co-authored-by: Okinea Dev <[email protected]>
  • Loading branch information
okineadev and okineadev authored Dec 9, 2024
1 parent 2ea7bbe commit 7910446
Show file tree
Hide file tree
Showing 27 changed files with 653 additions and 231 deletions.
1 change: 1 addition & 0 deletions .bun-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.1.38
16 changes: 0 additions & 16 deletions .circleci/config.yml

This file was deleted.

54 changes: 54 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: 🚀 Release + Publish

on:
workflow_dispatch:

permissions:
id-token: write
contents: write

jobs:
release:
runs-on: ubuntu-latest

permissions:
contents: write
id-token: write
attestations: write

steps:
- name: 📥 Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
# Required for fetching tags and generating release notes
fetch-depth: 0

- name: 🔧 Setup Bun
uses: oven-sh/setup-bun@4bc047ad259df6fc24a6c9b0f9a0cb08cf17fbe5 # v2
with:
bun-version-file: ".bun-version"

- name: 📦 Install dependencies
run: bun install --frozen-lockfile

- name: 🔧 Configure Git
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
git config --global push.followTags true
- name: 🚀 Prepare release
run: bun run preversion

- name: 📜 Generate changelog and release notes
run: |
bunx changelogen --release --push
bunx changelogen github release --token ${{ secrets.GITHUB_TOKEN }}
- name: 🛠️ Build package
run: bun run build

- name: 📦 Publish to NPM Registry
run: |
bunx npm set "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}"
bunx npm publish --provenance --access public
32 changes: 32 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: 🧪 Tests

on:
# https://blog.esciencecenter.nl/reduce-reuse-recycle-save-the-planet-one-github-action-at-a-time-4ab602255c3f
push:
paths:
- src/*

pull_request:
paths:
- src/*

workflow_dispatch:

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: 📥 Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: 🔧 Setup Bun
uses: oven-sh/setup-bun@4bc047ad259df6fc24a6c9b0f9a0cb08cf17fbe5 # v2
with:
bun-version-file: ".bun-version"

- name: 📦 Install dependencies
run: bun install --frozen-lockfile

- name: 🧪 Run tests
run: bun test
80 changes: 76 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,77 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local

.cache
out
dist
node_modules
.DS_Store
.npmignore
yarn.lock

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

.DS_Store
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bunx lint-staged
1 change: 1 addition & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
FORCE_COLOR=true bun run test
2 changes: 2 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!dist/*
1 change: 0 additions & 1 deletion .npmrc

This file was deleted.

6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"editor.defaultFormatter": "biomejs.biome",
"files.associations": {
"*.snap": "javascript"
}
}
File renamed without changes.
49 changes: 28 additions & 21 deletions readme.md → README.md
Original file line number Diff line number Diff line change
@@ -1,74 +1,81 @@
# ink-divider

[![CircleCI](https://circleci.com/gh/JureSotosek/ink-divider.svg?style=svg)](https://circleci.com/gh/JureSotosek/ink-divider)

👩🏼‍🎨 Divider component for [Ink](https://github.com/vadimdemedes/ink).

## Install

```
$ npm install ink-divider
```bash
npm i ink-divider
```

## Usage

```js
import React from 'react';
import {render} from 'ink';
import Divider from 'ink-divider';
```jsx
import { render } from 'ink'
import Divider from 'ink-divider'

render(<Divider title='Title' />)

render(<Divider title={'Title'} />);
// ─────────── Title ───────────
```

<img src="media/example.png" width="720">
<!-- markdownlint-disable-next-line-->
<img src="media/example.png" alt="example" width="720">

## Props

### title

Type: `string`<br>
Default: `""`
Type: `string`

Default: `null`

Title shown in the middle of the divider.

### width

Type: `number`<br>
Default: `50`
Type: `'auto' | number`

Default: `auto`

Width of the divider.

### padding

Type: `number`<br>
Default: `1`
Type: `number`

Default: `0`

Padding at the start and the end of the divider.

### titlePadding

Type: `number`<br>
Type: `number`

Default: `1`

Padding besides the title in the middle.

### titleColor

Type: `string`<br>
Type: `string`

Default: `"white"`

Color of the title.

### dividerChar

Type: `string`<br>
Default: `"-"`
Type: `string`

Default: `"─"`

Char used as a divider.

### dividerColor

Type: `string`<br>
Type: `string`

Default: `"gray"`

Color of the divider chars.
Expand Down
29 changes: 29 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
"files": {
"ignore": ["*.snap"]
},
"formatter": {
"enabled": true,
"useEditorconfig": true,
"formatWithErrors": false,
"indentStyle": "tab",
"indentWidth": 2,
"lineEnding": "lf",
"lineWidth": 80,
"attributePosition": "auto",
"bracketSpacing": true
},
"javascript": {
"formatter": {
"jsxQuoteStyle": "single",
"quoteProperties": "asNeeded",
"trailingCommas": "es5",
"semicolons": "asNeeded",
"arrowParentheses": "always",
"bracketSameLine": false,
"quoteStyle": "single",
"attributePosition": "auto"
}
}
}
Binary file added bun.lockb
Binary file not shown.
9 changes: 0 additions & 9 deletions examples/advanced.js

This file was deleted.

8 changes: 8 additions & 0 deletions examples/advanced.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { render } from 'ink'
import Divider from '../src'

const Advanced = () => (
<Divider title='Title' dividerChar='!' dividerColor='red' />
)

render(<Advanced />)
9 changes: 0 additions & 9 deletions examples/basic.js

This file was deleted.

6 changes: 6 additions & 0 deletions examples/basic.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { render } from 'ink'
import Divider from '../src'

const Basic = () => <Divider title='Title' />

render(<Basic />)
Loading

0 comments on commit 7910446

Please sign in to comment.