• Stars
    star
    125
  • Rank 286,335 (Top 6 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created almost 7 years ago
  • Updated over 5 years ago

Reviews

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

Repository Details

Bundle, serve, and hot reload with one command

microenvi

Microenvi is a zero configuration micro development environment. Bundle, serve, and hot reload with one command.

Transpile & bundle is done with microbundle.

Quick start

A simple hello world with microenvi and preact;

  • first let's initialize our project npm init --yes
  • then install preact npm i -S preact
  • finally install microenvi npm i -D microenvi

Now add the following to your package.json

{
	"main": "public/static/bundle.mjs",
	"scripts": {
		"dev": "microenvi"
	}
}

Create a public folder and add the following index.html to it.

<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<title>Microenvi</title>
	</head>

	<body>
		<div id="root"></div>
	</body>
</html>

Finally create a src folder and add the following index.js to it.

import {h, render} from 'preact';

render(<h2>Hello, Microenvi</h2>, document.getElementById('root'));

Start your dev environment by running... npm run dev

CLI Options

  Usage
    $ microenvi <command> [options]

  Available Commands
    watch    Bundle, serve, and reload

  For more info, run any command with the `--help` flag
    $ microenvi watch --help

  Options
    -v, --version    Displays current version
    --cwd            Use an alternative working directory  (default .)
    --dir            Specify the directory to watch  (default public)
    --external       Specify external dependencies  (default none)
    --globals        Specify global dependencies  (default none)
    --jsx            A custom JSX pragma like React.createElement  (default h)
    --define         Inline constants  (default none)
    --alias          Remap imports from one module to another  (default none)
    --open           Automatically open browser  (default true)
    --port           Specify a port  (default 3000)
    --single         Serve single page app  (default false)
    --ws             Specify a port for the reload ws  (default 3301)
    -h, --help       Displays this message

The syntax for --define and --alias are as follows:

$ microenvi --define process.env.NODE_ENV=production,NUM=123,BOOL=true
# and
$ microenvi --alias react=preact-compat,react-dom=preact-compat

More Repositories

1

clean-set

A deep assignment alternative to the object spread operator and Object.assign
JavaScript
177
star
2

muve

Muve is a micro library for building interactive javascript applications.
JavaScript
13
star
3

schema-validation

A utility to doing basic schema validation on a plain old javascript object.
TypeScript
4
star
4

elm-productivity

Elm
2
star
5

event-driven

Helper functions for writing event driven systems
TypeScript
2
star
6

over-reacting

JavaScript
1
star
7

booking

A conference room booking demo
JavaScript
1
star
8

muve-router

Simple client side router for muve
JavaScript
1
star
9

urban-yeti

Give me reliable pub/sub
JavaScript
1
star
10

faction

A typed action creator factory
TypeScript
1
star
11

swagger-client-poc

JavaScript
1
star
12

muve-forward

Explore how muve can be used to build progressive web apps
JavaScript
1
star
13

persevere

Continue in a course of action even in the face of difficulty or with little or no prospect of success.
JavaScript
1
star
14

promise-map

Promise.all implementation that takes an object literal
JavaScript
1
star
15

brushfire

Realtime anonymous polling
JavaScript
1
star
16

datasist

An inefficient file based database
JavaScript
1
star
17

re-muve

A micro view builder
JavaScript
1
star
18

preact-slots-demo

Demo issue using preact-slots
JavaScript
1
star
19

draughts

Board games
JavaScript
1
star
20

insanity

A place the projects I do over and over testing different technologies
JavaScript
1
star
21

aberration

Building application with lit-html and redux
TypeScript
1
star
22

fs-fancy

Full stack boiler plate with some bells & whistles
JavaScript
1
star