Skip to content

Commit

Permalink
update docs build
Browse files Browse the repository at this point in the history
  • Loading branch information
sheppard committed Nov 9, 2023
1 parent a40bd8b commit 28100ad
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 6 deletions.
1 change: 1 addition & 0 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ jobs:
curl -L -s https://unpkg.com/@wq/markdown > docs/js/markdown.js
sed -i "s/^import\(.*\)https:\/\/unpkg.com\/wq/import\1.\/wq.js/" docs/js/*.js
sed -i "s/^import\(.*\)https:\/\/unpkg.com\/@wq\/markdown/import\1.\/markdown.js/" docs/js/*.js
sed -i "s/^import\(.*\)https:\/\/unpkg.com\/maplibre-gl/import\1.\/maplibre-gl.js/" docs/js/*.js
- name: Build with Jekyll
uses: actions/jekyll-build-pages@v1
with:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ npx create-react-app myproject --template @wq
### CDN
```html
<script type="module">
import wq from 'https://unpkg.com/wq@next';
import wq from 'https://unpkg.com/wq';
wq.init({});
</script>
```
Expand Down
7 changes: 7 additions & 0 deletions docs/js/$index.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,13 @@ wq.use({
},
});

wq.use({
name: 'auth',
reducer(state) {
return state || {};
}
});

function Icon({ data }) {
return React.createElement(
'svg',
Expand Down
15 changes: 10 additions & 5 deletions docs/js/codepen.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { modules } from 'https://unpkg.com/wq';
import { renderers } from 'https://unpkg.com/@wq/markdown';
import { components } from 'https://unpkg.com/@wq/markdown';

const React = modules.react;
const Code = renderers.code;
const Code = components.code;

const COMMENT = `// wq.init(config).then(...);
Expand Down Expand Up @@ -37,6 +37,12 @@ wq.use({
}
}
});
wq.use({
name: 'auth',
reducer(state) {
return state || {};
}
});
wq.init({
...config,
router: {base_url: window.location.pathname},
Expand Down Expand Up @@ -79,9 +85,8 @@ function wrapCode(code) {
}

export default function CodeDetect(props) {
const { language, value } = props;
const { children: value } = props;
if (
(language === 'javascript' || language === 'js') &&
value.indexOf("import wq from './wq.js';") !== -1 &&
value.indexOf('wq.init(config).then(...);') !== -1
) {
Expand All @@ -90,7 +95,7 @@ export default function CodeDetect(props) {
} else {
return React.createElement(Code, {
...props,
value: '// Warning: Failed to initialize CodePen!\n\n' + value,
children: '// Warning: Failed to initialize CodePen!\n\n' + value,
});
}
} else {
Expand Down
1 change: 1 addition & 0 deletions docs/js/maplibre-gl.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
window.maplibregl = {};

0 comments on commit 28100ad

Please sign in to comment.