Skip to content

Commit 40ea0cb

Browse files
committed
chore: release 2.0.0-rc.2
1 parent e77c301 commit 40ea0cb

8 files changed

Lines changed: 84 additions & 42 deletions

Makefile

Lines changed: 56 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ help:
1515
@echo ""
1616
@echo "Release (RC):"
1717
@echo " make release-rc [VERSION=X.X.X-rc.X] - Create RC release (interactive)"
18-
@echo " make publish-rc - Publish RC to npm (with confirmation)"
18+
@echo " make publish-rc - Publish RC (git commit/tag/push + npm)"
1919
@echo ""
2020
@echo "Release (Stable):"
2121
@echo " make release-patch - Bump patch version (1.0.0 -> 1.0.1, interactive)"
2222
@echo " make release-minor - Bump minor version (1.0.0 -> 1.1.0, interactive)"
2323
@echo " make release-major - Bump major version (1.0.0 -> 2.0.0, interactive)"
24-
@echo " make publish - Publish stable to npm (with confirmation)"
24+
@echo " make publish - Publish stable (git commit/tag/push + npm)"
2525
@echo ""
2626
@echo "Note: All release commands are interactive and will:"
2727
@echo " - Show current and new version"
@@ -104,12 +104,8 @@ release-rc:
104104
echo " ✓ Version updated to $$VERSION"; \
105105
echo " ✓ Library built successfully"; \
106106
echo ""; \
107-
echo "Next steps (manual):"; \
108-
echo " 1. Review changes: git status && git diff"; \
109-
echo " 2. Commit: git add . && git commit -m 'chore: release $$VERSION'"; \
110-
echo " 3. Tag: git tag v$$VERSION"; \
111-
echo " 4. Push: git push origin main && git push origin v$$VERSION"; \
112-
echo " 5. Publish: make publish-rc"
107+
echo "Next step:"; \
108+
echo " make publish-rc # Will handle git commit, tag, push, and npm publish"
113109

114110
release-patch:
115111
@CURRENT=$$(npm pkg get version | tr -d '"'); \
@@ -196,13 +192,38 @@ publish-rc:
196192
echo "📦 Version: $$VERSION"; \
197193
echo "📦 Tag: rc"; \
198194
echo ""; \
199-
echo "⚠️ This will publish to npm registry"; \
195+
echo "⚠️ This will:"; \
196+
echo " 1. Commit changes (if any)"; \
197+
echo " 2. Create git tag v$$VERSION"; \
198+
echo " 3. Push to origin"; \
199+
echo " 4. Publish to npm registry"; \
200+
echo ""; \
200201
read -p "Continue? (y/N): " confirm; \
201202
if [ "$$confirm" != "y" ] && [ "$$confirm" != "Y" ]; then \
202203
echo "❌ Publish cancelled"; \
203204
exit 1; \
204205
fi; \
205206
echo ""; \
207+
echo "🔍 Checking git status..."; \
208+
if [ -n "$$(git status --porcelain)" ]; then \
209+
echo "📝 Staging changes..."; \
210+
git add .; \
211+
echo "💾 Committing changes..."; \
212+
git commit -m "chore: release $$VERSION" || echo "⚠️ Commit failed or nothing to commit"; \
213+
else \
214+
echo "✓ No uncommitted changes"; \
215+
fi; \
216+
if ! git rev-parse "v$$VERSION" >/dev/null 2>&1; then \
217+
echo "🏷️ Creating git tag v$$VERSION..."; \
218+
git tag v$$VERSION; \
219+
else \
220+
echo "⚠️ Tag v$$VERSION already exists"; \
221+
fi; \
222+
echo "📤 Pushing to origin..."; \
223+
git push origin main 2>/dev/null || git push origin master 2>/dev/null || echo "⚠️ Push failed or already up to date"; \
224+
git push origin v$$VERSION 2>/dev/null || echo "⚠️ Tag push failed or already exists"; \
225+
echo ""; \
226+
echo "📦 Publishing to npm..."; \
206227
npm publish --tag rc --access public; \
207228
echo ""; \
208229
echo "✅ Published @authorizerdev/authorizer-react@$$VERSION to npm with 'rc' tag!"
@@ -219,13 +240,38 @@ publish:
219240
echo "📦 Version: $$VERSION"; \
220241
echo "📦 Tag: latest"; \
221242
echo ""; \
222-
echo "⚠️ This will publish to npm registry as latest"; \
243+
echo "⚠️ This will:"; \
244+
echo " 1. Commit changes (if any)"; \
245+
echo " 2. Create git tag v$$VERSION"; \
246+
echo " 3. Push to origin"; \
247+
echo " 4. Publish to npm registry as latest"; \
248+
echo ""; \
223249
read -p "Continue? (y/N): " confirm; \
224250
if [ "$$confirm" != "y" ] && [ "$$confirm" != "Y" ]; then \
225251
echo "❌ Publish cancelled"; \
226252
exit 1; \
227253
fi; \
228254
echo ""; \
255+
echo "🔍 Checking git status..."; \
256+
if [ -n "$$(git status --porcelain)" ]; then \
257+
echo "📝 Staging changes..."; \
258+
git add .; \
259+
echo "💾 Committing changes..."; \
260+
git commit -m "chore: release $$VERSION" || echo "⚠️ Commit failed or nothing to commit"; \
261+
else \
262+
echo "✓ No uncommitted changes"; \
263+
fi; \
264+
if ! git rev-parse "v$$VERSION" >/dev/null 2>&1; then \
265+
echo "🏷️ Creating git tag v$$VERSION..."; \
266+
git tag v$$VERSION; \
267+
else \
268+
echo "⚠️ Tag v$$VERSION already exists"; \
269+
fi; \
270+
echo "📤 Pushing to origin..."; \
271+
git push origin main 2>/dev/null || git push origin master 2>/dev/null || echo "⚠️ Push failed or already up to date"; \
272+
git push origin v$$VERSION 2>/dev/null || echo "⚠️ Tag push failed or already exists"; \
273+
echo ""; \
274+
echo "📦 Publishing to npm..."; \
229275
npm publish --access public; \
230276
echo ""; \
231277
echo "✅ Published @authorizerdev/authorizer-react@$$VERSION to npm!"

