Skip to content

Commit a3cfbf5

Browse files
committed
Auto-generated commit
1 parent 905b5c5 commit a3cfbf5

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

.github/workflows/bundle.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ jobs:
268268
find ./umd -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=\"text\/javascript\">\2\n<\/script>\n<\/body>\n<\/html>\n\`\`\`/"
269269
270270
# Rewrite all `require()`s in the examples section as `script` tags loading the respective UMD bundle:
271-
find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "1 while s/<script type=\"text\/javascript\">\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);?/<script type=\"text\/javascript\" src=\"https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/index.js\"><\/script>\n<script type=\"text\/javascript\">/g"
271+
find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "1 while s/<script type=\"text\/javascript\">\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);?/<script type=\"text\/javascript\" src=\"https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js\"><\/script>\n<script type=\"text\/javascript\">/g"
272272
273273
# Wrap contents of `<script type="text/javascript">` tag contents in an IIFE:
274274
find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/<script type=\"text\/javascript\">([\s\S]+?)<\/script>/<script type=\"text\/javascript\">\n\(function \(\) {\1}\)\(\);\n<\/script>/g"

.github/workflows/test_bundles.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,28 @@ jobs:
6464
run: |
6565
node --eval "require( './index.js' )" || exit $?
6666
67+
# Install playwright for headless browser testing:
68+
- name: 'Install playwright'
69+
run: |
70+
npm install playwright
71+
npx playwright install --with-deps chromium
72+
73+
# Try loading the UMD browser bundle with playwright:
74+
- name: 'Try loading UMD browser bundle with playwright'
75+
run: |
76+
PLAYWRIGHT_SCRIPT="\
77+
const { chromium } = require( 'playwright' );\
78+
(async () => {\
79+
const browser = await chromium.launch();\
80+
const page = await browser.newPage();\
81+
page.on( 'pageerror', exception => {\
82+
throw new Error( exception.message );\
83+
});\
84+
await page.addScriptTag({ path: './browser.js' });\
85+
await browser.close();\
86+
})();"
87+
node --eval "$PLAYWRIGHT_SCRIPT" || exit $?
88+
6789
# Send notification to Slack channel if job fails:
6890
- name: 'Send status to Slack channel in case of failure'
6991
uses: act10ns/slack@v1

0 commit comments

Comments
 (0)