Skip to content

Commit 81ef001

Browse files
authored
Merge branch 'stdlib-js:develop' into dtrmv
2 parents 1d6841c + b308eb8 commit 81ef001

File tree

3,115 files changed

+83761
-20826
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

3,115 files changed

+83761
-20826
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,20 @@
1-
Resolves # .
1+
Resolves #{{TODO: add issue number}}.
22

33
## Description
44

55
> What is the purpose of this pull request?
66
77
This pull request:
88

9-
- a
10-
- b
11-
- c
9+
- {{TODO: add description describing what this pull request does}}
1210

1311
## Related Issues
1412

1513
> Does this pull request have any related issues?
1614
1715
This pull request:
1816

19-
- resolves #
20-
- fixes #
17+
- resolves #{{TODO: add issue number}}
2118

2219
## Questions
2320

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
#/
2+
# @license Apache-2.0
3+
#
4+
# Copyright (c) 2024 The Stdlib Authors.
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
#/
18+
19+
# Workflow name:
20+
name: check_contributing_guidelines_acceptance
21+
22+
# Workflow triggers:
23+
on:
24+
# Allow the workflow to be triggered by other workflows
25+
workflow_call:
26+
# Define the input parameters for the workflow:
27+
inputs:
28+
pull_request_number:
29+
description: 'Pull request number'
30+
required: true
31+
type: number
32+
user:
33+
required: true
34+
type: string
35+
# Define the secrets accessible by the workflow:
36+
secrets:
37+
STDLIB_BOT_GITHUB_TOKEN:
38+
description: 'stdlib-bot GitHub token to create pull request comments'
39+
required: true
40+
41+
# Trigger on pull request events:
42+
pull_request_target:
43+
types: [opened, reopened]
44+
45+
# Global permissions:
46+
permissions:
47+
# Allow read-only access to the repository contents:
48+
contents: read
49+
50+
# Allow write access to pull requests:
51+
pull-requests: write
52+
53+
# Workflow jobs:
54+
jobs:
55+
56+
# Define a job for checking the contributing guidelines acceptance...
57+
check_acknowledgment:
58+
59+
# Define a display name:
60+
name: 'Check Contributing Guidelines Acceptance'
61+
62+
# Define the type of virtual host machine:
63+
runs-on: ubuntu-latest
64+
65+
# Skip this job for PRs opened by the stdlib-bot:
66+
if: github.event.pull_request.user.login != 'stdlib-bot'
67+
68+
# Define the sequence of job steps...
69+
steps:
70+
# Checkout the repository:
71+
- name: 'Checkout repository'
72+
# Pin action to full length commit SHA
73+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
74+
with:
75+
# Specify whether to remove untracked files before checking out the repository:
76+
clean: true
77+
78+
# Limit clone depth to the most recent commit:
79+
fetch-depth: 1
80+
81+
# Specify whether to download Git-LFS files:
82+
lfs: false
83+
timeout-minutes: 10
84+
85+
# Check contributing guidelines acceptance:
86+
- name: 'Check contributing guidelines acceptance'
87+
env:
88+
GITHUB_TOKEN: ${{ secrets.STDLIB_BOT_GITHUB_TOKEN }}
89+
PR_NUMBER: ${{ github.event.pull_request.number || inputs.pull_request_number }}
90+
run: |
91+
. "$GITHUB_WORKSPACE/.github/workflows/scripts/check_contributing_guidelines_acceptance" $PR_NUMBER

.github/workflows/scaffold_pkg_via_branch_push.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ jobs:
8484
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8585
added-files: ${{ steps.changed-files.outputs.files }}
8686

87-
# Configure git:
88-
- name: 'Configure git'
87+
# Configure Git:
88+
- name: 'Configure Git'
8989
run: |
9090
git config --local user.email "82920195+stdlib-bot@users.noreply.github.com"
9191
git config --local user.name "stdlib-bot"

.github/workflows/scripts/add_trailing_newlines

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,13 @@
2929
# Ensure that the exit status of pipelines is non-zero in the event that at least one of the commands in a pipeline fails:
3030
set -o pipefail
3131

32+
3233
# VARIABLES #
3334

3435
# List of file extensions to process:
3536
extensions=("js" "mjs" "cjs" "json" "ts" "py" "jl" "R" "c" "h" "cpp" "hpp" "f" "sh" "awk" "html" "xml" "css" "md" "yml" "gypi" "bib" "tex")
3637

38+
3739
# FUNCTIONS #
3840

