3.1.0 • Published 10 months ago

de-builder v3.1.0

Weekly downloads
4
License
MIT
Repository
github
Last release
10 months ago

de-builder

npm install --save-dev de-builder

What is it?

de-builder creates a Live Development Environment (LDE). In this environment you can write .coffee, .less and .pug and your code will be compiled on save. The corresponding part of you program will be either injected or restarted. This is achieved by using various modules.

Getting Started

  • Create a project folder mkdir test.
  • Navigate to the project folder cd test.
  • Create a package.json file to store all your project information. You could use npm init.
  • Then npm install --save-dev de-builder.
  • Once de-builder has been installed a build.js file will have been created.
  • You can adjust the config in the build.js file according to your specifications (all default options are shown but not required).
  • Now run node build.js and your LDE will run and you can start working on your project.

NOTE: If you've kept all default settings and started node build.js in an empty project you will encounter two error's LDE - Less and LDE - Browserify. That's because by default an entry file for less and browserify is expected. You can disable lessand browserify or create the entry files to solve the error.

Support

The following languages are supported:

  • .coffee
  • .less
  • .pug

The following types of LDE are supported:

  • Server + Client
  • Server
  • Client

You can create multiple browserify and less bundles

LDE's

Which LDE should I use? Type 1 Server + Client: If you are making a program / server with a website interface. Type 2 Server: If you are making a program / server without a website as an interface. Type 3 Client: If you are making a program / server only using the client-side bundle part

Multiple bundles

de-builder will switch to 'multiple bundle mode' if the entry file defined in the config cannot be found. In the console it will notify you which type is being used e.g.

info  LDE - Less       →  Type: single
info  LDE - Browserify →  Type: multi

In multi mode it will check all child folders of the js and/or css (.less) folder and used them as the entry points. This means that a folder in multi mode must contain an index(.coffee/.less) file.

Structure

Ok so how should I structre my project? You can use the structre described below but you are free to choose, however make sure you provide the correct entry folder and file in the build.js folder if you choose a custom structure.

Server + Client (LDE type 1)

Without the src/ folders shown in type 2 and 3

src/
	client/
		Client (LDE type 3, excluding its "src/" folder)

	server/
		Server (LDE type 2, excluding its "src/" folder)

Server (LDE type 2)

src/
	db/
		connection.coffee
		index.coffee
	email/
		handler.coffee
		index.coffee
	server/
		index.coffee
	networking/
		index.coffee
	app.coffee
	config.coffee
	manager.coffee

Client (LDE type 3)

src/
	css/
		app/
			elements/
				header.less
				main.less
			pages/
				home.less
			fonts.less
			index.less
			variables.less
		pdf/
			index.less
	fonts/
		font-file.ttf
		font-file2.ttf
	images/
		favicon.ico
		users/
			user1.png
			user2.png
	js/
		app/
			elements/
				header.coffee
			templates/
				header.pug
			index.coffee
			main.coffee
			router.coffee
		vendor/
			index.coffee

Browser-sync

Once de-builder is running the browser-sync ui can by default be found at localhost:9000. But if you run multiple instances of de-builder it will try to use 9000 + 2x instead, so running 3 instances of de-builder will have browser-sync running at 9000, 9002 and 9004. The required browser-sync code-snippet has been added to the bundle already by de-builder so browser-sync will work out of the box on all your pages and devices =D! In multi mode folder(s) are to be provided telling de-builder in which bundle(s) to add the browser-sync snippet. By default vendor is used. See config.browserSync.multi

Modules

The main modules used to create this LDE:

Config

