stupefy

2.0.8 • Public • Published

stupefy

Stupefy is a tool for rapid prototyping of scripts/sites/apps etc.

Installation

$ npm install -g stupefy

Go ahead and create / install some spells now (see below).

NOTE: To install and update spells, git is required

How it works

asciicast

Stupefy enchants(modifies) your code with spells, i.e. just a fancy name for a couple of Handlebars templates which expand as snippets on steroids.

Spells are called using a specific syntax within your code comments i.e. -

 enchant <spell name>, key1: value1, key2: [ a1, a2 ] */

where spell name is the file name of the spell.

For example,

function print() {
    s = '';
    /* enchant readFile, file: 'hello.txt', str: 's'  */
    console.log(s);
}

This can be enchanted using:

$ stupefy enchant <filename> # optional: -o <outputfile>

Spells are present in spellbooks, which are mere git repositories comprising such Handlebars templates. Adding the templates to t One such being this.

The spellbook can be installed using

$ stupefy install https://github.com/thelehhman/spellbook

Spellbooks can be updated anytime using the command

$ stupefy update

More Demos

One spell can be enchanted in many languages so that you focus on the application and not the syntax.

For example, here is a demo using the spell sieve in both C++ and Python

asciicast asciicast

Variables

Global variables can be defined using def global. In an HTML File, for example,

<!-- def global, list: [ 1, 2, 3] -->

Configuration

The file ~/.stupefy.json can be configured to manipulate -

  • The default opening and closing tag using : tag_start, tag_end,
  • The spellbooks directory, using: spells
  • Disabling language based opening and closing tags by setting : auto_tags
  • Custom plugins using plugins array

Stupefy v/s Snippets

  • Language Independent (i.e. same spell can do same stuff across different languages)

    For example, the shell_exec spell allows you to forget about the standard library and emphasize the idea on different programming languages.

  • Support Objects and Arrays as arguments to build up dynamic code (see bootstrap_nav)

  • Code Editor Independent

  • Spells are easier to manage than snippets

Package Sidebar

Install

npm i stupefy

Weekly Downloads

0

Version

2.0.8

License

MIT

Last publish

Collaborators

  • samarjeet27