Skip to content
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
File renamed without changes.
72 changes: 21 additions & 51 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,63 +3,33 @@ name: CI
on: [push]

jobs:
install:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1

- name: Cache node modules
uses: actions/cache@v1
with:
path: node_modules
key: ${{ runner.OS }}-build-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.OS }}-build-${{ env.cache-name }}-
${{ runner.OS }}-build-
${{ runner.OS }}-

- name: Install packages
run: yarn

lint:
needs: install
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: '24'
- run: corepack enable

- name: Cache node modules
uses: actions/cache@v1
with:
path: node_modules
key: ${{ runner.OS }}-build-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.OS }}-build-${{ env.cache-name }}-
${{ runner.OS }}-build-
${{ runner.OS }}-
- name: Install packages
run: yarn

- name: Run Linter
run: yarn lint
- name: Run Linter
run: yarn lint

unit-test:
needs: install
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1

- name: Cache node modules
uses: actions/cache@v1
with:
path: node_modules
key: ${{ runner.OS }}-build-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.OS }}-build-${{ env.cache-name }}-
${{ runner.OS }}-build-
${{ runner.OS }}-

- name: Run tests
env:
CI: true
run: yarn test
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: '24'
- run: corepack enable
- name: Install packages
run: yarn

- name: Run tests
env:
CI: true
run: yarn test
28 changes: 28 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Publish Docs

on:
push:
branches:
- main

jobs:
publish-to-surge:
name: Publish docs to react-and.surge.sh
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: '24'
- run: corepack enable
- name: Install packages
run: yarn
- name: Build
run: yarn build:docs
- name: Deploy to react-and.surge.sh
uses: dswistowski/surge-sh-action@v1
with:
domain: 'react-and.surge.sh'
project: './docs'
login: ${{ secrets.SURGE_LOGIN }}
token: ${{ secrets.SURGE_TOKEN }}
7 changes: 4 additions & 3 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v6
# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v1
- uses: actions/setup-node@v6
with:
node-version: '12.x'
node-version: '24.x'
registry-url: 'https://registry.npmjs.org'
- run: corepack enable
- run: yarn install
- run: npm publish
env:
Expand Down
34 changes: 0 additions & 34 deletions .github/workflows/storybook.yml

This file was deleted.

9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,12 @@ package-lock.json

# Parcel
.parcel-cache

# Yarn
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
7 changes: 0 additions & 7 deletions .storybook/main.js

This file was deleted.

1 change: 1 addition & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: node-modules
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Renders as:

### `oxfordComma`

Determinses whether an [Oxford comma](https://en.wikipedia.org/wiki/Serial_comma) will be used when joining the items. Default: `true`.
Determines whether an [Oxford comma](https://en.wikipedia.org/wiki/Serial_comma) will be used when joining the items. Default: `true`.

```JSX
<ReactAnd oxfordComma={false}>
Expand Down
14 changes: 0 additions & 14 deletions config/jest.config.js

This file was deleted.

26 changes: 26 additions & 0 deletions config/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { defineConfig } from 'vite';

export default defineConfig({
build: {
lib: {
entry: './src/index.tsx',
name: 'ReactAnd',
// the proper extensions will be added
fileName: 'react-and',
formats: ['es'],
},
rollupOptions: {
// make sure to externalize deps that shouldn't be bundled
// into your library
external: ['react', 'react-dom'],
output: {
// Provide global variables to use in the UMD build
// for externalized deps
globals: {
react: 'React',
'react-dom': 'ReactDOM',
},
},
},
},
});
9 changes: 9 additions & 0 deletions config/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// eslint-disable-next-line import/no-unresolved
import { defineConfig } from 'vitest/config';

export default defineConfig({
test: {
globals: true,
environment: 'jsdom',
},
});
10 changes: 4 additions & 6 deletions dist/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import React from "react";
interface IProps {
import React from 'react';
type ReactAndProps = {
children?: React.ReactNode;
conjuction?: string;
oxfordComma?: boolean;
}
declare const ReactAnd: ({ children, conjuction, oxfordComma }: IProps) => JSX.Element;
};
declare const ReactAnd: ({ children, conjuction, oxfordComma }: ReactAndProps) => JSX.Element;
export default ReactAnd;

//# sourceMappingURL=index.d.ts.map
1 change: 0 additions & 1 deletion dist/index.d.ts.map

This file was deleted.

47 changes: 0 additions & 47 deletions dist/index.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/index.js.map

This file was deleted.

19 changes: 19 additions & 0 deletions dist/react-and.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import e from "react";
const l = ({ children: t, conjuction: a = "and", oxfordComma: r = !0 }) => {
if (!t)
return /* @__PURE__ */ e.createElement(e.Fragment, null);
if (!Array.isArray(t) || t.length === 1)
return /* @__PURE__ */ e.createElement(e.Fragment, null, t);
if (t.length === 2)
return /* @__PURE__ */ e.createElement(e.Fragment, null, [t[t.length - 2], ` ${a} `, t[t.length - 1]]);
const m = t.slice(0, t.length - 2).reduce((g, n) => [...g, n, ", "], []);
return /* @__PURE__ */ e.createElement(e.Fragment, null, [
...m,
t[t.length - 2],
r ? `, ${a} ` : ` ${a} `,
t[t.length - 1]
]);
};
export {
l as default
};
16 changes: 16 additions & 0 deletions docs/assets/index-Dsr-r1mW.js

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions docs/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<html>

<head>
<title>react-and</title>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/water.css@2/out/water.css">

<script type="module" crossorigin src="/assets/index-Dsr-r1mW.js"></script>
</head>

<body>
<main id="app"></main>
</body>
</html>
16 changes: 16 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<html>

<head>
<title>react-and</title>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/water.css@2/out/water.css">

<script type="module" src="/src/examples.tsx"></script>
</head>

<body>
<main id="app"></main>
</body>
</html>
2 changes: 2 additions & 0 deletions mise.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[tools]
node = "24"
Loading