🚀 Big News:Socket Has Acquired Secure Annex.Learn More →
Socket
Book a DemoSign in
Socket

@programmerraj/create-index-js

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@programmerraj/create-index-js

Creates an index.js file which exports all the files from a directory.

latest
Source
npmnpm
Version
5.0.0
Version published
Weekly downloads
28
55.56%
Maintainers
1
Weekly downloads
 
Created
Source

@programmerraj/create-index-js

Creates an index.js file which exports all the files from a directory.

Created with TS-Standard - Typescript Standard Style Guide

Isn't this so inconvenient:

import a from './dir/a.js'
import b from './dir/b.js'

Instead you can do this:

import { a, b } from './dir/index.js'

./dir/index.js Will be automatically generated:

export a from './a.js'
export b from './b.js'

Sub directories are also exported:

export { default as goodNumber } from './goodNumber.js'
export { default as isOdd } from './isOdd.js'
export * as fruits from './fruits/index.js'

CLI Usage

create-index-js myDir

Watch Mode

Use -w or --watch option to re-create file when files get created or deleted. This mode is efficient because it only re-creates the file when it needs to, and doesn't do any extra file system operations.

Other Options

Do -h or --help to see all options

Programmatic Usage

All helper files are exported, but the files that are probably useful are run/run.js and runWithWatch/runWithWatch.js.

Run

import { run } from '@programmerraj/create-index-js'

run.run(options)

Run in Watch Mode

import { runWithWatch } from '@programmerraj/create-index-js'

runWithWatch.runWithWatch(options)

Docs

TypeScript types are published. You can see the online TypeDocs at https://chocolateloverraj.github.io/create-index-js.

FAQs

Package last updated on 26 Mar 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts