Skip to content

Commit 121e549

Browse files
authored
Merge pull request #30 from ryanbas21/feat/docs-site
fix(docs-site): patch elm-pages base path for GitHub Pages
2 parents 88c0a18 + baa02c1 commit 121e549

4 files changed

Lines changed: 39 additions & 11 deletions

File tree

.github/workflows/docs.yml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,19 +33,14 @@ jobs:
3333
- name: Build docs site
3434
run: pnpm --filter docs-site build
3535

36-
- name: Prepare deploy directory
36+
- name: Fix elm.js script path
3737
run: |
3838
cd apps/docs/dist
39-
cp -r assets devtools/assets
40-
cp elm.*.js devtools/
41-
cp style.css devtools/ 2>/dev/null || true
42-
cp favicon.ico devtools/ 2>/dev/null || true
43-
cp content.dat devtools/ 2>/dev/null || true
44-
find devtools -name '*.html' -exec sed -i 's|src="/elm\.|src="/devtools/elm.|g' {} +
39+
find . -name '*.html' -exec sed -i 's|src="/elm\.|src="/devtools/elm.|g' {} +
4540
4641
- uses: actions/upload-pages-artifact@v3
4742
with:
48-
path: apps/docs/dist/devtools
43+
path: apps/docs/dist
4944

5045
deploy:
5146
environment:

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@
5151
"onlyBuiltDependencies": [
5252
"esbuild",
5353
"lamdera"
54-
]
54+
],
55+
"patchedDependencies": {
56+
"elm-pages@3.5.1": "patches/elm-pages@3.5.1.patch"
57+
}
5558
}
5659
}

patches/elm-pages@3.5.1.patch

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
diff --git a/codegen/elm-pages-codegen.cjs b/codegen/elm-pages-codegen.cjs
2+
index 23614931f4601b018de0551b2991afdbdf64ddf9..9b9d540dde9a20ffba31cb82dfe8fb6dfd0e44f9 100644
3+
--- a/codegen/elm-pages-codegen.cjs
4+
+++ b/codegen/elm-pages-codegen.cjs
5+
@@ -23712,11 +23712,18 @@ var $author$project$Generate$file$ = function (templates, basePath) {
6+
_Utils_Tuple2('path', $mdgriffith$elm_codegen$Elm$Annotation$string)
7+
]))),
8+
function (url) {
9+
+ var urlPath = $mdgriffith$elm_codegen$Elm$get$('path', url);
10+
+ var strippedPath = $mdgriffith$elm_codegen$Elm$ifThen$(
11+
+ A2($author$project$Gen$String$call_.startsWith, $mdgriffith$elm_codegen$Elm$string(basePath), urlPath),
12+
+ A2(
13+
+ $author$project$Gen$String$call_.dropLeft,
14+
+ $author$project$Gen$String$call_.length($mdgriffith$elm_codegen$Elm$string(basePath)),
15+
+ urlPath),
16+
+ urlPath);
17+
return $mdgriffith$elm_codegen$Elm$withType$(
18+
$mdgriffith$elm_codegen$Elm$Annotation$maybe(routeType.annotation),
19+
segmentsToRouteFn.call(
20+
- $author$project$Generate$splitPath.call(
21+
- $mdgriffith$elm_codegen$Elm$get$('path', url))));
22+
+ $author$project$Generate$splitPath.call(strippedPath)));
23+
}));
24+
var routeToPathFn = $author$project$Generate$routeToPath$(routeType, routes);
25+
var baseUrl = $mdgriffith$elm_codegen$Elm$Declare$value$(

pnpm-lock.yaml

Lines changed: 7 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)