RELEASE.md

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ make release-rc VERSION=2.0.0-rc.1
2020
# - Update package.json
2121
# - Build the library
2222

23-
# Then commit and publish:
24-
git add .
25-
git commit -m "chore: release 2.0.0-rc.1"
26-
git tag v2.0.0-rc.1
27-
git push origin main && git push origin v2.0.0-rc.1
28-
make publish-rc # Will also ask for confirmation
23+
# Then publish (includes git commit, tag, push, and npm publish):
24+
make publish-rc # Will ask for confirmation, then:
25+
# - Commit changes (if any)
26+
# - Create and push git tag
27+
# - Push to origin
28+
# - Publish to npm
2929
```
3030

3131
## Quick Release (Stable)
@@ -44,13 +44,12 @@ make release-major # 2.0.0 -> 3.0.0
4444
# - Update package.json automatically
4545
# - Build the library
4646

47-
# Then commit and publish:
48-
VERSION=$(npm pkg get version | tr -d '"')
49-
git add .
50-
git commit -m "chore: release $VERSION"
51-
git tag v$VERSION
52-
git push origin main && git push origin v$VERSION
53-
make publish # Will also ask for confirmation
47+
# Then publish (includes git commit, tag, push, and npm publish):
48+
make publish # Will ask for confirmation, then:
49+
# - Commit changes (if any)
50+
# - Create and push git tag
51+
# - Push to origin
52+
# - Publish to npm
5453
```
5554

5655
## Release Checklist

src/components/AuthorizerBasicAuthLogin.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ export const AuthorizerBasicAuthLogin: FC<{
5959

6060
const onSubmit = async (e: any) => {
6161
e.preventDefault();
62-
setLoading(true);
6362
try {
63+
setLoading(true);
6464
let email: string = '';
6565
let phone_number: string = '';
6666
if (formData.email_or_phone_number) {
@@ -75,7 +75,6 @@ export const AuthorizerBasicAuthLogin: FC<{
7575
...errorData,
7676
email_or_phone_number: 'Invalid email or phone number',
7777
});
78-
setLoading(false);
7978
return;
8079
}
8180
const data: LoginRequest = {
@@ -97,7 +96,6 @@ export const AuthorizerBasicAuthLogin: FC<{
9796
const { data: res, errors } = await authorizerRef.login(data);
9897
if (errors && errors.length) {
9998
setError(errors[0].message);
100-
setLoading(false);
10199
return;
102100
}
103101
// if totp is enabled for the first time show totp screen with scanner
@@ -147,8 +145,9 @@ export const AuthorizerBasicAuthLogin: FC<{
147145
onLogin(res);
148146
}
149147
} catch (err) {
150-
setLoading(false);
151148
setError((err as Error).message);
149+
} finally {
150+
setLoading(false);
152151
}
153152
};
154153

src/components/AuthorizerForgotPassword.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ export const AuthorizerForgotPassword: FC<{
6262
...errorData,
6363
email_or_phone_number: 'Invalid email or phone number',
6464
});
65-
setLoading(false);
6665
return;
6766
}
6867
const { data: res, errors } = await authorizerRef.forgotPassword({
@@ -74,7 +73,6 @@ export const AuthorizerForgotPassword: FC<{
7473
config.redirectURL ||
7574
window.location.origin,
7675
});
77-
setLoading(false);
7876
if (errors && errors.length) {
7977
setError(formatErrorMessage(errors[0]?.message));
8078
return;
@@ -96,8 +94,9 @@ export const AuthorizerForgotPassword: FC<{
9694
onForgotPassword(res);
9795
}
9896
} catch (err) {
99-
setLoading(false);
10097
setError(formatErrorMessage((err as Error)?.message));
98+
} finally {
99+
setLoading(false);
101100
}
102101
};
103102

