Skip to content

Commit 874f425

Browse files
Rafael CRafael C
authored andcommitted
migrate npm into @
1 parent 220e3d1 commit 874f425

5 files changed

Lines changed: 108 additions & 15215 deletions

File tree

.github/workflows/publish-npm.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Publish package to npm
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
12+
concurrency:
13+
group: npm-publish-${{ github.ref }}
14+
cancel-in-progress: false
15+
16+
jobs:
17+
publish:
18+
runs-on: ubuntu-latest
19+
20+
# Only publish from this repository (prevents accidental runs in forks)
21+
if: github.repository == 'rcaferati/react-awesome-button'
22+
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v4
26+
27+
- name: Setup Node
28+
uses: actions/setup-node@v4
29+
with:
30+
node-version: 20
31+
registry-url: 'https://registry.npmjs.org'
32+
cache: npm
33+
34+
- name: Install dependencies
35+
run: npm ci
36+
37+
- name: Verify package identity
38+
run: |
39+
node -p "require('./package.json').name"
40+
node -p "require('./package.json').version"
41+
42+
- name: Run tests
43+
run: npm test -- --passWithNoTests
44+
45+
- name: Build package
46+
run: npm run build:all
47+
48+
- name: Verify tag matches package version
49+
if: startsWith(github.ref, 'refs/tags/')
50+
run: |
51+
TAG="${GITHUB_REF#refs/tags/}"
52+
PKG_VERSION="v$(node -p "require('./package.json').version")"
53+
echo "Git tag: $TAG"
54+
echo "Package version tag: $PKG_VERSION"
55+
if [ "$TAG" != "$PKG_VERSION" ]; then
56+
echo "Tag/version mismatch"
57+
exit 1
58+
fi
59+
60+
- name: Publish to npm (scoped public package)
61+
env:
62+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
63+
run: npm publish --access public

README.md

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# React `<AwesomeButton />` UI Components
22

3-
`react-awesome-button` provides three related button components:
3+
`@rcaferati/react-awesome-button` provides three related button components:
44

55
- **`AwesomeButton`** — animated base button
66
- **`AwesomeButtonProgress`** — progress flow wrapper on top of `AwesomeButton`
@@ -13,7 +13,7 @@ This README is updated for the current component patterns and prop behavior.
1313
## Installation
1414

1515
```bash
16-
npm install react-awesome-button
16+
npm install @rcaferati/react-awesome-button
1717
```
1818

1919
---
@@ -24,8 +24,8 @@ npm install react-awesome-button
2424

2525
```jsx
2626
import React from 'react';
27-
import { AwesomeButton } from 'react-awesome-button';
28-
import 'react-awesome-button/dist/styles.css';
27+
import { AwesomeButton } from '@rcaferati/react-awesome-button';
28+
import '@rcaferati/react-awesome-button/styles.css';
2929

3030
export default function Example() {
3131
return <AwesomeButton type="primary">Button</AwesomeButton>;
@@ -36,14 +36,14 @@ export default function Example() {
3636

3737
## Styling with Theme CSS Modules (Blue Theme)
3838

39-
If you want to use the package theme module object (for `cssModule`), import the blue theme and pass it to the component.
39+
If you want to use the package theme module object (for `cssModule`), import a built theme module and pass it to the component.
4040

4141
> Note: depending on your bundler/module interop, the imported theme may be on `.default`.
4242
4343
```jsx
4444
import React from 'react';
45-
import { AwesomeButton } from 'react-awesome-button';
46-
import themeBlue from 'react-awesome-button/src/styles/themes/theme-blue';
45+
import { AwesomeButton } from '@rcaferati/react-awesome-button';
46+
import themeBlue from '@rcaferati/react-awesome-button/themes/theme-blue';
4747

4848
const blueTheme = themeBlue?.default ?? themeBlue;
4949

@@ -66,8 +66,8 @@ If `href` is **not** provided, `AwesomeButton` renders a button-like element and
6666
6767
```jsx
6868
import React from 'react';
69-
import { AwesomeButton } from 'react-awesome-button';
70-
import themeBlue from 'react-awesome-button/src/styles/themes/theme-blue';
69+
import { AwesomeButton } from '@rcaferati/react-awesome-button';
70+
import themeBlue from '@rcaferati/react-awesome-button/themes/theme-blue';
7171

7272
const blueTheme = themeBlue?.default ?? themeBlue;
7373

@@ -91,8 +91,8 @@ If `href` is provided, it renders anchor-like behavior and lets native navigatio
9191
9292
```jsx
9393
import React from 'react';
94-
import { AwesomeButton } from 'react-awesome-button';
95-
import themeBlue from 'react-awesome-button/src/styles/themes/theme-blue';
94+
import { AwesomeButton } from '@rcaferati/react-awesome-button';
95+
import themeBlue from '@rcaferati/react-awesome-button/themes/theme-blue';
9696

