Skip to content

Commit adaa9d9

Browse files
committed
Website: adjust base url
1 parent 8d78275 commit adaa9d9

9 files changed

Lines changed: 218 additions & 166 deletions

File tree

‎.circleci/config.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ aliases:
7474
- &website-deploy-to-gh-pages
7575
name: Deploy documentation to GH Pages
7676
command: |
77-
cd ./website/dist
77+
cd ./website/dist/bs-react-native
7878
git init
7979
8080
git config credential.helper 'cache --timeout=120'

‎website/package.json‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@
1515
"build:prepare": "yarn build:prepare:odoc && yarn build:prepare:md",
1616
"build:prerender-legacy": "./scripts/legacy-doc.sh",
1717
"build:prerender": "node scripts/BuildWebsite.entry.js",
18-
"build:copy-static": "cpy \"public/**/*\" dist",
18+
"build:copy-static": "cpy \"public/**/*\" dist/bs-react-native",
1919
"build": "yarn svg && yarn re:build && yarn build:prepare && yarn build:prerender && yarn build:prerender-legacy && yarn build:copy-static",
20-
"serve": "serve dist",
20+
"serve": "static-server-cli dist",
21+
"start": "opn http://localhost:9000/bs-react-native/ & yarn serve",
2122
"test": "yarn svg && yarn re:build"
2223
},
2324
"devDependencies": {
@@ -28,6 +29,7 @@
2829
"highlight.js": "^9.15.6",
2930
"mkdirp": "^0.5.1",
3031
"module-alias": "^2.2.0",
32+
"opn-cli": "^4.1.0",
3133
"react": "^16.8.0",
3234
"react-dom": "^16.8.0",
3335
"react-from-svg": "^0.1.3",
@@ -36,7 +38,7 @@
3638
"reason-highlightjs": "^0.2.0",
3739
"reason-react": "^0.7.0",
3840
"remarkable": "^1.7.1",
39-
"serve": "^10.1.2",
41+
"static-server-cli": "^1.0.2",
4042
"trash-cli": "^1.4.0"
4143
}
4244
}

‎website/scripts/BuildWebsite.re‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ open Node;
22
open Belt;
33

44
let root = Process.cwd();
5-
let outputPath = Path.join([|root, "dist"|]);
5+
let outputPath = Path.join([|root, "dist", Consts.baseUrl|]);
66

77
let buildOdoc = () => {
88
let sourcePath = Path.join([|root, "build", "odoc"|]);

‎website/scripts/legacy-doc.sh‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
PKG=BsReactNative
44

5-
OUTPUT=./dist
5+
OUTPUT=./dist/bs-react-native
66
LIB=../bs-react-native/lib/bs/src
77
PAGES=./legacy/pages
88
PUBLIC=./legacy/public

‎website/src/Consts.re‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
let baseUrl = "/bs-react-native";
12
let title = {j|BS React Native|j};
23
let defaultTitle = title ++ {j|, BuckleScript bindings for React Native.|j};
34
let titleTemplate = {j|%s - |j} ++ title;
@@ -34,18 +35,18 @@ let menuLinks = [|
3435
},
3536
*/
3637
{
37-
link: "/BsReactNative/",
38+
link: baseUrl ++ "/BsReactNative/",
3839
text: {j|Legacy Docs|j},
3940
icon: (~width, ~height, ~fill) => <SVGDocumentation width height fill />,
4041
isActive: (current, _link) =>
41-
Js.String.startsWith("/BsReactNative/", current),
42+
Js.String.startsWith(baseUrl ++ "/BsReactNative/", current),
4243
},
4344
/*
4445
{
45-
link: "/en/docs/",
46+
link: Consts.baseUrl++"/en/docs/",
4647
text: {j|Docs@next|j},
4748
icon: (~width, ~height, ~fill) => <SVGDocumentation width height fill />,
48-
isActive: (current, _link) => Js.String.startsWith("/en/docs/", current),
49+
isActive: (current, _link) => Js.String.startsWith(Consts.baseUrl++"/en/docs/", current),
4950
},*/
5051
|];
5152

‎website/src/components/HeaderLarge.re‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,12 @@ let styles =
8282

8383
[@react.component]
8484
let make = (~currentLocation) => {
85-
let uri = "/apple-touch-icon.png";
85+
let uri = Consts.baseUrl ++ "/apple-touch-icon.png";
8686
let width = 36.;
8787
let height = 36.;
8888
<View style=styles##menu>
8989
<Container style=styles##bar wrapperStyle=styles##barWrapper>
90-
<ViewLink style=styles##logo href="/">
90+
<ViewLink style=styles##logo href={Consts.baseUrl ++ "/"}>
9191
/* <SVGLogo width=20. height=20. fill=Consts.Colors.dark /> */
9292
/* react-native-web doesn't render source when renderToString is used*/
9393

‎website/src/components/Homepage.re‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ let make = () =>
7979
</View>
8080
<Spacer size=Spacer.XXL />
8181
<ViewLink
82-
href="/BsReactNative/gettingstarted.html"
82+
href={Consts.baseUrl ++ "/BsReactNative/gettingstarted.html"}
8383
style=Style.(
8484
style(
8585
~borderRadius=6.,

‎website/src/components/Sidebar.re‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ let make = () => {
6969
sections
7070
renderItem={renderItemBag => {
7171
let (title, link) = renderItemBag##item;
72-
<TextLink key=title href={"/en/" ++ link} style=styles##link>
72+
<TextLink key=title href={Consts.baseUrl++ "/en/" ++ link} style=styles##link>
7373
title->React.string
7474
</TextLink>;
7575
}}
@@ -113,7 +113,9 @@ let make = () => {
113113
{{section.data
114114
->List.map(((title, link)) =>
115115
<TextLink
116-
key=title href={"/en/" ++ link} style=styles##link>
116+
key=title
117+
href={Consts.baseUrl ++ "/en/" ++ link}
118+
style=styles##link>
117119
title->React.string
118120
</TextLink>
119121
)}

0 commit comments

Comments
 (0)