src/components/AuthorizerMagicLinkLogin.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ export const AuthorizerMagicLinkLogin: FC<{
4848
data.roles = roles;
4949
}
5050
const { data: res, errors } = await authorizerRef.magicLinkLogin(data);
51-
setLoading(false);
5251
if (errors && errors.length) {
5352
setError(formatErrorMessage(errors[0]?.message));
5453
return;
@@ -69,8 +68,9 @@ export const AuthorizerMagicLinkLogin: FC<{
6968
}, 3000);
7069
}
7170
} catch (err) {
72-
setLoading(false);
7371
setError(formatErrorMessage((err as Error)?.message));
72+
} finally {
73+
setLoading(false);
7474
}
7575
};
7676

src/components/AuthorizerResetPassword.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,15 @@ export const AuthorizerResetPassword: FC<Props> = ({
4848

4949
const onSubmit = async (e: any) => {
5050
e.preventDefault();
51-
setLoading(true);
5251
try {
52+
setLoading(true);
5353
const { data: res, errors } = await authorizerRef.resetPassword({
5454
token,
5555
otp: formData.otp || '',
5656
phone_number: phone_number || '',
5757
password: formData.password || '',
5858
confirm_password: formData.confirmPassword || '',
5959
});
60-
setLoading(false);
6160
if (errors && errors.length) {
6261
setError(formatErrorMessage(errors[0]?.message));
6362
return;
@@ -70,8 +69,9 @@ export const AuthorizerResetPassword: FC<Props> = ({
7069
redirect_uri || config.redirectURL || window.location.origin;
7170
}
7271
} catch (err) {
73-
setLoading(false);
7472
setError(formatErrorMessage((err as Error).message));
73+
} finally {
74+
setLoading(false);
7575
}
7676
};
7777

src/components/AuthorizerSignup.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,18 +145,17 @@ export const AuthorizerSignup: FC<{
145145
config,
146146
loading: false,
147147
});
148-
} else {
149-
setLoading(false);
150-
setSuccessMessage(res.message || ``);
151148
}
149+
setSuccessMessage(res.message || ``);
152150

153151
if (onSignup) {
154152
onSignup(res);
155153
}
156154
}
157155
} catch (err) {
158-
setLoading(false);
159156
setError(formatErrorMessage((err as Error).message));
157+
} finally {
158+
setLoading(false);
160159
}
161160
};
162161

src/components/AuthorizerVerifyOtp.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ export const AuthorizerVerifyOtp: FC<{
5555
}
5656
data.is_totp = !!is_totp;
5757
const { data: res, errors } = await authorizerRef.verifyOtp(data);
58-
setLoading(false);
5958
if (errors && errors.length) {
6059
setError(errors[0]?.message || ``);
6160
return;
@@ -74,8 +73,9 @@ export const AuthorizerVerifyOtp: FC<{
7473
onLogin(res);
7574
}
7675
} catch (err) {
77-
setLoading(false);
7876
setError((err as Error).message);
77+
} finally {
78+
setLoading(false);
7979
}
8080
};
8181

@@ -111,7 +111,7 @@ export const AuthorizerVerifyOtp: FC<{
111111
onLogin(res);
112112
}
113113
} catch (err) {
114-
setLoading(false);
114+
setSendingOtp(false);
115115
setError((err as Error).message);
116116
}
117117
};

0 commit comments

Comments
 (0)