9797
const blueTheme = themeBlue?.default ?? themeBlue;
9898

@@ -117,8 +117,8 @@ For **icon-only** buttons, pass the icon using `before` and omit children.
117117
```jsx
118118
import React from 'react';
119119
import { Play, ArrowRight, Sparkles } from 'lucide-react';
120-
import { AwesomeButton } from 'react-awesome-button';
121-
import themeBlue from 'react-awesome-button/src/styles/themes/theme-blue';
120+
import { AwesomeButton } from '@rcaferati/react-awesome-button';
121+
import themeBlue from '@rcaferati/react-awesome-button/themes/theme-blue';
122122

123123
const blueTheme = themeBlue?.default ?? themeBlue;
124124

@@ -153,7 +153,7 @@ export default function Example() {
153153
154154
```jsx
155155
import React from 'react';
156-
import { AwesomeButton } from 'react-awesome-button';
156+
import { AwesomeButton } from '@rcaferati/react-awesome-button';
157157

158158
export default function Example() {
159159
return (
@@ -221,8 +221,8 @@ Its `onPress` receives a second callback argument:
221221
222222
```jsx
223223
import React from 'react';
224-
import { AwesomeButtonProgress } from 'react-awesome-button';
225-
import themeBlue from 'react-awesome-button/src/styles/themes/theme-blue';
224+
import { AwesomeButtonProgress } from '@rcaferati/react-awesome-button';
225+
import themeBlue from '@rcaferati/react-awesome-button/themes/theme-blue';
226226

227227
const blueTheme = themeBlue?.default ?? themeBlue;
228228

@@ -250,7 +250,7 @@ export default function Example() {
250250
251251
```jsx
252252
import React from 'react';
253-
import { AwesomeButtonProgress } from 'react-awesome-button';
253+
import { AwesomeButtonProgress } from '@rcaferati/react-awesome-button';
254254

255255
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
256256

@@ -275,8 +275,8 @@ export default function Example() {
275275
```jsx
276276
import React from 'react';
277277
import { Shield } from 'lucide-react';
278-
import { AwesomeButtonProgress } from 'react-awesome-button';
279-
import themeBlue from 'react-awesome-button/src/styles/themes/theme-blue';
278+
import { AwesomeButtonProgress } from '@rcaferati/react-awesome-button';
279+
import themeBlue from '@rcaferati/react-awesome-button/themes/theme-blue';
280280

281281
const blueTheme = themeBlue?.default ?? themeBlue;
282282
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
@@ -332,8 +332,8 @@ On press, the component follows this order:
332332
```jsx
333333
import React from 'react';
334334
import { Github } from 'lucide-react';
335-
import { AwesomeButtonSocial } from 'react-awesome-button';
336-
import themeBlue from 'react-awesome-button/src/styles/themes/theme-blue';
335+
import { AwesomeButtonSocial } from '@rcaferati/react-awesome-button';
336+
import themeBlue from '@rcaferati/react-awesome-button/themes/theme-blue';
337337

338338
const blueTheme = themeBlue?.default ?? themeBlue;
339339

@@ -357,7 +357,7 @@ export default function Example() {
357357
358358
```jsx
359359
import React from 'react';
360-
import { AwesomeButtonSocial } from 'react-awesome-button';
360+
import { AwesomeButtonSocial } from '@rcaferati/react-awesome-button';
361361

362362
export default function Example() {
363363
return (
@@ -380,7 +380,7 @@ export default function Example() {
380380
381381
```jsx
382382
import React from 'react';
383-
import { AwesomeButtonSocial } from 'react-awesome-button';
383+
import { AwesomeButtonSocial } from '@rcaferati/react-awesome-button';
384384

385385
export default function Example() {
386386
return (
@@ -402,7 +402,7 @@ If `href` is present, the component behaves like an anchor and does **not** exec
402402
403403
```jsx
404404
import React from 'react';
405-
import { AwesomeButtonSocial } from 'react-awesome-button';
405+
import { AwesomeButtonSocial } from '@rcaferati/react-awesome-button';
406406

407407
export default function Example() {
408408
return (
@@ -460,7 +460,7 @@ const blueTheme = themeBlue?.default ?? themeBlue;
460460
Then pass it to any button component via:
461461
462462
```jsx
463-
cssModule = { blueTheme };
463+
<AwesomeButton cssModule={blueTheme}>Button</AwesomeButton>
464464
```
465465
466466
---

0 commit comments

Comments
 (0)