npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

makebird

v0.1.1

Published

geeks builder for non modular languages

Downloads

19

Readme

Description

Makebird is zero abstraction cost module system.

Do I need it?

  • Would you like to have project spread in multiple files and then build them into one?
  • Does your language have good enough built in modules support?
  • Would you like paste content of a file to specific place into another one?
  • Do you need toggle peaces of code based on some flags or based on code usage?
  • Do you have dependent projects with similar structure of dependencies?
  • Do you care about code beauty after build stage?

Makebird project has representation in context tree. This tree can be distributed in file system. Context can be included or excluded in result text (see define, if, component, base tokens description).

Usage

Bash

Installation

npm i -g makebird

makebird -h

  Usage: makebird [options] <file ...>

  Options:

    -h, --help                       output usage information
    -V, --version                    output the version number
    -t --charset <charset>           input files charset
    -o --no-onlyUsed                 include only used contexts
    -p --partExtensions [list]       allowed extensions
    -c --copyrightExtensions [list]  copyright extensions

Defaults appropriately: utf8 [.js] [.txt]

Write result in output file

makebird path/to/input/file > output/file

Code

npm i makebird
var makebird = require('makebird');

makebird.build(config, function(err, result, times) {
	if (err) {
		console.log(err);
		return;
	}

	// result usage

});

Tokens

//!~ makebird comment will be cut out of the result

// set context name
//~ name [name]

// set context description (may be used in UI tools in future)
//~ info [info]

// stack copyright file
//~ copyright [path]
// all copyrights will be on the top of result text

// paste content of the file instead token (without creating of new context)
//~ part [path]

// paste content of the file instead token (with creating of new context)
//~ component [path]

// files inclueded as components must contain name token
// otherwise it will be randomly generated so you can't reffer to the context in base token

//~ define [variable]
// currently supported just boolean value (defined or not)

// set dependency of context
//~ base [namespace]
//~ base [namespace].*
//~ base ~.[namespace]
//~ base ~.[namespace].*

// ~ is placeholder for all parent contexts
// * is placeholder for context children
// absolute namespaces (without ~) not so usefull since namespace itself may easily change

// open new context
//~ if [variable]
//~ if this.[name]
//~ if this.*
//~ if [namespace]
//~ if [namespace].*

// this is placeholder for current context
// * means any module within current context

// close context
//~ endif

// //~ component a.txt (a.txt has "a" name) is equal to //~ if this.a ... //~ endif

//~ mind [path]
// take into account bases from other project but don't include them in current one

// name & variable: Word without spaces can contain letters only
// namespace: Names separated by dot. Must contain at least 2 names (special names included).
// path: Path to the file relative to current file

Recommendations & Notes

  • use CamelCase with first capital letter for name token
  • use camelCase with first stroke letter for if token
  • define token is aimed for debug mode and some others mostly
  • inside libraries use ~.namespace notation for internal bases
  • use longest possible namespaces to avoid conflicts

Example

This example presents in examples directory.

Let's say we have a warnings library (js & css files) and we use it in our application.

app/index.html

<!doctype html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Makebird app example</title>
        <link rel="stylesheet" href="dist/style.css">
    </head>
    <body>
        <script src="dist/script.js"></script>
    </body>
</html>

app/copyright.txt

/*
* Test app example
* (C) Archy Sharp 2016
*/

app/js/warnings.js

//~ name Warnings

var warnings = new function() {

	function createWarning(text, type) {
		var node = document.createElement('div');
		node.classList.add('warning');
		node.classList.add(type);
		node.textContent = text;
		return node;
	}

	//~ if this.error
	this.error = function(node, text) {
		node.appendChild(createWarning(text, 'error'));
	};
	//~ endif

	//~ if this.notification
	this.notification = function(node, text) {
		node.appendChild(createWarning(text, 'notification'));
	};
	//~ endif

	//~ if this.info
	this.info = function(node, text) {
		node.appendChild(createWarning(text, 'info'));
	};
	//~ endif

};

app/js/app.js

//~ copyright ../copyright.txt

//~ define withError
//~ base ~.Warnings.notification

//~ if withError
	//~ base ~.Warnings.error
//~ endif

(function() {

	//~ component warnings.js

	var body = document.body;

	warnings.notification(body, 'Notification message');
	//~ if withError
	warnings.error(body, 'Error message');
	//~ endif

	//~ part other.js


})();

app/js/other.js

// just example of part token

app/css/warnings.css

//~ name Warnings

.warning {
    padding: 30px;
    font-size: 15px;
    border-radius: 5px;
    box-shadow: 0 0 5px rgba(0,0,0,.1);
    margin-bottom: 10px;
}

//~ if this.error
.warning.error {
    background: tomato;
    color: white;
}
//~ endif

//~ if this.notification
.warning.notification {
    background: gainsboro;
    color: darkslategrey;
}
//~ endif

//~ if this.info
.warning.info {
    background: deepskyblue;
    color: black;
}
//~ endif

app/css/app.css

//~ copyright ../copyright.txt

body {
    padding: 30px;
    margin: 0;
    font: normal 13px/16px Arial, sans-serif;
}

//~ mind ../js/app.js
//~ component warnings.css

RESULTS

../examples: makebird app/js/app.js > app/dist/script.js
../examples: makebird app/css/app.css -p .css > app/dist/style.css

app/dist/script.js

/*
* test app example
* (C) Archy Sharp 2016
*/




(function() {

	var warnings = new function() {

		function createWarning(text, type) {
			var node = document.createElement('div');
			node.classList.add('warning');
			node.classList.add(type);
			node.textContent = text;
			return node;
		}

		this.error = function(node, text) {
			node.appendChild(createWarning(text, 'error'));
		};

		this.notification = function(node, text) {
			node.appendChild(createWarning(text, 'notification'));
		};

	};

	var body = document.body;

	warnings.notification(body, 'Notification message');

	warnings.error(body, 'Error message');

	// just example of part token

})();

app/dist/style.css

/*
* test app example
* (C) Archy Sharp 2016
*/



body {
    padding: 30px;
    margin: 0;
    font: normal 13px/16px Arial, sans-serif;
}

.warning {
    padding: 30px;
    font-size: 15px;
    border-radius: 5px;
    box-shadow: 0 0 5px rgba(0,0,0,.1);
    margin-bottom: 10px;
}

.warning.error {
    background: tomato;
    color: white;
}

.warning.notification {
    background: gainsboro;
    color: darkslategrey;
}