Skip to content

Commit 6db0652

Browse files
committed
Auto-generated commit
1 parent 45b7afe commit 6db0652

File tree

6 files changed

+38
-10
lines changed

6 files changed

+38
-10
lines changed

.github/.keepalive

-1
This file was deleted.

.github/workflows/bundle.yml

+15-7
Original file line numberDiff line numberDiff line change
@@ -233,12 +233,20 @@ jobs:
233233
alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/')
234234
echo "::set-output name=alias::${alias}"
235235
236-
# Create Universal Module Definition (UMD) bundle:
237-
- name: 'Create Universal Module Definition (UMD) bundle'
238-
id: umd-bundle
236+
# Create Universal Module Definition (UMD) Node.js bundle:
237+
- name: 'Create Universal Module Definition (UMD) Node.js bundle'
238+
id: umd-bundle-node
239239
uses: stdlib-js/bundle-action@main
240240
with:
241-
target: 'umd'
241+
target: 'umd-node'
242+
alias: ${{ steps.extract-alias.outputs.alias }}
243+
244+
# Create Universal Module Definition (UMD) browser bundle:
245+
- name: 'Create Universal Module Definition (UMD) browser bundle'
246+
id: umd-bundle-browser
247+
uses: stdlib-js/bundle-action@main
248+
with:
249+
target: 'umd-browser'
242250
alias: ${{ steps.extract-alias.outputs.alias }}
243251

244252
# Rewrite file contents:
@@ -254,19 +262,19 @@ jobs:
254262
find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?<section class=\"c\">[\s\S]+<\!\-\- \/.c \-\->//g"
255263
256264
# Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag:
257-
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\`\`\`/"
265+
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\`\`\`/"
258266
259267
# Rewrite examples section to be a HTML file:
260268
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\`\`\`/"
261269
262270
# Rewrite all `require()`s in the examples section as `script` tags loading the respective UMD bundle:
263-
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"
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"
264272
265273
# Wrap contents of `<script type="text/javascript">` tag contents in an IIFE:
266274
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"
267275
268276
# Create package.json file for umd branch:
269-
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
277+
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
270278
271279
# Configure git:
272280
- name: 'Configure git'

.github/workflows/npm_downloads.yml

+7
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,13 @@ jobs:
7575
echo "::set-output name=data::$data"
7676
timeout-minutes: 5
7777

78+
# Print summary of download data:
79+
- name: 'Print summary'
80+
run: |
81+
echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY
82+
echo "|------|------------|" >> $GITHUB_STEP_SUMMARY
83+
cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY
84+
7885
# Upload the download data:
7986
- name: 'Upload data'
8087
uses: actions/upload-artifact@v2

.github/workflows/productionize.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ jobs:
117117
runs-on: 'ubuntu-latest'
118118

119119
# Indicate that this job depends on the prior job finishing:
120-
needs: test
120+
needs: productionize
121121

122122
# Run this job regardless of the outcome of the prior job:
123123
if: always()

.github/workflows/test_bundles.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jobs:
6262
# Try loading the UMD bundle:
6363
- name: 'Try loading UMD bundle'
6464
run: |
65-
node --eval "require( './bundle.js' )" || exit $?
65+
node --eval "require( './index.js' )" || exit $?
6666
6767
# Send notification to Slack channel if job fails:
6868
- name: 'Send status to Slack channel in case of failure'

.github/workflows/test_coverage.yml

+14
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,20 @@ jobs:
9090
coverage=`cat reports/coverage/lcov-report/index.html | grep "fraction" | grep -oP '\d+/\d+' | printf %s "$(cat)" | jq -R -s -c 'split("\n")'`
9191
echo "::set-output name=coverage::$coverage"
9292
93+
# Format coverage as Markdown table row:
94+
table=`echo $coverage | sed -e 's/,/|/g; s/"/ /g; s/\[/|/; s/\]/|/'`
95+
echo "::set-output name=table::$table"
96+
97+
# Print coverage report to GitHub Actions log:
98+
- name: 'Print coverage report to GitHub Actions log'
99+
run: |
100+
echo "## Coverage Report" >> $GITHUB_STEP_SUMMARY
101+
echo "" >> $GITHUB_STEP_SUMMARY
102+
echo "| Statements | Branches | Functions | Lines | " >> $GITHUB_STEP_SUMMARY
103+
echo "| ---------- | -------- | --------- | ----- | " >> $GITHUB_STEP_SUMMARY
104+
echo "${{ steps.extract-coverage.outputs.table }}" >> $GITHUB_STEP_SUMMARY
105+
echo "" >> $GITHUB_STEP_SUMMARY
106+
93107
# Send Slack notification if job fails:
94108
- name: 'Send status to Slack channel in case of failure'
95109
uses: act10ns/slack@v1

0 commit comments

Comments
 (0)