diff --git a/.github/.keepalive b/.github/.keepalive new file mode 100644 index 0000000..a5f12c2 --- /dev/null +++ b/.github/.keepalive @@ -0,0 +1 @@ +2022-06-30T22:57:32.398Z diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index fccb4c2..29bf533 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -21,22 +21,42 @@ name: benchmark # Workflow triggers: on: + # Allow the workflow to be manually run: workflow_dispatch: # Workflow jobs: jobs: + + # Define a job to run benchmarks: benchmark: - runs-on: ubuntu-latest + + # Define a display name: + name: 'Run benchmarks' + + # Define the type of virtual host machine: + runs-on: 'ubuntu-latest' + + # Define the sequence of job steps... steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 + + # Checkout the repository: + - name: 'Checkout repository' + uses: actions/checkout@v3 + + # Install Node.js: + - name: 'Install Node.js' + uses: actions/setup-node@v2 with: node-version: 16 timeout-minutes: 5 - - name: Install production and development dependencies + + # Install dependencies: + - name: 'Install production and development dependencies' run: | npm install || npm install || npm install timeout-minutes: 15 - - name: Run benchmarks + + # Run benchmarks: + - name: 'Run benchmarks' run: | npm run benchmark diff --git a/.github/workflows/bundle.yml b/.github/workflows/bundle.yml deleted file mode 100644 index c52c372..0000000 --- a/.github/workflows/bundle.yml +++ /dev/null @@ -1,256 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: bundle - -# Workflow triggers: -on: - workflow_dispatch: - push: - branches: - - main - tags_ignore: - - 'v[0-9]+\.[0-9]+\.[0-9]+' - -# Workflow jobs: -jobs: - deno: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Copy files to deno directory - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - name: Bundle package for Deno - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - name: Rewrite file contents - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - - name: Publish to deno branch - uses: peaceiris/actions-gh-pages@v3 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./deno - publish_branch: deno - keep_files: true - user_name: 'stdlib-bot' - user_email: 'noreply@stdlib.io' - commit_message: 'Auto-generated commit' - enable_jekyll: true - - name: Send status to Slack channel in case of failure - uses: act10ns/slack@v1 - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - umd: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Copy files to umd directory - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - name: Extract Alias - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "::set-output name=alias::${alias}" - - name: Create Universal Module Definition (UMD) bundle - id: umd-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'umd' - alias: ${{ steps.extract-alias.outputs.alias }} - - name: Rewrite file contents - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\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