0.0.5 • Published 4 years ago

shakti-require v0.0.5

Weekly downloads
5
License
MIT
Repository
github
Last release
4 years ago

shakti-require

Dependency management for Shakti inspired by node

CircleCI

Getting started

You can use Yarn or npm manage shakti dependencies.

Install Yarn

Run:

yarn init
yarn add shakti-require
yarn add example-shakti-module

Then at the start of your program run:

\l ./node_modules/shakti-require/require.k
.rq.init[]

You then require other modules like this:

.rq.require["example-shakti-module"] / loads the module from ./node_modules
.example.add[1;2] / call loaded function
.rq.require["./exampleModule.k"]

or

.rq.requireWithoutCache["./exampleModule.k"]

Require syntax

You can pass the require function an absolute or relative path.

If your path doesn't end with .k it will append /import.k to the end of your path:

Examples

\l ./node_modules/shakti-require/require.k

.rq.require["./exampleModule.k"]

.rq.require["./folder/import.k"]

.rq.require["./folder"] / same as above

.rq.require["module"] / this resolves to node_modules/module/import.k

.rq.require["module/folder"] / this resolves to node_modules/module/folder/import.k

.rq.require["module/folder/import.k"] / this resolves to node_modules/module/folder/import.k

.rq.require["module/folder/import.k"] / won't run module/folder/import.k again a cached response is returned

.rq.requireWithoutCache["module/folder/import.k"] / loads ./exampleModule.k again

Example module

We've written an example shakti module which has been published to npm here: https://github.com/quicktick/example-shakti-module

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago