Skip to content

Commit 9041479

Browse files
committed
Auto-generated commit
1 parent d50929f commit 9041479

File tree

3 files changed

+29
-10
lines changed

3 files changed

+29
-10
lines changed

.github/.keepalive

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2022-02-02T15:35:33.594Z
1+
2022-02-04T01:50:19.520Z

.github/workflows/bundle.yml

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,15 @@ jobs:
6969
7070
# Rewrite all `require()`s to use jsDelivr links:
7171
find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// {
72-
s/(var|let|const)\s+([a-z0-9]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i
72+
s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i
7373
s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/
7474
s/';/@deno\/mod.js';/
7575
}"
7676
7777
# Remove `installation`, `cli`, and `c` sections:
7878
find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/<section class=\"installation\">[^<]+<\/section>//g;"
79-
find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/<section class=\"cli\">[\s\S]+<\!\-\- \/.cli \-\->//g"
80-
find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/<section class=\"c\">[\s\S]+<\!\-\- \/.c \-\->//g"
79+
find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?<section class=\"cli\">[\s\S]+<\!\-\- \/.cli \-\->//g"
80+
find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?<section class=\"c\">[\s\S]+<\!\-\- \/.c \-\->//g"
8181
8282
- name: Publish to deno branch
8383
uses: peaceiris/actions-gh-pages@v3
@@ -107,18 +107,24 @@ jobs:
107107
run: |
108108
npm install || npm install || npm install
109109
timeout-minutes: 15
110+
- name: Extract Alias
111+
id: extract-alias
112+
run: |
113+
alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/')
114+
echo "::set-output name=alias::${alias}"
110115
- name: Create Universal Module Definition (UMD) bundle
111116
id: umd-bundle
112117
uses: stdlib-js/bundle-action@main
113118
with:
114119
target: 'umd'
120+
alias: ${{ steps.extract-alias.outputs.alias }}
115121
- name: Rewrite file contents
116122
run: |
117123
118124
# Remove `installation`, `cli`, and `c` sections:
119125
find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/<section class=\"installation\">[^<]+<\/section>//g;"
120-
find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/<section class=\"cli\">[\s\S]+<\!\-\- \/.cli \-\->//g"
121-
find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/<section class=\"c\">[\s\S]+<\!\-\- \/.c \-\->//g"
126+
find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?<section class=\"cli\">[\s\S]+<\!\-\- \/.cli \-\->//g"
127+
find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?<section class=\"c\">[\s\S]+<\!\-\- \/.c \-\->//g"
122128
123129
- name: Publish to umd branch
124130
uses: peaceiris/actions-gh-pages@v3
@@ -175,18 +181,18 @@ jobs:
175181
176182
# Rewrite all `require()`s to use jsDelivr links:
177183
find ./esm -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// {
178-
s/(var|let|const)\s+([a-z0-9]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i
184+
s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i
179185
s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/
180186
s/';/@esm\/index.mjs';/
181187
}"
182188
183189
# Remove `installation`, `cli`, and `c` sections:
184190
find ./esm -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/<section class=\"installation\">[^<]+<\/section>//g;"
185-
find ./esm -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/<section class=\"cli\">[\s\S]+<\!\-\- \/.cli \-\->//g"
186-
find ./esm -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/<section class=\"c\">[\s\S]+<\!\-\- \/.c \-\->//g"
191+
find ./esm -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?<section class=\"cli\">[\s\S]+<\!\-\- \/.cli \-\->//g"
192+
find ./esm -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?<section class=\"c\">[\s\S]+<\!\-\- \/.c \-\->//g"
187193
188194
# Rewrite examples section to be a HTML file:
189-
find ./esm -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\#\# Examples([\s\S]*)\`\`\`javascript([\s\S]+?)\`\`\`/\#\# Examples\1\`\`\`html\n<\!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<script type=\"module\">\n\2\n<\/script>\n<\/head>\n<\/html>\n\`\`\`/g"
195+
find ./esm -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\#\# Examples([\s\S]*)\`\`\`javascript([\s\S]+?)\`\`\`/\#\# Examples\1\`\`\`html\n<\!DOCTYPE html>\n<html lang=\"en\">\n<body>\n<script type=\"module\">\n\2\n<\/script>\n<\/body>\n<\/html>\n\`\`\`/g"
190196
191197
- name: Publish to esm branch
192198
uses: peaceiris/actions-gh-pages@v3

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ limitations under the License.
3232
npm install @stdlib/utils-define-nonenumerable-read-only-property
3333
```
3434

35+
Alternatively,
36+
37+
- To load the package in a website via a `script` tag without installation and bundlers, use the [ES Module][es-module] available on the [`esm` branch][esm-url].
38+
- If you are using Deno, visit the [`deno` branch][deno-url].
39+
- For use in Observable, or in browser/node environments, use the [Universal Module Definition (UMD)][umd] build available on the [`umd` branch][umd-url].
40+
3541
</section>
3642

3743
<section class="usage">
@@ -166,6 +172,13 @@ Copyright &copy; 2016-2021. The Stdlib [Authors][stdlib-authors].
166172
167173
-->
168174

175+
[umd]: https://github.com/umdjs/umd
176+
[es-module]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules
177+
178+
[deno-url]: https://github.com/stdlib-js/utils-define-nonenumerable-read-only-property/tree/deno
179+
[umd-url]: https://github.com/stdlib-js/utils-define-nonenumerable-read-only-property/tree/umd
180+
[esm-url]: https://github.com/stdlib-js/utils-define-nonenumerable-read-only-property/tree/esm
181+
169182
[chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg
170183
[chat-url]: https://gitter.im/stdlib-js/stdlib/
171184

0 commit comments

Comments
 (0)