Installations
npm install create-ts-index
Releases
Developer
imjuni
Developer Guide
Module System
CommonJS
Min. Node Version
Typescript Support
Yes
Node Version
16.12.0
NPM Version
8.1.0
Statistics
112 Stars
75 Commits
19 Forks
4 Watching
8 Branches
6 Contributors
Updated on 14 Nov 2024
Bundle Size
423.13 kB
Minified
113.21 kB
Minified + Gzipped
Languages
TypeScript (94.68%)
JavaScript (5.32%)
Total Downloads
Cumulative downloads
Total Downloads
1,968,039
Last day
11.7%
6,491
Compared to previous day
Last week
-1.1%
37,280
Compared to previous week
Last month
99.8%
134,001
Compared to previous month
Last year
100%
763,771
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dev Dependencies
29
create-ts-index
Install
1npm install create-ts-index --save-dev
Please using ctix
ctix next generation export generation tool. ctix use TypeScript compiler API. So Many problem solve in create-ts-index. For example, separate project(using by tsconfig.json) and support default function, auto detect file that have export statement, etc. I need more help for improvement at ctix.
Introduction
index.ts file create for exportation. If don't have business logic in index.ts that use to only exportation, create-ts-index help easy importing. Or if you have library project need this export process(for example, blueprint.js etc ...). cti(create-ts-index) create export index.ts file.
For example, sample directory below.
src/
app.ts
component/
Nav.ts
Button.ts
create-ts-index create sub-command create index.ts file below.
src/
app.ts
> index.ts
// created from 'create-ts-index'
export * from './component';
export * from './app';
component/
Nav.ts
Button.ts
> index.ts
// created from 'create-ts-index'
export * from './Nav';
export * from './Button';
create-ts-index entrypoint sub-command create index.ts file below.
src/
app.ts
component/
Nav.ts
Button.ts
> entrypoint.ts
// created from 'create-ts-index'
export * from './src/app.ts'
export * from './src/component/Nav.ts'
export * from './src/component/Button.ts'
Option
library
fileFirst: boolean
export list create filefirst. default falseaddNewline: boolean
decide add newline file ending. default trueuseSemicolon: boolean
decide use semicolon line ending. default trueuseTimestamp: boolean
decide use timestamp(YYYY-MM-DD HH:mm) top line comment. default falseincludeCWD: boolean
decide include cwd directory. default trueexcludes: string[]
pass exclude directory. default exclude directory is['@types', 'typings', '__test__', '__tests__']
fileExcludePatterns: string[]
pass exclude filename pattern. default exclude patterns is[]
targetExts: string[]
pass include extname. default extname is['ts', 'tsx']
. extname pass without dot character.globOptions: glob.IOptions
pass include glob options. node-glob option use it.quote
decide quote character. Single quote character use to default.verbose
verbose log message displaywithoutComment
remove create-ts-index comment that top of line in index.tswithoutBackupFile
Don't create backup file if already exists target fileoutput
index.ts or entrypoint.ts filename changeincludeDeclarationFiles
pass declaration files (*.d.ts). default is false
cli (use it cti)
-f --filefirst
export list create file first, no option false, option true-n --addnewline
decide add newline file ending. no option true, option false-s --usesemicolon
decide use semicolon line ending. no option true, option false-t --usetimestamp
decide use timestamp(YYYY-MM-DD HH:mm) top line comment. no option false, option true-c --includecwd
decide include cwd directory. no option true, option true-e --excludes [comma separated exclude directories]
pass exclude directory. default exclude directory is['@types', 'typings', '__test__', '__tests__']
-i --fileexcludes [comma separated extname]
pass exclude filename pattern. default exclude patterns is[]
-x --targetexts [comma separated extname]
pass include extname. default extname is['ts', 'tsx']
. extname pass without dot character.-q --quote
decide quote character. default quote character single quote-v --verbose
display verbose log message. no option false, option true-w --withoutcomment
remove create-ts-index comment that top of line in index.ts-b --withoutbackup
Don't create backup file if already exists target file-o --output
index.ts or entrypoint.ts filename change-d --includeDeclarationFiles
pass declaration files (*.d.ts). default is false
Usage
library
Use TypeScritIndexWriter
1const tsiw = new TypeScritIndexWriter(); 2const option = TypeScritIndexWriter.getDefaultOption('./src'); 3 4(async () => { 5 await tsiw.create(option); 6 7 // or 8 9 await tsiw.createEntrypoint(option); 10})();
Use CommandModule
1(async () => { 2 const option = CreateTsIndexOption.getOption({}); 3 const createCommand = new CreateCommandModule(); 4 await createCommand.do(process.cwd(), option); 5});
CLI
cli use git-style sub-command
- create
- cti create index.ts file
- entrypoint
- cti create webpack entrypoint
- init
- create
.ctirc
file
- create
- clean
- cti clean index.ts file recursively
1# basic usage 2cti create ./src # or cti create ./src 3## or 4cti entrypoint ./src # or cti create ./src 5 6# without newline 7 8## create sub-command, create sub-command is a default command 9cti -n ./src 10cti create -n ./src 11 12## entrypoint sub-command 13cti entrypoint -n ./src 14 15# custom exclude directories 16cti create -n -e @types,typings,__test__,__tests__,pages ./src 17## or 18cti entrypoint -n -e @types,typings,__test__,__tests__,pages ./src 19 20# clean index.ts 21cti clean ./src # or cti clean ./src 22 23# loop through every sub-directory in current path (thanks Mohsen) 24for f in *; do cti create ./$f; done 25 26# Pass variadic directories 27cti create ./src/server ./src/client ./src/module
CLI with .ctirc
create-ts-index cli support .ctirc
configuration file. Available name is only .ctirc
. .ctirc
configuration file can applied by each target directories and script working directory. Every configuration overwrited same feature. Also cti cli arguments forced applied. And .ctirc
file can write json5 format. json5 spec. can comment and more feature.
See below search, apply order.
1# execute on /Users/cti/github/create-ts-index 2sh> cti create ./example/type01 3 4# search configuration file on "/Users/cti/github/create-ts-index" 5# search configuration file on "/Users/cti/github/create-ts-index/example/type01" 6# apply configuration by "/Users/cti/github/create-ts-index" 7# apply configuration by "/Users/cti/github/create-ts-index/example/type01" 8# every configuration is overwrited
.ctirc creation
You can use cli for .ctirc
file creation.
1# create current directory 2> cti init 3 4# create multiple directory 5> cti init ./example/type03 ./example/type02
Language
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
Found 5/29 approved changesets -- score normalized to 1
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 6 are checked with a SAST tool
Reason
15 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3
- Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h
- Warn: Project is vulnerable to: GHSA-r683-j2x4-v87g
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-4wf5-vphf-c2xc
- Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3
- Warn: Project is vulnerable to: GHSA-hc6q-2mpp-qw7j
- Warn: Project is vulnerable to: GHSA-4vvj-4cpr-p986
- Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7
- Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q
Score
1.9
/10
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn MoreOther packages similar to create-ts-index
@types/serve-index
TypeScript definitions for serve-index
@redis/search
This package provides support for the [RediSearch](https://redisearch.io) module, which adds indexing and querying support for data stored in Redis Hashes or as JSON documents with the RedisJSON module. It extends the [Node Redis client](https://github.c
rope-sequence
Rope-based persistent sequence type
cyclist
Cyclist is an efficient cyclic list implemention.