From a5eec50e72713221d16d598fc0fa9d4297048ec4 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 19 Aug 2023 01:44:49 +0000 Subject: [PATCH] Auto-generated commit --- .github/workflows/productionize.yml | 26 +++++-------------- .github/workflows/publish.yml | 39 +++++++++++++++++++++++------ .github/workflows/test.yml | 7 +++++- .github/workflows/test_bundles.yml | 6 ++--- .github/workflows/test_coverage.yml | 2 +- .github/workflows/test_install.yml | 2 +- .gitignore | 4 +++ CONTRIBUTORS | 19 ++++++++++---- README.md | 2 +- dist/index.d.ts | 3 +++ dist/index.js | 5 ++++ dist/index.js.map | 7 ++++++ docs/types/index.d.ts | 2 +- 13 files changed, 84 insertions(+), 40 deletions(-) create mode 100644 dist/index.d.ts create mode 100644 dist/index.js create mode 100644 dist/index.js.map diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml index c95f71c..91f2b93 100644 --- a/.github/workflows/productionize.yml +++ b/.github/workflows/productionize.yml @@ -82,28 +82,14 @@ jobs: id: transform-error-messages uses: stdlib-js/transform-errors-action@main - # Format error messages: - - name: 'Replace double quotes with single quotes in rewritten format string error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\( \"([a-zA-Z0-9]+)\"/Error\( format\( '\1'/g" {} \; - - # Format string literal error messages: - - name: 'Replace double quotes with single quotes in rewritten string literal error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\(\"([a-zA-Z0-9]+)\"\)/Error\( format\( '\1' \)/g" {} \; - - # Format code: - - name: 'Replace double quotes with single quotes in inserted `require` calls' - run: | - find . -name "*.js" -exec sed -E -i "s/require\( ?\"@stdlib\/error-tools-fmtprodmsg\" ?\);/require\( '@stdlib\/error-tools-fmtprodmsg' \);/g" {} \; - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - name: 'Update dependencies in package.json' run: | + PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\"/\"@stdlib\/error-tools-fmtprodmsg\"/g" package.json + sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json else - 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 ) );" + 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 ) );" fi # Configure git: @@ -348,7 +334,7 @@ jobs: # Send status to Slack channel if job fails: - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v1 + uses: act10ns/slack@v2 with: status: ${{ job.status }} steps: ${{ toJson(steps) }} @@ -519,7 +505,7 @@ jobs: # Send status to Slack channel if job fails: - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v1 + uses: act10ns/slack@v2 with: status: ${{ job.status }} steps: ${{ toJson(steps) }} @@ -696,7 +682,7 @@ jobs: # Send status to Slack channel if job fails: - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v1 + uses: act10ns/slack@v2 with: status: ${{ job.status }} steps: ${{ toJson(steps) }} diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index e038460..474004b 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -105,15 +105,19 @@ jobs: - name: 'Remove CLI' if: ${{ github.ref == 'refs/heads/main' }} run: | + # Exit if the package does not have a CLI: + if ! grep -q '"bin":' package.json; then + exit 0 + fi rm -rf ./bin/cli - rm test/test.cli.js - rm etc/cli_opts.json - rm docs/usage.txt + rm -f test/test.cli.js + rm -f etc/cli_opts.json + rm -f docs/usage.txt # For all dependencies, check in all *.js files if they are still used; if not, remove them: jq -r '.dependencies | keys[]' ./package.json | while read -r dep; do dep=$(echo "$dep" | xargs) - if ! grep -q "$dep" lib/**; then + if ! grep -q "$dep" lib/** && ! grep -q -s "$dep" manifest.json && ! grep -q -s "$dep" include.gypi; then jq --indent 2 "del(.dependencies[\"$dep\"])" ./package.json > ./package.json.tmp mv ./package.json.tmp ./package.json fi @@ -123,7 +127,7 @@ jobs: continue fi dep=$(echo "$dep" | xargs) - if ! grep -q "$dep" ./lib/**; then + if ! grep -q "$dep" lib/** && ! grep -q -s "$dep" manifest.json && ! grep -q -s "$dep" include.gypi; then jq --indent 2 "del(.devDependencies[\"$dep\"])" ./package.json > ./package.json.tmp mv ./package.json.tmp ./package.json fi @@ -136,6 +140,21 @@ jobs: jq -r 'del(.bin)' package.json > package.json.tmp mv package.json.tmp package.json + # Add entry for CLI package to See Also section of README.md: + cliPkgName=$(jq -r '.name' package.json)-cli + escapedPkg=$(echo "$cliPkgName" | sed -e 's/\//\\\//g') + escapedPkg=$(echo "$escapedPkg" | sed -e 's/\@/\\\@/g') + find . -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
(?:\n\n\* \* \*\n\n## See Also\n\n)?/
\n\n## See Also\n\n- [\`$escapedPkg\`][$escapedPkg]<\/span>: <\/span>CLI package for use as a command-line utility.<\/span>\n/" + + # Add link definition for CLI package to README.md: + find . -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
/
\n\n[$escapedPkg]: https:\/\/www.npmjs.com\/package\/$escapedPkg/" + + # Replace GitHub MathJax equations with SVGs: + - name: 'Replace GitHub MathJax equations with SVGs' + run: | + find . -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe 's/```math\n([\s\S]+?)\n```\n\n//g' + find . -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe 's/)/
/sg' + # Replace GitHub links to individual packages with npm links: - name: 'Replace all GitHub links to individual packages with npm links' run: | @@ -146,6 +165,12 @@ jobs: run: | find . -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`\n\nAlternatively,[^<]+<\/section>/\`\`\`\n\n<\/section>/" + # Remove unnecessary files: + - name: 'Remove unnecessary files' + run: | + rm -f docs/repl.txt + rm -f docs/types/test.ts + # Replace all stdlib GitHub dependencies with the respective npm packages: - name: 'Replace all stdlib GitHub dependencies with the respective npm packages' run: | @@ -172,7 +197,7 @@ jobs: # Publish package to npm: - name: 'Publish package to npm' - uses: JS-DevTools/npm-publish@v1 + uses: JS-DevTools/npm-publish@v2 with: token: ${{ secrets.NPM_TOKEN }} access: public @@ -184,7 +209,7 @@ jobs: # Send status to Slack channel if job fails: - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v1 + uses: act10ns/slack@v2 with: status: ${{ job.status }} steps: ${{ toJson(steps) }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3d588ad..8aa62bc 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -32,6 +32,11 @@ on: # Run workflow on each push to the main branch: push: + # Run workflow upon completion of `publish` workflow run: + workflow_run: + workflows: ["publish"] + types: [completed] + # Workflow jobs: jobs: @@ -84,7 +89,7 @@ jobs: # Send status to Slack channel if job fails: - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v1 + uses: act10ns/slack@v2 with: status: ${{ job.status }} steps: ${{ toJson(steps) }} diff --git a/.github/workflows/test_bundles.yml b/.github/workflows/test_bundles.yml index e9df6a0..172cb2d 100644 --- a/.github/workflows/test_bundles.yml +++ b/.github/workflows/test_bundles.yml @@ -88,7 +88,7 @@ jobs: # Send notification to Slack channel if job fails: - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v1 + uses: act10ns/slack@v2 with: status: ${{ job.status }} steps: ${{ toJson(steps) }} @@ -130,7 +130,7 @@ jobs: # Send notification to Slack channel if job fails: - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v1 + uses: act10ns/slack@v2 with: status: ${{ job.status }} steps: ${{ toJson(steps) }} @@ -172,7 +172,7 @@ jobs: # Send notification to Slack channel if job fails: - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v1 + uses: act10ns/slack@v2 with: status: ${{ job.status }} steps: ${{ toJson(steps) }} diff --git a/.github/workflows/test_coverage.yml b/.github/workflows/test_coverage.yml index 6d8aa0b..a73c515 100644 --- a/.github/workflows/test_coverage.yml +++ b/.github/workflows/test_coverage.yml @@ -106,7 +106,7 @@ jobs: # Send Slack notification if job fails: - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v1 + uses: act10ns/slack@v2 with: status: ${{ job.status }} steps: ${{ toJson(steps) }} diff --git a/.github/workflows/test_install.yml b/.github/workflows/test_install.yml index 79e4151..7abe989 100644 --- a/.github/workflows/test_install.yml +++ b/.github/workflows/test_install.yml @@ -75,7 +75,7 @@ jobs: # Send Slack notification if job fails: - name: 'Send notification to Slack in case of failure' - uses: act10ns/slack@v1 + uses: act10ns/slack@v2 with: status: ${{ job.status }} steps: ${{ toJson(steps) }} diff --git a/.gitignore b/.gitignore index 9641214..49b206b 100644 --- a/.gitignore +++ b/.gitignore @@ -182,3 +182,7 @@ jsconfig.json ################ *.sublime-workspace *.sublime-project + +# Other editor files # +###################### +.idea/ diff --git a/CONTRIBUTORS b/CONTRIBUTORS index f97b6ef..93c4bde 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -3,28 +3,37 @@ # Contributors listed in alphabetical order. Ali Salesi +Amit Jimiwal Athan Reines Brendan Graetz Bruno Fenzl Christopher Dambamuromo +Dan Rose Dominik Moritz +Dorrin Sotoudeh Frank Kovacs -James +Harshita Kalani +James Gelok Jithin KS Joey Reed +Jordan Gallivan <115050475+Jordan-Gallivan@users.noreply.github.com> Joris Labie Justin Dennison -Marcus +Marcus Fantham Matt Cochrane Milan Raj Momtchil Momtchev +Naresh Jagadeesan +Nithin Katta <88046362+nithinkatta@users.noreply.github.com> Ognjen Jevremović Philipp Burckhardt -Pranav <85227306+Pranavchiku@users.noreply.github.com> +Pranav Goswami Ricky Reusser +Roman Stetsyk <25715951+romanstetsyk@users.noreply.github.com> Ryan Seal Seyyed Parsa Neshaei Shraddheya Shendre Stephannie Jiménez Gacha -dorrin-sot <59933477+dorrin-sot@users.noreply.github.com> -rei2hu +Yernar Yergaziyev +orimiles5 <97595296+orimiles5@users.noreply.github.com> +rei2hu diff --git a/README.md b/README.md index 18e2ae9..ea79d12 100644 --- a/README.md +++ b/README.md @@ -212,7 +212,7 @@ Copyright © 2016-2023. The Stdlib [Authors][stdlib-authors]. --> [chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg -[chat-url]: https://gitter.im/stdlib-js/stdlib/ +[chat-url]: https://app.gitter.im/#/room/#stdlib-js_stdlib:gitter.im [stdlib]: https://github.com/stdlib-js/stdlib diff --git a/dist/index.d.ts b/dist/index.d.ts new file mode 100644 index 0000000..25ee3bc --- /dev/null +++ b/dist/index.d.ts @@ -0,0 +1,3 @@ +/// +import onesLike from '../docs/types/index'; +export = onesLike; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js new file mode 100644 index 0000000..34e3b19 --- /dev/null +++ b/dist/index.js @@ -0,0 +1,5 @@ +"use strict";var u=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var i=u(function(g,t){ +var n=require('@stdlib/array-dtype/dist'),l=require('@stdlib/array-full/dist'),s=require('@stdlib/complex-float64/dist'),o=require('@stdlib/complex-float32/dist'),m=require('@stdlib/error-tools-fmtprodmsg/dist'),v=new s(1,0),p=new o(1,0);function f(e){var r,a;if(r=n(e),r===null)throw new TypeError(m('01B2f',e));return arguments.length>1&&(r=arguments[1]),r==="complex128"?a=v:r==="complex64"?a=p:a=1,l(e.length,a,r)}t.exports=f +});var y=i();module.exports=y; +/** @license Apache-2.0 */ +//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map new file mode 100644 index 0000000..2b13d9b --- /dev/null +++ b/dist/index.js.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["../lib/main.js", "../lib/index.js"], + "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar dtype = require( '@stdlib/array-dtype' );\nvar full = require( '@stdlib/array-full' );\nvar Complex128 = require( '@stdlib/complex-float64' );\nvar Complex64 = require( '@stdlib/complex-float32' );\nvar format = require( '@stdlib/string-format' );\n\n\n// VARIABLES //\n\nvar Z128 = new Complex128( 1.0, 0.0 );\nvar Z64 = new Complex64( 1.0, 0.0 );\n\n\n// MAIN //\n\n/**\n* Creates an array filled with ones and having the same length and data type as a provided input array.\n*\n* @param {(Array|TypedArray|ComplexArray)} x - input array\n* @param {string} [dtype] - data type\n* @throws {TypeError} first argument must be an array or typed array\n* @throws {TypeError} second argument must be a recognized data type\n* @returns {(TypedArray|Array|ComplexArray)} array or typed array\n*\n* @example\n* var arr = onesLike( [ 0.0, 0.0 ] );\n* // returns [ 1.0, 1.0 ]\n*\n* @example\n* var arr = onesLike( [ 0.0, 0.0 ], 'float32' );\n* // returns [ 1.0, 1.0 ]\n*/\nfunction onesLike( x ) {\n\tvar dt;\n\tvar v;\n\n\tdt = dtype( x ); // delegate input argument validation to dtype resolution\n\tif ( dt === null ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be either an array, typed array, or complex typed array. Value: `%s`.', x ) );\n\t}\n\tif ( arguments.length > 1 ) {\n\t\tdt = arguments[ 1 ];\n\t}\n\tif ( dt === 'complex128' ) {\n\t\tv = Z128;\n\t} else if ( dt === 'complex64' ) {\n\t\tv = Z64;\n\t} else {\n\t\tv = 1.0;\n\t}\n\treturn full( x.length, v, dt );\n}\n\n\n// EXPORTS //\n\nmodule.exports = onesLike;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Create an array filled with ones and having the same length and data type as a provided input array.\n*\n* @module @stdlib/array-ones-like\n*\n* @example\n* var onesLike = require( '@stdlib/array-ones-like' );\n*\n* var arr = onesLike( [ 0.0, 0.0 ] );\n* // returns [ 1.0, 1.0 ]\n*\n* @example\n* var onesLike = require( '@stdlib/array-ones-like' );\n*\n* var arr = onesLike( [ 0.0, 0.0 ], 'float32' );\n* // returns [ 1.0, 1.0 ]\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], + "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAQ,QAAS,qBAAsB,EACvCC,EAAO,QAAS,oBAAqB,EACrCC,EAAa,QAAS,yBAA0B,EAChDC,EAAY,QAAS,yBAA0B,EAC/CC,EAAS,QAAS,uBAAwB,EAK1CC,EAAO,IAAIH,EAAY,EAAK,CAAI,EAChCI,EAAM,IAAIH,EAAW,EAAK,CAAI,EAsBlC,SAASI,EAAUC,EAAI,CACtB,IAAIC,EACAC,EAGJ,GADAD,EAAKT,EAAOQ,CAAE,EACTC,IAAO,KACX,MAAM,IAAI,UAAWL,EAAQ,8GAA+GI,CAAE,CAAE,EAEjJ,OAAK,UAAU,OAAS,IACvBC,EAAK,UAAW,CAAE,GAEdA,IAAO,aACXC,EAAIL,EACOI,IAAO,YAClBC,EAAIJ,EAEJI,EAAI,EAEET,EAAMO,EAAE,OAAQE,EAAGD,CAAG,CAC9B,CAKAV,EAAO,QAAUQ,ICtCjB,IAAII,EAAO,IAKX,OAAO,QAAUA", + "names": ["require_main", "__commonJSMin", "exports", "module", "dtype", "full", "Complex128", "Complex64", "format", "Z128", "Z64", "onesLike", "x", "dt", "v", "main"] +} diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts index 2f6a251..6500fd4 100644 --- a/docs/types/index.d.ts +++ b/docs/types/index.d.ts @@ -16,7 +16,7 @@ * limitations under the License. */ -// TypeScript Version: 2.0 +// TypeScript Version: 4.1 ///