Skip to content

Commit e05d348

Browse files
committed
🚀 RELEASE: version 0.0.6
1 parent b925f1c commit e05d348

File tree

7 files changed

+98
-5
lines changed

7 files changed

+98
-5
lines changed

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "cra-template-typescript-firebase",
33
"homepage": "http://pettiboy.github.com/cra-template-typescript-firebase",
4-
"version": "0.0.5",
4+
"version": "0.0.6",
55
"license": "MIT",
66
"author": "Hussain Pettiwala",
77
"engines": {
@@ -21,6 +21,8 @@
2121
"authentication",
2222
"SignIn with Google",
2323
"mui",
24+
"deploy",
25+
"gh-pages",
2426
"material-ui"
2527
],
2628
"files": [

template.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"homepage": "/",
23
"package": {
34
"dependencies": {
45
"@emotion/react": "^11.7.1",
@@ -22,10 +23,18 @@
2223
"web-vitals": "^2.1.2"
2324
},
2425
"scripts": {
26+
"serve": "serve -s build",
27+
"build-and-serve": "npm run build && npm run serve",
2528
"start": "react-scripts start",
2629
"build": "react-scripts build",
2730
"test": "react-scripts test",
28-
"eject": "react-scripts eject"
31+
"eject": "react-scripts eject",
32+
"predeploy": "npm run build",
33+
"deploy": "gh-pages -d build",
34+
"pull": "git pull && npm i && npm start"
35+
},
36+
"devDependencies": {
37+
"gh-pages": "^3.2.3"
2938
}
3039
}
3140
}

template/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
# CRA TypeScript Firebase Template
1+
# React app made using typescript-firebase template

template/public/404.html

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8" />
5+
<title>Single Page Apps for GitHub Pages</title>
6+
<script type="text/javascript">
7+
// Single Page Apps for GitHub Pages
8+
// MIT License
9+
// https://github.com/rafgraph/spa-github-pages
10+
// This script takes the current url and converts the path and query
11+
// string into just a query string, and then redirects the browser
12+
// to the new url with only a query string and hash fragment,
13+
// e.g. https://www.foo.tld/one/two?a=b&c=d#qwe, becomes
14+
// https://www.foo.tld/?/one/two&a=b~and~c=d#qwe
15+
// Note: this 404.html file must be at least 512 bytes for it to work
16+
// with Internet Explorer (it is currently > 512 bytes)
17+
18+
// If you're creating a Project Pages site and NOT using a custom domain,
19+
// then set pathSegmentsToKeep to 1 (enterprise users may need to set it to > 1).
20+
// This way the code will only replace the route part of the path, and not
21+
// the real directory in which the app resides, for example:
22+
// https://username.github.io/repo-name/one/two?a=b&c=d#qwe becomes
23+
// https://username.github.io/repo-name/?/one/two&a=b~and~c=d#qwe
24+
// Otherwise, leave pathSegmentsToKeep as 0.
25+
var pathSegmentsToKeep = 1;
26+
27+
var l = window.location;
28+
l.replace(
29+
l.protocol +
30+
"//" +
31+
l.hostname +
32+
(l.port ? ":" + l.port : "") +
33+
l.pathname
34+
.split("/")
35+
.slice(0, 1 + pathSegmentsToKeep)
36+
.join("/") +
37+
"/?/" +
38+
l.pathname
39+
.slice(1)
40+
.split("/")
41+
.slice(pathSegmentsToKeep)
42+
.join("/")
43+
.replace(/&/g, "~and~") +
44+
(l.search ? "&" + l.search.slice(1).replace(/&/g, "~and~") : "") +
45+
l.hash
46+
);
47+
</script>
48+
</head>
49+
<body></body>
50+
</html>

template/public/index.html

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,38 @@
1515
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
1616
-->
1717
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
18+
19+
<!-- Start Single Page Apps for GitHub Pages -->
20+
<script type="text/javascript">
21+
// Single Page Apps for GitHub Pages
22+
// MIT License
23+
// https://github.com/rafgraph/spa-github-pages
24+
// This script checks to see if a redirect is present in the query string,
25+
// converts it back into the correct url and adds it to the
26+
// browser's history using window.history.replaceState(...),
27+
// which won't cause the browser to attempt to load the new url.
28+
// When the single page app is loaded further down in this file,
29+
// the correct url will be waiting in the browser's history for
30+
// the single page app to route accordingly.
31+
(function (l) {
32+
if (l.search[1] === "/") {
33+
var decoded = l.search
34+
.slice(1)
35+
.split("&")
36+
.map(function (s) {
37+
return s.replace(/~and~/g, "&");
38+
})
39+
.join("?");
40+
window.history.replaceState(
41+
null,
42+
null,
43+
l.pathname.slice(0, -1) + decoded + l.hash
44+
);
45+
}
46+
})(window.location);
47+
</script>
48+
<!-- End Single Page Apps for GitHub Pages -->
49+
1850
<!--
1951
Notice the use of %PUBLIC_URL% in the tags above.
2052
It will be replaced with the URL of the `public` folder during the build.

template/src/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ function App() {
2929

3030
return (
3131
<div>
32-
<BrowserRouter>
32+
<BrowserRouter basename={process.env.PUBLIC_URL}>
3333
<Routes>
3434
{routes.map((route, index) => (
3535
<Route

template/src/components/auth/Logout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ const Logout = ({ navigateTo = "/login" }: Props) => {
1616
signOut(auth)
1717
.then(() => {
1818
navigate(navigateTo);
19-
setDisabled(false);
2019
})
2120
.catch((error) => {
2221
console.error(error);
22+
setDisabled(false);
2323
});
2424
};
2525

0 commit comments

Comments
 (0)