Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/stdlib-js/stdlib into de…
Browse files Browse the repository at this point in the history
…velop
  • Loading branch information
kgryte committed Jul 26, 2024
2 parents 812e033 + 7047c43 commit 72fae22
Show file tree
Hide file tree
Showing 70 changed files with 8,645 additions and 690 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/scaffold_pkg_via_branch_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
added-files: ${{ steps.changed-files.outputs.files }}

# Configure git:
- name: 'Configure git'
# Configure Git:
- name: 'Configure Git'
run: |
git config --local user.email "[email protected]"
git config --local user.name "stdlib-bot"
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/standalone_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,17 @@ jobs:
lfs: false
timeout-minutes: 10

# Configure Git:
- name: 'Configure Git'
run: |
git config --local user.email "[email protected]"
git config --local user.name "stdlib-bot"
# Apply Git notes:
- name: 'Apply Git notes'
run: |
make apply-git-notes
# Install Node.js:
- name: 'Install Node.js'
# Pin action to full length commit SHA
Expand Down
12 changes: 12 additions & 0 deletions .github/workflows/standalone_publish_custom.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,18 @@ jobs:
lfs: false
timeout-minutes: 10

# Configure Git:
- name: 'Configure Git'
run: |
git config --local user.email "[email protected]"
git config --local user.name "stdlib-bot"
# Apply Git notes:
- name: 'Apply Git notes'
run: |
make apply-git-notes
timeout-minutes: 5

# Install Node.js:
- name: 'Install Node.js'
# Pin action to full length commit SHA
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/standalone_push_changes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,17 @@ jobs:
lfs: false
timeout-minutes: 10

# Configure Git:
- name: 'Configure Git'
run: |
git config --local user.email "[email protected]"
git config --local user.name "stdlib-bot"
# Apply Git notes:
- name: 'Apply Git notes'
run: |
make apply-git-notes
# Install Node.js:
- name: 'Install Node.js'
# Pin action to full length commit SHA
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ Muhammad Haris <[email protected]>
Naresh Jagadeesan <[email protected]>
NightKnight <[email protected]>
Nithin Katta <[email protected]>
Nourhan Hasan <[email protected]>
Ognjen Jevremović <[email protected]>
Oneday12323 <[email protected]>
Philipp Burckhardt <[email protected]>
Expand Down
46 changes: 33 additions & 13 deletions lib/node_modules/@stdlib/_tools/changelog/generate/lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
* limitations under the License.
*/

/* eslint-disable max-statements */

'use strict';

