0.1.2 • Published 6 years ago

drupe v0.1.2

Weekly downloads
16
License
MIT
Repository
github
Last release
6 years ago

drupe

Full stack mvc web framework

Status

This is an in development version.

Concepts

Drupe is designed to provide everything from build tools to powerful server and client apis. The server is bundled using webpack to keep track of client entry points. Client code is then shipped in two versions, one to be compatible with old browsers and one for modern browsers to maximize performance. Drupe automatically decides which version to send to the client based on it's user agent.

Quick Start

npm install drupe
// index.js
'use strict';

import {App} from 'drupe';
import index from './index.html';

const app = new App({ctx: __dirname});
app.get('/', index);
app.listen(8080);
<!-- index.html -->
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<script module="./app"></script>
	</body>
</html>
// app.js
'use strict';

console.log('Hello World!');

Add the following script to your package.json:

"scripts": {
	"build": "drupe --clean --build --prod",
	"start": "drupe --run",
	"watch": "drupe --clean --build --run --auto-reload --watch"
}
# Build and run in production mode:
npm run build
npm run start

# Run and watch for changes in development mode:
npm run watch

Configuration

The configuration is an optional nodejs module with the following default values:

module.exports = {
	// Specify the output directory:
	// (This can only be set in the main configuration!)
	dist: 'dist',

	// Specify the server entry point:
	entry: '.',

	// Available webpack config extensions
	// to apply on server-slide code:
	server: {
		resolve: {},
		module: {
			rules: [],
			noParse: undefined
		},
		plugins: []
	}

	// Available webpack config extensions
	// to apply on client-slide code:
	client: {
		resolve: {},
		module: {
			rules: [],
			noParse: undefined
		},
		plugins: []
	},

	// Additional configuration for the cli watching for changes:
	watch: {
		// An array of files or directories to ignore when watching for changes.
		// - Paths are resolved to the context directory.
		ignore: []
	}
};

Modules

NameUsage
drupe.default.*The main config.
drupe.development.*Development specific config overrides.
drupe.production.*Production specific config overrides.

Command Line Interface

FormatShortcutDescription
--clean-cClean up output directories
--build-bBuild the application
--run-xRun the application

Additional arguments

FormatShortcutDescription
--prod-pEnable production mode. (Use with --build)
--auto-reload-aAuto-reload the client in browsers after application restarts. (Use with --build)
--watch-wRestart the application when a file system change occurs.
--restart-rRestart the application when the process has exited.
--ctx=<path>-c <path>Specify the basedir of the application. Default is the current working directory.