• Stars
    star
    287
  • Rank 144,232 (Top 3 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created over 9 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Tool for generating utility libraries

中文

Eustia

NPM version Build status Test coverage License

Eustia is a tool for generating JavaScript utility libraries. It scans your code to generate libraries containing only methods needed on the fly.

screen shot

Installation

You can install Eustia using Node Package Manager(npm).

npm install -g eustia

Quick Example

Suppose you want to use trim function in index.html, just write the code down as follows:

<html>
<head>
    <meta charset="utf-8"/>
    <title>Eustia</title>
    <script src="util.js"></script>
</head>
<body>
    <script>
    var projectName = _.trim(' Eustia ');
    // Some code...
    </script>
</body>
</html>

Run command:

eustia build

The tool will scan you html code and generate a file name util.js(Default output file name). And that is it, everything is just done!

Use a Configuration File

You can use Eustia with command lines totally. It usually follows the same pattern described below:

eustia build -o util.js index.html *.js ...<list of files to be scanned>

It's also possible to use a configuration file to save settings. This is pretty helpful especially when you want to generate multiple utility libraries for different sections of your website.

Just create a file named .eustia in your project root.

{
    "page": {
        "files": "./layout/**/*.jade",
        "output": "./static/js/eustia.js"
    },
    "node": {
        "files": ["./lib/*.js", "./tool/**/*.js"],
        "output": "./lib/util.js"
    }
}

Running Eustia without any sub commands, the tool will find .eustia under current working directory to read configuration to generate libraries. It is almost the same as running build command from console, just a different way of passing options.

For a full list of options can be used, please check document page.

Prepare Modules

Materials must be prepared first to cook a good meal. Right now, our materials is a bunch of small modules. Eustia provides many utilities itself(currently under development). Still, there are times you want to add your own ones. To achieve that, create a directory named eustia in the root directory.

Now, let's say I want to have a function to compare version numbers. The first step is to create a js file named compareVersion.js in eustia directory. Then fills it with actual codes to finish the procedure.

// eustia/compareVersion.js
_('isStr each'); // dependencies

// export object
function exports(v1, v2)
{
    if (!isStr(v1) || !isStr(v2)) return;
    ...
}

Now you can use compareVersion anywhere in your project.

Using option library allows you to search functions in other paths, quite useful when sharing functions among several projects. Besides, Lodash functions is available by using eustia-lodash.

More Repositories

1

eruda

Console for mobile browsers
JavaScript
18,761
star
2

licia

Useful utility collection with zero dependencies
JavaScript
2,284
star
3

chii

Remote debugging tool
JavaScript
1,764
star
4

chobitsu

Chrome devtools protocol JavaScript implementation
TypeScript
281
star
5

luna

UI library
TypeScript
241
star
6

eruda-android

Simple webview with eruda loaded automatically
Kotlin
109
star
7

webvn

HTML5 visual novel engine
JavaScript
85
star
8

vivy-docs

Stable diffusion desktop app
63
star
9

whistle.chii

Whistle Chii plugin
JavaScript
43
star
10

liriliri

HTML5 visual novel engine
JavaScript
41
star
11

eruda-code

Eruda plugin for running JavaScript code
JavaScript
32
star
12

eruda-fps

Eruda plugin for displaying fps info
JavaScript
24
star
13

eruda-dom

Eruda plugin for navigating dom tree
JavaScript
20
star
14

vscode-settings-editor

VS Code visual editor for settings like npm package.json
TypeScript
18
star
15

eruda-features

Eruda plugin for browser feature detections
JavaScript
13
star
16

fione

A collection of utility libraries used by liriliri projects
JavaScript
10
star
17

eruda-plugin

Eruda plugin template
JavaScript
9
star
18

eruda-memory

Eruda plugin for displaying memory
JavaScript
9
star
19

eruda-timing

Eruda plugin for performance and resource timing
JavaScript
8
star
20

tinker

Toolbox for developers
TypeScript
5
star
21

eruda-monitor

Eruda plugin for displaying fps, memory and dom nodes
JavaScript
5
star
22

eruda-geolocation

Eruda plugin for testing geolocation
JavaScript
4
star
23

eris

Node c++ addon utilities
C++
4
star
24

webvn-demo

WebVN Html5 Visual Novel Engine Sample Project
JavaScript
4
star
25

eruda-docs

Documentation for Eruda
4
star
26

eruda-touches

Eruda plugin for visualizing screen touches
JavaScript
3
star
27

eruda-worker

Eruda plugin for displaying web worker status
JavaScript
3
star
28

eruda-orientation

Eruda plugin for testing orientation api
JavaScript
3
star
29

lina

Mobile UI library
3
star
30

eruda-vue

Eruda plugin for vue
JavaScript
3
star
31

eustia-component

Eustia component transpiler
JavaScript
3
star
32

licia-docs

Documentation for Licia
JavaScript
2
star
33

deedlit

Simple scripting language
JavaScript
2
star
34

eustia-docs

Eustia website
JavaScript
2
star
35

eustia-babel

Eustia es6 transpiler
JavaScript
2
star
36

eustia-json

Eustia json transpiler
JavaScript
2
star
37

aya

Android adb desktop app
TypeScript
1
star
38

eriri

WebGL 2d library
1
star
39

eruda-benchmark

Eruda plugin for running JavaScript benchmarks
JavaScript
1
star
40

lsla

Scripts used by liriliri projects
JavaScript
1
star
41

webvn-jsdoc3

Jsdoc3 template for WebVN
JavaScript
1
star
42

eustia-lodash

Eustia lodash adapter
JavaScript
1
star