Skip to content

Commit

Permalink
chore: add script to find packages with structured meta data
Browse files Browse the repository at this point in the history
  • Loading branch information
gunjjoshi committed Sep 18, 2024
1 parent 9f848ed commit e5a5959
Showing 1 changed file with 63 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#!/usr/bin/env node

/**
* @license Apache-2.0
*
* Copyright (c) 2024 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.
*/

'use strict';

// MODULES //

var resolve = require( 'path' ).resolve;
var findPkgs = require( '@stdlib/_tools/pkgs/find' ).sync;
var readJSON = require( '@stdlib/fs/read-json' ).sync;


// VARIABLES //

var ROOT_DIR = resolve( __dirname, '..', '..', '..', '..', '..' );


// MAIN //

/**
* Main execution sequence.
*
* @private
*/
function main() {
var pkgPath;
var pkgJson;
var pkgs;
var i;

pkgs = findPkgs({
'dir': ROOT_DIR,
'pattern': '**/math/base/special/*/package.json'
});

for ( i = 0; i < pkgs.length; i++ ) {
pkgPath = resolve( ROOT_DIR, pkgs[i] );
pkgJson = readJSON( pkgPath + '/package.json' );

if ( pkgJson && pkgJson.__stdlib__ && pkgJson.__stdlib__.scaffold ) { // eslint-disable-line no-underscore-dangle
console.log( pkgs[i] ); // eslint-disable-line no-console
}
}
}

main();

0 comments on commit e5a5959

Please sign in to comment.