Skip to content

Commit

Permalink
Auto-generated commit
Browse files Browse the repository at this point in the history
  • Loading branch information
stdlib-bot committed Jun 1, 2022
1 parent d7848a6 commit f0b8897
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 11 deletions.
1 change: 0 additions & 1 deletion .github/.keepalive

This file was deleted.

22 changes: 15 additions & 7 deletions .github/workflows/bundle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -233,12 +233,20 @@ jobs:
alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/')
echo "::set-output name=alias::${alias}"
# Create Universal Module Definition (UMD) bundle:
- name: 'Create Universal Module Definition (UMD) bundle'
id: umd-bundle
# Create Universal Module Definition (UMD) Node.js bundle:
- name: 'Create Universal Module Definition (UMD) Node.js bundle'
id: umd-bundle-node
uses: stdlib-js/bundle-action@main
with:
target: 'umd'
target: 'umd-node'
alias: ${{ steps.extract-alias.outputs.alias }}

# Create Universal Module Definition (UMD) browser bundle:
- name: 'Create Universal Module Definition (UMD) browser bundle'
id: umd-bundle-browser
uses: stdlib-js/bundle-action@main
with:
target: 'umd-browser'
alias: ${{ steps.extract-alias.outputs.alias }}

# Rewrite file contents:
Expand All @@ -254,19 +262,19 @@ jobs:
find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?<section class=\"c\">[\s\S]+<\!\-\- \/.c \-\->//g"
# Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag:
find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/bundle.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n<script type=\"text\/javascript\" src=\"https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/bundle.js\"><\/script>\n\`\`\`\n\nIf no recognized module system is present, access bundle contents via the global scope:\n\n\`\`\`html\n<script type=\"text\/javascript\">\n window.\2;\n<\/script>\n\`\`\`/"
find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n<script type=\"text\/javascript\" src=\"https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js\"><\/script>\n\`\`\`\n\nIf no recognized module system is present, access bundle contents via the global scope:\n\n\`\`\`html\n<script type=\"text\/javascript\">\n window.\2;\n<\/script>\n\`\`\`/"
# Rewrite examples section to be a HTML file:
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\`\`\`/"
# Rewrite all `require()`s in the examples section as `script` tags loading the respective UMD bundle:
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\/bundle.js\"><\/script>\n<script type=\"text\/javascript\">/g"
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"
# Wrap contents of `<script type="text/javascript">` tag contents in an IIFE:
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"
# Create package.json file for umd branch:
jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "main": "./bundle.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./umd/package.json
jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "main": "./index.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./umd/package.json
# Configure git:
- name: 'Configure git'
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/npm_downloads.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,13 @@ jobs:
echo "::set-output name=data::$data"
timeout-minutes: 5

# Print summary of download data:
- name: 'Print summary'
run: |
echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY
echo "|------|------------|" >> $GITHUB_STEP_SUMMARY
cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY
# Upload the download data:
- name: 'Upload data'
uses: actions/upload-artifact@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/productionize.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ jobs:
runs-on: 'ubuntu-latest'

# Indicate that this job depends on the prior job finishing:
needs: test
needs: productionize

# Run this job regardless of the outcome of the prior job:
if: always()
Expand Down
24 changes: 23 additions & 1 deletion .github/workflows/test_bundles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,29 @@ jobs:
# Try loading the UMD bundle:
- name: 'Try loading UMD bundle'
run: |
node --eval "require( './bundle.js' )" || exit $?
node --eval "require( './index.js' )" || exit $?
# Install playwright for headless browser testing:
- name: 'Install playwright'
run: |
npm install playwright
npx playwright install --with-deps chromium
# Try loading the UMD browser bundle with playwright:
- name: 'Try loading UMD browser bundle with playwright'
run: |
PLAYWRIGHT_SCRIPT="\
const { chromium } = require( 'playwright' );\
(async () => {\
const browser = await chromium.launch();\
const page = await browser.newPage();\
page.on( 'pageerror', exception => {\
throw new Error( exception.message );\
});\
await page.addScriptTag({ path: './browser.js' });\
await browser.close();\
})();"
node --eval "$PLAYWRIGHT_SCRIPT" || exit $?
# Send notification to Slack channel if job fails:
- name: 'Send status to Slack channel in case of failure'
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/test_coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,20 @@ jobs:
coverage=`cat reports/coverage/lcov-report/index.html | grep "fraction" | grep -oP '\d+/\d+' | printf %s "$(cat)" | jq -R -s -c 'split("\n")'`
echo "::set-output name=coverage::$coverage"
# Format coverage as Markdown table row:
table=`echo $coverage | sed -e 's/,/|/g; s/"/ /g; s/\[/|/; s/\]/|/'`
echo "::set-output name=table::$table"
# Print coverage report to GitHub Actions log:
- name: 'Print coverage report to GitHub Actions log'
run: |
echo "## Coverage Report" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| Statements | Branches | Functions | Lines | " >> $GITHUB_STEP_SUMMARY
echo "| ---------- | -------- | --------- | ----- | " >> $GITHUB_STEP_SUMMARY
echo "${{ steps.extract-coverage.outputs.table }}" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
# Send Slack notification if job fails:
- name: 'Send status to Slack channel in case of failure'
uses: act10ns/slack@v1
Expand Down
1 change: 1 addition & 0 deletions data/data.csv
Original file line number Diff line number Diff line change
Expand Up @@ -3308,6 +3308,7 @@ iterCeil10,"iterCeil10( iterator )"
iterCompositesSeq,"iterCompositesSeq( [options] )"
iterConcat,"iterConcat( iter0, ...iterator )"
iterConstant,"iterConstant( value[, options] )"
iterContinuedFraction,"iterContinuedFraction( iterator[, options] )"
iterContinuedFractionSeq,"iterContinuedFractionSeq( x[, options] )"
iterCos,"iterCos( iterator )"
iterCosh,"iterCosh( iterator )"
Expand Down
2 changes: 1 addition & 1 deletion data/data.json

Large diffs are not rendered by default.

0 comments on commit f0b8897

Please sign in to comment.