# Default
config =

	# Source and build directory
	src   : "src"
	build : "build"

	# Client and server directory
	client: "client"
	server: "server"

	# Less directory and entry file
	less:
		file   : "app.css"
		entry  : "app.less"
		folder : "css"

	# Browserify directory and entry file
	browserify:

		# Used for single build
		single:
			entry  : "app.coffee"
			bundle : "app.bundle.js"

		# Name used for multi bundle builds
		multi : "bundle.js"

		# Show or hide source maps
		debug : true

		# Folder containing all js/coffee files
		folder : "js"

	# Server path/file to be started by forever
	forever:

		# File to start
		entry   : "app.js"

		# Use it, or not
		enabled : true

	# Use browser-sync options
	browserSync:

		# Use it, or not
		enabled : true

		# user interface port
		ui      : 9000

		# server port
		server  : 9001

		# The bundle(s) which should contain the browser-sync code
		multi   : ["vendor"]

	# LDE environments
	# 1 Server+Client
	# 2 Server
	# 3 Client
	type: 1

	# Show de-builder debug events
	debug: false

Common errors

Filewatchers

There is a limit to how may files can be watched at the same time. So if you are running dropbox, a gui for git, sublime text and de-builder it's easily possible to run out of file watchers. You can get the error: Fatal error: watch ENOSPC

Use the follwoing line to increase the allowed filewatchers on your system:

echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

source: http://stackoverflow.com/questions/16748737/grunt-watch-error-waiting-fatal-error-watch-enospc

Port in use

Pay attention to which port you are using and if another process issn't already running it. If you run node build.js you may see the error: Error: listen EADDRINUSE. Check if your port is unique. If so your current application might still be running. Check with top or htop in the ternimal and terminate it.

3.0.2

10 months ago

3.1.0

10 months ago

3.0.1

11 months ago

3.0.0

1 year ago

2.2.0

2 years ago

2.1.6-alpha.1

2 years ago

2.1.4

2 years ago

2.1.6

2 years ago

2.1.5

2 years ago

2.1.2

2 years ago

2.1.3

2 years ago

2.1.1

3 years ago

2.1.0

3 years ago

2.0.0

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

0.9.8

3 years ago

0.9.7

3 years ago

0.9.6

4 years ago

0.9.5

4 years ago

0.9.4

4 years ago

0.9.3

4 years ago

0.9.2

5 years ago

0.9.1

6 years ago

0.9.0

6 years ago

0.8.3

6 years ago

0.8.2

6 years ago

0.8.1

6 years ago

0.8.0

7 years ago

0.7.6

7 years ago

0.7.5

7 years ago

0.7.4

8 years ago

0.7.3

8 years ago

0.7.2

8 years ago

0.7.1

8 years ago

0.7.0

8 years ago

0.7.0-alpha-1

8 years ago

0.6.3

8 years ago

0.6.2

8 years ago

0.6.1

8 years ago

0.6.0

9 years ago

0.5.15

9 years ago

0.5.14

9 years ago

0.5.13

9 years ago

0.5.12

9 years ago

0.5.11

9 years ago

0.5.10

9 years ago

0.5.9

9 years ago

0.5.8

9 years ago

0.5.7

9 years ago

0.5.6

9 years ago

0.5.5

9 years ago

0.5.4

9 years ago

0.5.3-1

9 years ago

0.5.3

9 years ago

0.5.2-2

9 years ago

0.5.2-1

9 years ago

0.5.2

9 years ago

0.5.1

9 years ago

0.5.0

9 years ago

0.4.5

9 years ago

0.4.4

9 years ago

0.4.3

9 years ago

0.4.2

9 years ago

0.4.1

9 years ago

0.4.0

9 years ago

0.3.1

9 years ago

0.2.2-1

9 years ago

0.2.2

9 years ago

0.2.1

9 years ago

0.2.0-3

9 years ago

0.2.0-2

9 years ago

0.2.0-1

9 years ago

0.2.0

9 years ago

0.1.15

9 years ago

0.1.13

9 years ago

0.1.12

9 years ago

0.1.11

9 years ago

0.1.9

9 years ago

0.1.8

9 years ago

0.1.7

9 years ago

0.1.6

9 years ago

0.1.5

9 years ago

0.1.4

9 years ago

0.1.2

9 years ago

0.1.1

9 years ago

0.1.0

9 years ago