0.8.0 • Published 8 months ago

ts-blocks v0.8.0

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

ts-blocks

Well documented, tested, self owned building blocks for TypeScript applications.

npx ts-blocks init

Check out our docs.

What is ts-blocks?

ts-blocks is a collection of well documented, tested utility functions and types that can be easily dropped into your project.

They have 0 dependencies and allow you to modify the code to your own requirements. This allows you to own the code without having to write it yourself every time.

Setup

Run the init command to setup the blocks.json file.

npx ts-blocks init

Adding Blocks

Single

npx ts-blocks add result

┌  ts-blocks
│
◇  Added result
│
└  All done!

Multiple

npx ts-blocks add result array-sum

┌  ts-blocks
│
◇  Added result
│
◇  Added array-sum
│
└  All done!

Blocks

All blocks can be found under the ./blocks directory or you can view the typedoc generated documentation here.

Tests

Each block is tested using vitest. By default we add these tests to your project when you add a block. To disable this behavior configure includeTests in your blocks.json file.

!NOTE If vitest isn't already installed in your project we will attempt to install it for you.

{
	"$schema": "https://unpkg.com/ts-blocks@0.1.0/schema.json",
	// ...
	"includeTests": false // disable including tests
}

Testing CLI Command

npx ts-blocks test

If you don't want to include the tests in your project source or simply want to keep your code up to date with the latest test cases you can run tests through the CLI.

Test single

ts-blocks test result

Test multiple

ts-blocks test result array-sum

Development

Adding New Blocks

To add a new block add it under a category in the ./blocks directory. Then make sure to go to ./src/blocks.ts and update the blocks object.

!NOTE No blocks currently require dependencies.

const blocks: Record<string, Block> = {
	result: {
		category: "types",
	},
	// ++++++
	"to-map": {
		category: "utilities",
	},
	// ++++++
};
0.8.0

8 months ago

0.7.1

8 months ago

0.7.0

8 months ago

0.6.0

9 months ago

0.5.0

9 months ago

0.4.2

9 months ago

0.4.1

9 months ago

0.4.0

9 months ago

0.3.2

9 months ago

0.3.1

9 months ago

0.3.0

9 months ago

0.2.1

9 months ago

0.2.0

9 months ago

0.1.0

9 months ago

0.0.2

9 months ago