Skip to content

Commit

Permalink
Resolve package type declaration directory
Browse files Browse the repository at this point in the history
  • Loading branch information
kgryte committed Oct 14, 2019
1 parent 098d3c6 commit a920ce1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tools/scripts/postinstall
Expand Up @@ -246,14 +246,22 @@ function main() {
// We need to empty out the `name` field in order to avoid running afoul of npm package name conventions (e.g., cannot have `'@stdlib/array/buffer'`; see https://docs.npmjs.com/files/package.json#name):
meta.name = '';

// Main entry point:
d = resolvePkg( pdir );
meta.main = path.join( d, pkg.main );
debug( 'Resolved package entry point: %s', meta.main );

// Browser entry point:
if ( pkg.browser ) {
meta.browser = path.join( d, pkg.browser );
debug( 'Resolved package browser entry point: %s', meta.browser );
}
// Package type declarations:
if ( pkg.types ) {
meta.types = path.join( d, pkg.types );
debug( 'Resolved package type declaration directory: %s', meta.types );
}
// Resolve the destination directory:
ndir = path.join( DEST_DIR, pdir );
if ( fs.existsSync( ndir ) ) {
debug( 'Destination directory already exists: %s', ndir );
Expand Down

0 comments on commit a920ce1

Please sign in to comment.