Skip to content

Commit 28ecb46

Browse files
committed
Auto-generated commit
1 parent 39814c1 commit 28ecb46

File tree

9 files changed

+123
-25
lines changed

9 files changed

+123
-25
lines changed

.github/.keepalive

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2023-06-01T06:31:38.762Z

.github/workflows/productionize.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ on:
3939
workflows: ["publish"]
4040
types: [completed]
4141

42+
4243
# Concurrency group to prevent multiple concurrent executions:
4344
concurrency:
4445
group: productionize
@@ -99,10 +100,11 @@ jobs:
99100
# Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency:
100101
- name: 'Update dependencies in package.json'
101102
run: |
103+
PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version)
102104
if grep -q '"@stdlib/string-format"' package.json; then
103-
sed -i "s/\"@stdlib\/string-format\"/\"@stdlib\/error-tools-fmtprodmsg\"/g" package.json
105+
sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json
104106
else
105-
node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^0.0.x'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );"
107+
node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );"
106108
fi
107109
108110
# Configure git:

.github/workflows/publish.yml

Lines changed: 84 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
publish:
4747

4848
# Define display name:
49-
name: 'Publish to npm'
49+
name: 'Publish package to npm'
5050

5151
# Define the type of virtual host machine on which to run the job:
5252
runs-on: ubuntu-latest
@@ -90,17 +90,71 @@ jobs:
9090
NEW_VERSION=$(node -p "require('./package.json').version")
9191
9292
# Replace branch in README.md link definitions for badges with the new version:
93-
find . -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/branch[=:][^ ]+/branch=v${NEW_VERSION}/g"
93+
find . -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/branch([=:])[^ ]+/branch\1v${NEW_VERSION}/g"
9494
9595
# Create a new commit and tag:
9696
git add package.json README.md
9797
git commit -m "Release v${NEW_VERSION}"
98-
git tag -a "v${NEW_VERSION}" -m "Release v{NEW_VERSION}"
98+
git tag -a "v${NEW_VERSION}" -m "Release v${NEW_VERSION}"
9999
100100
# Push changes to GitHub:
101101
SLUG=${{ github.repository }}
102102
git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" --follow-tags
103103
104+
# Remove CLI:
105+
- name: 'Remove CLI'
106+
if: ${{ github.ref == 'refs/heads/main' }}
107+
run: |
108+
# Exit if the package does not have a CLI:
109+
if ! grep -q '"bin":' package.json; then
110+
exit 0
111+
fi
112+
rm -rf ./bin/cli
113+
rm -f test/test.cli.js
114+
rm -f etc/cli_opts.json
115+
rm -f docs/usage.txt
116+
117+
# For all dependencies, check in all *.js files if they are still used; if not, remove them:
118+
jq -r '.dependencies | keys[]' ./package.json | while read -r dep; do
119+
dep=$(echo "$dep" | xargs)
120+
if ! grep -q "$dep" lib/** && ! grep -q -s "$dep" manifest.json && ! grep -q -s "$dep" include.gypi; then
121+
jq --indent 2 "del(.dependencies[\"$dep\"])" ./package.json > ./package.json.tmp
122+
mv ./package.json.tmp ./package.json
123+
fi
124+
done
125+
jq -r '.devDependencies | keys[]' ./package.json | while read -r dep; do
126+
if [[ "$dep" != "@stdlib"* ]]; then
127+
continue
128+
fi
129+
dep=$(echo "$dep" | xargs)
130+
if ! grep -q "$dep" lib/** && ! grep -q -s "$dep" manifest.json && ! grep -q -s "$dep" include.gypi; then
131+
jq --indent 2 "del(.devDependencies[\"$dep\"])" ./package.json > ./package.json.tmp
132+
mv ./package.json.tmp ./package.json
133+
fi
134+
done
135+
136+
# Remove CLI section:
137+
find . -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?<section class=\"cli\">[\s\S]+?<\!\-\- \/.cli \-\->//"
138+
139+
# Remove CLI from package.json:
140+
jq -r 'del(.bin)' package.json > package.json.tmp
141+
mv package.json.tmp package.json
142+
143+
# Add entry for CLI package to See Also section of README.md:
144+
cliPkgName=$(jq -r '.name' package.json)-cli
145+
escapedPkg=$(echo "$cliPkgName" | sed -e 's/\//\\\//g')
146+
escapedPkg=$(echo "$escapedPkg" | sed -e 's/\@/\\\@/g')
147+
find . -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/<section class=\"related\">(?:\n\n\* \* \*\n\n## See Also\n\n)?/<section class=\"related\">\n\n## See Also\n\n- <span class=\"package-name\">[\`$escapedPkg\`][$escapedPkg]<\/span><span class=\"delimiter\">: <\/span><span class=\"description\">CLI package for use as a command-line utility.<\/span>\n/"
148+
149+
# Add link definition for CLI package to README.md:
150+
find . -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/<section class=\"links\">/<section class=\"links\">\n\n[$escapedPkg]: https:\/\/www.npmjs.com\/package\/$escapedPkg/"
151+
152+
# Replace GitHub MathJax equations with SVGs:
153+
- name: 'Replace GitHub MathJax equations with SVGs'
154+
run: |
155+
find . -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe 's/```math\n([\s\S]+?)\n```\n\n//g'
156+
find . -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe 's/<!-- <div class="equation"(.*)(<\/div>\s*-->)/<div class="equation"$1<\/div>/sg'
157+
104158
# Replace GitHub links to individual packages with npm links:
105159
- name: 'Replace all GitHub links to individual packages with npm links'
106160
run: |
@@ -111,14 +165,39 @@ jobs:
111165
run: |
112166
find . -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`\n\nAlternatively,[^<]+<\/section>/\`\`\`\n\n<\/section>/"
113167
168+
# Remove unnecessary files:
169+
- name: 'Remove unnecessary files'
170+
run: |
171+
rm -f docs/repl.txt
172+
rm -f docs/types/test.ts
173+
114174
# Replace all stdlib GitHub dependencies with the respective npm packages:
115175
- name: 'Replace all stdlib GitHub dependencies with the respective npm packages'
116176
run: |
117-
find package.json -type f -print0 | xargs -0 sed -Ei 's/"github:stdlib-js[^"]*"/"^0.0.x"/g'
177+
for dep in $(jq -r '.dependencies | keys | .[]' package.json); do
178+
if [[ "$dep" != "@stdlib"* ]]; then
179+
continue
180+
fi
181+
# Trim leading and trailing whitespace:
182+
dep=$(echo "$dep" | xargs)
183+
version="^$(npm view $dep version)"
184+
jq -r --arg dep "$dep" --arg version "$version" '.dependencies[$dep] = $version' package.json > package.json.tmp
185+
mv package.json.tmp package.json
186+
done
187+
for dep in $(jq -r '.devDependencies | keys | .[]' package.json); do
188+
if [[ "$dep" != "@stdlib"* ]]; then
189+
continue
190+
fi
191+
# Trim leading and trailing whitespace:
192+
dep=$(echo "$dep" | xargs)
193+
version="^$(npm view $dep version)"
194+
jq -r --arg dep "$dep" --arg version "$version" '.devDependencies[$dep] = $version' package.json > package.json.tmp
195+
mv package.json.tmp package.json
196+
done
118197
119198
# Publish package to npm:
120199
- name: 'Publish package to npm'
121-
uses: JS-DevTools/npm-publish@v1
200+
uses: JS-DevTools/npm-publish@v2
122201
with:
123202
token: ${{ secrets.NPM_TOKEN }}
124203
access: public

.github/workflows/test.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ on:
3232
# Run workflow on each push to the main branch:
3333
push:
3434

35+
# Run workflow upon completion of `publish` workflow run:
36+
workflow_run:
37+
workflows: ["publish"]
38+
types: [completed]
39+
3540
# Workflow jobs:
3641
jobs:
3742

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,3 +182,7 @@ jsconfig.json
182182
################
183183
*.sublime-workspace
184184
*.sublime-project
185+
186+
# Other editor files #
187+
######################
188+
.idea/

CONTRIBUTORS

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,29 @@ Bruno Fenzl <brunofenzl@gmail.com>
99
Christopher Dambamuromo <chridam@gmail.com>
1010
Dominik Moritz <domoritz@gmail.com>
1111
Frank Kovacs <fran70kk@gmail.com>
12+
Harshita Kalani <95532771+HarshitaKalani@users.noreply.github.com>
1213
James <jdgelok@gmail.com>
1314
Jithin KS <jithinks112@gmail.com>
1415
Joey Reed <joeyrreed@gmail.com>
16+
Jordan-Gallivan <115050475+Jordan-Gallivan@users.noreply.github.com>
1517
Joris Labie <joris.labie1@gmail.com>
1618
Justin Dennison <justin1dennison@gmail.com>
1719
Marcus <mfantham@users.noreply.github.com>
1820
Matt Cochrane <matthew.cochrane.eng@gmail.com>
1921
Milan Raj <rajsite@users.noreply.github.com>
2022
Momtchil Momtchev <momtchil@momtchev.com>
23+
Naresh Jagadeesan <37257700+Infinage@users.noreply.github.com>
2124
Ognjen Jevremović <ognjenjevremovic@users.noreply.github.com>
2225
Philipp Burckhardt <pburckhardt@outlook.com>
2326
Pranav <85227306+Pranavchiku@users.noreply.github.com>
2427
Ricky Reusser <rsreusser@gmail.com>
28+
Roman Stetsyk <25715951+romanstetsyk@users.noreply.github.com>
2529
Ryan Seal <splrk@users.noreply.github.com>
2630
Seyyed Parsa Neshaei <spneshaei@users.noreply.github.com>
2731
Shraddheya Shendre <shendreshraddheya@gmail.com>
2832
Stephannie Jiménez Gacha <steff456@hotmail.com>
33+
Yernar Yergaziyev <yernar.yergaziyev@erg.kz>
2934
dorrin-sot <59933477+dorrin-sot@users.noreply.github.com>
35+
drunken_devv <90555965+amitjimiwal@users.noreply.github.com>
36+
orimiles5 <97595296+orimiles5@users.noreply.github.com>
3037
rei2hu <rei2hu@users.noreply.github.com>

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,11 +165,11 @@ Copyright &copy; 2016-2023. The Stdlib [Authors][stdlib-authors].
165165
[npm-image]: http://img.shields.io/npm/v/@stdlib/array-base-zero-to.svg
166166
[npm-url]: https://npmjs.org/package/@stdlib/array-base-zero-to
167167

168-
[test-image]: https://github.com/stdlib-js/array-base-zero-to/actions/workflows/test.yml/badge.svg?branch=v0.0.6
169-
[test-url]: https://github.com/stdlib-js/array-base-zero-to/actions/workflows/test.yml?query=branch=v0.0.6
168+
[test-image]: https://github.com/stdlib-js/array-base-zero-to/actions/workflows/test.yml/badge.svg?branch=main
169+
[test-url]: https://github.com/stdlib-js/array-base-zero-to/actions/workflows/test.yml?query=branch:main
170170

171171
[coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/array-base-zero-to/main.svg
172-
[coverage-url]: https://codecov.io/github/stdlib-js/array-base-zero-to?branch=v0.0.6
172+
[coverage-url]: https://codecov.io/github/stdlib-js/array-base-zero-to?branch=main
173173

174174
<!--
175175
@@ -179,7 +179,7 @@ Copyright &copy; 2016-2023. The Stdlib [Authors][stdlib-authors].
179179
-->
180180

181181
[chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg
182-
[chat-url]: https://gitter.im/stdlib-js/stdlib/
182+
[chat-url]: https://app.gitter.im/#/room/#stdlib-js_stdlib:gitter.im
183183

184184
[stdlib]: https://github.com/stdlib-js/stdlib
185185

branches.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,12 @@ C -->|bundle| D[esm];
3838
C -->|bundle| E[deno];
3939
C -->|bundle| F[umd];
4040
41-
click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/zero-to"
42-
click B href "https://github.com/stdlib-js/array-base-zero-to/tree/main"
43-
click C href "https://github.com/stdlib-js/array-base-zero-to/tree/production"
44-
click D href "https://github.com/stdlib-js/array-base-zero-to/tree/esm"
45-
click E href "https://github.com/stdlib-js/array-base-zero-to/tree/deno"
46-
click F href "https://github.com/stdlib-js/array-base-zero-to/tree/umd"
41+
%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/zero-to"
42+
%% click B href "https://github.com/stdlib-js/array-base-zero-to/tree/main"
43+
%% click C href "https://github.com/stdlib-js/array-base-zero-to/tree/production"
44+
%% click D href "https://github.com/stdlib-js/array-base-zero-to/tree/esm"
45+
%% click E href "https://github.com/stdlib-js/array-base-zero-to/tree/deno"
46+
%% click F href "https://github.com/stdlib-js/array-base-zero-to/tree/umd"
4747
```
4848

4949
[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/zero-to

package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,12 @@
3838
},
3939
"dependencies": {},
4040
"devDependencies": {
41-
"@stdlib/array-base-filled-by": "^0.0.x",
42-
"@stdlib/assert-is-array": "^0.0.x",
43-
"@stdlib/bench": "^0.0.x",
44-
"@stdlib/blas-ext-base-gsort2hp": "^0.0.x",
45-
"@stdlib/math-base-special-pow": "^0.0.x",
46-
"@stdlib/random-base-randu": "^0.0.x",
41+
"@stdlib/array-base-filled-by": "^0.0.2",
42+
"@stdlib/assert-is-array": "^0.0.7",
43+
"@stdlib/bench": "^0.0.12",
44+
"@stdlib/blas-ext-base-gsort2hp": "^0.0.10",
45+
"@stdlib/math-base-special-pow": "^0.0.7",
46+
"@stdlib/random-base-randu": "^0.0.8",
4747
"tape": "git+https://github.com/kgryte/tape.git#fix/globby",
4848
"istanbul": "^0.4.1",
4949
"tap-min": "git+https://github.com/Planeshifter/tap-min.git"
@@ -77,7 +77,7 @@
7777
"unitspace"
7878
],
7979
"funding": {
80-
"type": "patreon",
81-
"url": "https://www.patreon.com/athan"
80+
"type": "opencollective",
81+
"url": "https://opencollective.com/stdlib"
8282
}
8383
}

0 commit comments

Comments
 (0)