3941
# Convert Windows CRLF to Unix LF line endings.
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
#!/usr/bin/env bash
2+
#
3+
# @license Apache-2.0
4+
#
5+
# Copyright (c) 2024 The Stdlib Authors.
6+
#
7+
# Licensed under the Apache License, Version 2.0 (the "License");
8+
# you may not use this file except in compliance with the License.
9+
# You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing, software
14+
# distributed under the License is distributed on an "AS IS" BASIS,
15+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
# See the License for the specific language governing permissions and
17+
# limitations under the License.
18+
19+
# Script to check if a pull request contains the checked contributing guidelines acknowledgment checkbox.
20+
#
21+
# Usage: check_contributing_guidelines PR_NUMBER
22+
#
23+
# Arguments:
24+
#
25+
# PR_NUMBER Pull request number.
26+
#
27+
# Environment variables:
28+
#
29+
# GITHUB_TOKEN GitHub token for authentication.
30+
31+
# Ensure that the exit status of pipelines is non-zero in the event that at least one of the commands in a pipeline fails:
32+
set -o pipefail
33+
34+
35+
# VARIABLES #
36+
37+
# Get the pull request number:
38+
pr_number="$1"
39+
40+
# Set the repository name:
41+
GITHUB_REPOSITORY="stdlib-js/stdlib"
42+
43+
44+
# FUNCTIONS #
45+
46+
# Error handler.
47+
#
48+
# $1 - error status
49+
on_error() {
50+
echo 'ERROR: An error was encountered during execution.' >&2
51+
exit "$1"
52+
}
53+
54+
# Prints a success message.
55+
print_success() {
56+
echo 'Success!' >&2
57+
}
58+
59+
# Main execution sequence.
60+
main() {
61+
echo "Checking contributing guidelines acknowledgment for PR #${pr_number}..."
62+
63+
# Fetch the pull request body:
64+
if ! pr_body=$(curl -s -H "Authorization: token ${GITHUB_TOKEN}" \
65+
"https://api.github.com/repos/${GITHUB_REPOSITORY}/pulls/${pr_number}" | \
66+
jq -r .body); then
67+
echo "Failed to fetch PR body."
68+
on_error 1
69+
fi
70+
71+
# Check for the contributing guidelines checkbox:
72+
if echo "${pr_body}" | grep -qE '^\s*-\s*\[x\]\s*Read,\s*understood,\s*and\s*followed\s*the\s*\[contributing\s*guidelines\]'; then
73+
echo "Contributing guidelines acknowledged."
74+
print_success
75+
exit 0
76+
else
77+
echo "Contributing guidelines not acknowledged."
78+
79+
# Post a comment on the PR:
80+
comment="Hello! Thank you for your contribution to stdlib.
81+
82+
We noticed that the contributing guidelines acknowledgment is missing from your pull request. Here's what you need to do:
83+
84+
1. Please read our [contributing guidelines][contributing].
85+
2. Update your pull request description to include this checked box:
86+
87+
\`- [x] Read, understood, and followed the [contributing guidelines](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md)\`
88+
89+
This acknowledgment confirms that you've read the guidelines, which include:
90+
91+
- The developer's certificate of origin
92+
- Your agreement to license your contributions under the project's terms
93+
94+
We can't review or accept contributions without this acknowledgment.
95+
96+
Thank you for your understanding and cooperation. We look forward to reviewing your contribution!"
97+
98+
if ! curl -s -X POST \
99+
-H "Authorization: token ${GITHUB_TOKEN}" \
100+
-H "Accept: application/vnd.github.v3+json" \
101+
"https://api.github.com/repos/${GITHUB_REPOSITORY}/issues/${pr_number}/comments" \
102+
-d "{\"body\":$(echo "$comment" | jq -R -s -c .)}"; then
103+
echo "Failed to post comment on PR."
104+
on_error 1
105+
fi
106+
107+
exit 1
108+
fi
109+
}
110+
111+
# Set an error handler to print captured output and perform any clean-up tasks:
112+
trap 'on_error' ERR
113+
114+
# Run main:
115+
main

.github/workflows/scripts/lint_javascript_files

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,35 +54,35 @@ files=$(echo "${files_to_lint}" | tr ' ' '\n' | grep '\.js$' | grep -v -e '/exam
5454
# Build native addons if present:
5555
packages=$(echo "${files}" | tr ' ' '\n' | sed 's/^lib\/node_modules\///g' | sed 's/\/lib\/.*//g' | sort | uniq)
5656
for pkg in ${packages}; do
57-
if [ -f "lib/node_modules/${pkg}/binding.gyp" ]; then
58-
NODE_ADDONS_PATTERN="${pkg}" make install-node-addons
59-
fi
57+
if [ -f "lib/node_modules/${pkg}/binding.gyp" ]; then
58+
NODE_ADDONS_PATTERN="${pkg}" make install-node-addons
59+
fi
6060
done
6161

6262
if [[ -n "${files}" ]]; then
63-
make lint-javascript-files FIX="${fix}" FILES="${files}"
63+
make lint-javascript-files FIX="${fix}" FILES="${files}"
6464
fi
6565

6666
# Lint JavaScript command-line interfaces...
6767
file=$(echo "${files_to_lint}" | tr ' ' '\n' | grep '\.js$' | grep -E '/bin/cli$' | tr '\n' ' ' | sed 's/ $//')
6868
if [[ -n "${file}" ]]; then
69-
make lint-javascript-files FIX="${fix}" FILES="${file}"
69+
make lint-javascript-files FIX="${fix}" FILES="${file}"
7070
fi
7171

7272
# Lint JavaScript example files:
7373
files=$(echo "${files_to_lint}" | tr ' ' '\n' | grep '/examples/.*\.js$' | tr '\n' ' ' | sed 's/ $//')
7474
if [[ -n "${files}" ]]; then
75-
make lint-javascript-files FIX="${fix}" FILES="${files}" ESLINT_CONF="${eslint_examples_conf}"
75+
make lint-javascript-files FIX="${fix}" FILES="${files}" ESLINT_CONF="${eslint_examples_conf}"
7676
fi
7777

7878
# Lint JavaScript test files:
7979
files=$(echo "${files_to_lint}" | tr ' ' '\n' | grep '/test/.*\.js$' | tr '\n' ' ' | sed 's/ $//')
8080
if [[ -n "${files}" ]]; then
81-
make lint-javascript-files FIX="${fix}" FILES="${files}" ESLINT_CONF="${eslint_tests_conf}"
81+
make lint-javascript-files FIX="${fix}" FILES="${files}" ESLINT_CONF="${eslint_tests_conf}"
8282
fi
8383

8484
# Lint JavaScript benchmark files:
8585
files=$(echo "${files_to_lint}" | tr ' ' '\n' | grep '/benchmark/.*\.js$' | tr '\n' ' ' | sed 's/ $//')
8686
if [[ -n "${files}" ]]; then
87-
make lint-javascript-files FIX="${fix}" FILES="${files}" ESLINT_CONF="${eslint_benchmarks_conf}"
87+
make lint-javascript-files FIX="${fix}" FILES="${files}" ESLINT_CONF="${eslint_benchmarks_conf}"
8888
fi

.github/workflows/scripts/remove_related_packages

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -32,30 +32,30 @@
3232
set -o pipefail
3333

3434
for file in ${@}; do
35-
if [[ $file == *README.md ]]; then
36-
awk '
37-
BEGIN { print_mode = 1; in_related = 0; in_related_links = 0 }
38-
/<section class="related">/ {
39-
print; print ""; print "</section>";
40-
in_related = 1; print_mode = 0; next
41-
}
42-
/<\/section>/ {
43-
if (in_related) { in_related = 0; print_mode = 1 }
44-
else { print }
45-
next
46-
}
47-
/<!-- <related-links> -->/ {
48-
print; print ""; print "<!-- </related-links> -->";
49-
in_related_links = 1; print_mode = 0; next
50-
}
51-
/<!-- <\/related-links> -->/ {
52-
if (in_related_links) { in_related_links = 0; print_mode = 1 }
53-
else { print }
54-
next
55-
}
56-
{ if (print_mode == 1) print }
57-
' "$file" > "${file}.tmp" && mv "${file}.tmp" "$file"
58-
fi
35+
if [[ $file == *README.md ]]; then
36+
awk '
37+
BEGIN { print_mode = 1; in_related = 0; in_related_links = 0 }
38+
/<section class="related">/ {
39+
print; print ""; print "</section>";
40+
in_related = 1; print_mode = 0; next
41+
}
42+
/<\/section>/ {
43+
if (in_related) { in_related = 0; print_mode = 1 }
44+
else { print }
45+
next
46+
}
47+
/<!-- <related-links> -->/ {
48+
print; print ""; print "<!-- </related-links> -->";
49+
in_related_links = 1; print_mode = 0; next
50+
}
51+
/<!-- <\/related-links> -->/ {
52+
if (in_related_links) { in_related_links = 0; print_mode = 1 }
53+
else { print }
54+
next
55+
}
56+
{ if (print_mode == 1) print }
57+
' "$file" > "${file}.tmp" && mv "${file}.tmp" "$file"
58+
fi
5959
done
6060

6161
echo "All files processed successfully."

0 commit comments

Comments
 (0)