// MODULES //
Expand All @@ -26,7 +28,6 @@ var semver = require( 'semver' );
var recommendVersionBump = require( '@stdlib/_tools/changelog/recommend-version-bump' );
var name2standalone = require( '@stdlib/_tools/pkgs/name2standalone' );
var substringAfter = require( '@stdlib/string/substring-after' );
var objectEntries = require( '@stdlib/utils/entries' );
var parseCommits = require( '@stdlib/_tools/changelog/parse-commits' );
var objectKeys = require( '@stdlib/utils/keys' );
var namespaces = require( '@stdlib/_tools/pkgs/namespaces' ).sync;
Expand Down Expand Up @@ -58,6 +59,7 @@ var STDLIB_REPO_NODE_PATH = 'https://github.com/stdlib-js/stdlib/tree/develop/li
var RE_PACKAGE_SUBDIRS = /\/?(benchmark|bin|data|docs|etc|examples|include|lib|scripts|src|test)\/?[\s\S]*$/;
var RE_MARKDOWN_HEADER = /(^#+)/gm;
var RE_EXTRANEOUS_NEWLINES = /\n{3,}/g;
var PLACEHOLDER_SUMMARY = 'No changes reported for this release.';


// FUNCTIONS //
Expand Down Expand Up @@ -258,13 +260,16 @@ function generate( pkg, releaseType ) {
isNamespacePkg = true;
standalone = '@stdlib/stdlib';
pkg = '';
releases = objectEntries( npmReleases( standalone ) );
releases = npmReleases( standalone );
} else {
// Case: all other packages
isNamespacePkg = contains( STDLIB_NAMESPACE_PKGS, pkg );
standalone = name2standalone( pkg );
pkg = replace( pkg, '@stdlib/', '' );
releases = objectEntries( npmReleases( standalone ) );
releases = npmReleases( standalone );
}
if ( releases.length > 0 ) {
newestRelease = releases[ releases.length-1 ][ 0 ];
}

str = '# CHANGELOG\n\n';
Expand All @@ -288,10 +293,19 @@ function generate( pkg, releaseType ) {

if ( releaseType === 'auto' ) {
releaseType = recommendVersionBump( commits.unreleased );

// If no bump is recommended, default to 'patch' as we still want to trigger a release:
if ( releaseType === null ) {
releaseType = 'patch';
}

// Ensure major bump only happens if we are already on a major release line:
if ( releaseType === 'major' && semver.major( newestRelease ) < 1 ) {
releaseType = 'minor';
}
}
if ( releaseType && releaseType !== 'none' ) {
if ( releases.length > 0 ) {
newestRelease = releases[ releases.length-1 ][ 0 ];
if ( newestRelease ) {
nextVersion = semver.inc( newestRelease, releaseType );
} else {
nextVersion = semver.inc( '0.0.0', releaseType );
Expand All @@ -311,8 +325,8 @@ function generate( pkg, releaseType ) {
for ( i = 0; i < pkgNames.length; i++ ) {
name = pkgNames[ i ];
unreleased = releaseSummary( bySubpackage[ name ], true, true );
if ( unreleased ) {
str += packageSummaryWrapper( pkg, '', name, unreleased );
if ( unreleased || nextVersion ) {
str += packageSummaryWrapper( pkg, '', name, unreleased || PLACEHOLDER_SUMMARY );
}
}
str += sectionEnd( 'packages' );
Expand All @@ -323,10 +337,10 @@ function generate( pkg, releaseType ) {
str += sectionEnd( 'release' );
} else {
unreleased = releaseSummary( commits.unreleased );
if ( unreleased ) {
if ( unreleased || nextVersion ) {
str += releaseSectionStart( nextVersion );
str += '## ' + ( nextVersion || 'Unreleased' ) + ' (' + formatDate() + ')\n\n';
str += unreleased;
str += unreleased || PLACEHOLDER_SUMMARY;
str += sectionEnd( 'release' );
}
}
Expand All @@ -335,7 +349,7 @@ function generate( pkg, releaseType ) {
version = releases[ i ][ 0 ];
releaseCommits = commits[ version ];
if ( !releaseCommits ) {
continue;
releaseCommits = [];
}
str += '## ' + version + ' (' + formatDate( releases[ i ][ 1 ] ) + ')\n\n';
bySubpackage = groupBySubPackage( releaseCommits, pkg );
Expand All @@ -346,7 +360,7 @@ function generate( pkg, releaseType ) {
name = pkgNames[ j ];
summary = releaseSummary( bySubpackage[ name ], true, true );
if ( !summary ) {
continue;
summary = PLACEHOLDER_SUMMARY;
}
str += packageSummaryWrapper( pkg, version, name, summary );
}
Expand All @@ -361,7 +375,7 @@ function generate( pkg, releaseType ) {
version = releases[ i ][ 0 ];
summary = releaseSummary( commits[ version ] );
if ( !summary ) {
continue;
summary = PLACEHOLDER_SUMMARY;
}
str += releaseSectionStart( version );
str += '## ' + version + ' (' + formatDate( releases[ i ][ 1 ] ) + ')\n\n';
Expand All @@ -382,13 +396,19 @@ function generate( pkg, releaseType ) {
* @returns {string} release indicator
*/
function indicator( commit ) {
var prevReleaseDate;
var releaseDate;
var date;
var i;
date = new Date( commit.date );

// Walk the releases in reverse chronological order:
for ( i = releases.length-1; i >= 0; i-- ) {
if ( date <= new Date( releases[ i ][ 1 ] ) ) {
releaseDate = new Date( releases[ i ][ 1 ] );

// Get the previous release date or set it to a very early date if none exists:
prevReleaseDate = ( i > 0 ) ? new Date( releases[ i-1 ][ 1 ] ) : new Date( 0 );
if ( date <= releaseDate && date > prevReleaseDate ) {
return releases[ i ][ 0 ]; // version
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
// MODULES //

var shell = require( 'child_process' ).execSync; // eslint-disable-line node/no-sync
var semver = require( 'semver' );
var logger = require( 'debug' );
var omit = require( '@stdlib/utils/omit' );
var rootDir = require( '@stdlib/_tools/utils/root-dir' );
Expand All @@ -35,35 +36,43 @@ var OMITTED_KEYS = [ 'created', 'modified', 'unpublished' ];
// MAIN //

/**
* Returns a list of published package versions and their release dates.
* Returns a two-element array of published package versions and their release dates.
*
* @private
* @param {string} pkg - package name
* @returns {Object} object mapping versions to release dates
* @returns {Array} two-element array of published package versions and their release dates
*
* @example
* var releases = npmReleases( '@stdlib/utils-omit' );
* // returns {...}
* // returns [...]
*/
function npmReleases( pkg ) {
var releases;
var command;
var version;
var opts;
var out;
var map;

command = 'npm view ' + pkg + ' time --json';
opts = {
'cwd': rootDir(),
'stdio': [ 'pipe', 'pipe', 'ignore' ] // stdin, stdout, stderr
};
try {
out = shell( command, opts ).toString();
out = JSON.parse( out );
map = shell( command, opts ).toString();
map = JSON.parse( map );
} catch ( err ) {
debug( 'Encountered an error when attempting to retrieve package release dates: %s', err.message );
return {};
}
out = omit( out, OMITTED_KEYS );
return out;
map = omit( map, OMITTED_KEYS );
releases = [];
for ( version in map ) {
if ( semver.valid( version ) && !semver.prerelease( version ) ) {
releases.push( [ version, map[ version ] ] );
}
}
return releases;
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ function main( context ) {
match = RE_REQUIRE.exec( tag.description );
if ( match ) {
// The main export should be required last, so no `require` calls should follow:
if ( match.index !== tag.description.lastIndexOf( 'require' ) ) {
if ( match.index !== tag.description.lastIndexOf( 'require(' ) ) {
report( 'Example code of main export should require itself last, i.e. contain `require( \'@'+modulePath+'\' )` as the last `require` call', loc );
}
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,12 @@ var Linter = require( 'eslint' ).Linter;
var rule = require( '@stdlib/_tools/eslint/rules/require-spaces' );

var linter = new Linter();
var result;

var code = 'var betainc = require(\'@stdlib/math/base/special/betainc\');';

linter.defineRule( 'require-spaces', rule );

result = linter.verify( code, {
var result = linter.verify( code, {
'rules': {
'require-spaces': 'error'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,12 @@ var Linter = require( 'eslint' ).Linter;
var rule = require( './../lib' );

var linter = new Linter();
var result;

var code = 'var betainc = require(\'@stdlib/math/base/special/betainc\');';

linter.defineRule( 'require-spaces', rule );

result = linter.verify( code, {
var result = linter.verify( code, {
'rules': {
'require-spaces': 'error'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
'use strict';

/**
* ESLint rule enforcing spaces in `require()` statements.
* ESLint rule enforcing spaces in `require` statements.
*
* @module @stdlib/_tools/eslint/rules/require-spaces
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,6 @@ function create( context ) {

// MAIN //

/**
* ESLint rule to enforce spaces in `require()` statements.
*
* @namespace rule
*/
rule = {
'meta': {
'type': 'layout',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ jobs:
# Pin action to full length commit SHA
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0

# Configure git:
- name: 'Configure git'
# Configure Git:
- name: 'Configure Git'
run: |
git config --local user.email "[email protected]"
git config --local user.name "stdlib-bot"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ jobs:
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:
- name: 'Configure git'
# Configure Git:
- name: 'Configure Git'
run: |
git config --local user.email "[email protected]"
git config --local user.name "stdlib-bot"
Expand Down Expand Up @@ -191,8 +191,8 @@ jobs:
# Pin action to full length commit SHA
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0

# Configure git:
- name: 'Configure git'
# Configure Git:
- name: 'Configure Git'
run: |
git config --local user.email "[email protected]"
git config --local user.name "stdlib-bot"
Expand Down Expand Up @@ -366,8 +366,8 @@ jobs:
# Pin action to full length commit SHA
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0

# Configure git:
- name: 'Configure git'
# Configure Git:
- name: 'Configure Git'
run: |
git config --local user.email "[email protected]"
git config --local user.name "stdlib-bot"
Expand Down Expand Up @@ -539,8 +539,8 @@ jobs:
# Pin action to full length commit SHA
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0

# Configure git:
- name: 'Configure git'
# Configure Git:
- name: 'Configure Git'
run: |
git config --local user.email "[email protected]"
git config --local user.name "stdlib-bot"
Expand Down Expand Up @@ -735,8 +735,8 @@ jobs:
echo "bump=true" >> $GITHUB_OUTPUT
fi

# Configure git:
- name: 'Configure git'
# Configure Git:
- name: 'Configure Git'
if: steps.check-if-bump.outputs.bump
run: |
git config --local user.email "[email protected]"
Expand Down
Loading

1 comment on commit 72fae22

@stdlib-bot
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage Report

Package Statements Branches Functions Lines
lapack/base/dlaswp $\color{green}400/400$
$\color{green}+100.00\%$
$\color{green}34/34$
$\color{green}+100.00\%$
$\color{green}3/3$
$\color{green}+100.00\%$
$\color{green}400/400$
$\color{green}+100.00\%$

The above coverage report was generated for the changes in this push.

Please sign in to comment.